[FFmpeg-cvslog] avformat/mp3dec: optimize mp3_seek() for dir < 0

Michael Niedermayer git at videolan.org
Sun Mar 2 00:26:09 CET 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Mar  2 00:18:25 2014 +0100| [171dd67520b649a5b7a0f4fbff72ac88bbedfeab] | committer: Michael Niedermayer

avformat/mp3dec: optimize mp3_seek() for dir < 0

this minimizes the amount of protocol seeks and reading needed in that case

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=171dd67520b649a5b7a0f4fbff72ac88bbedfeab
---

 libavformat/mp3dec.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
index c1ce173..ba77bce 100644
--- a/libavformat/mp3dec.c
+++ b/libavformat/mp3dec.c
@@ -318,6 +318,8 @@ static int mp3_seek(AVFormatContext *s, int stream_index, int64_t timestamp,
         return -1;
     }
 
+    if (dir < 0)
+        avio_seek(s->pb, FFMAX(ie->pos - 4096, 0), SEEK_SET);
     ret = avio_seek(s->pb, ie->pos, SEEK_SET);
     if (ret < 0)
         return ret;



More information about the ffmpeg-cvslog mailing list