"Fast seek" uses linear interpolation to find the position of the
requested seek time. For CBR this is more direct than using the
mp3 TOC and bypassing the TOC avoids problems when the TOC is
corrupted (e.g. https://crbug.com/545914).

For VBR, fast seek is not precise, so continue to prefer the TOC
when available.
---
 libavformat/mp3dec.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
index 32ca00c..7946261 100644
--- a/libavformat/mp3dec.c
+++ b/libavformat/mp3dec.c
@@ -515,8 +515,10 @@ static int mp3_seek(AVFormatContext *s, int stream_index, 
int64_t timestamp,
             filesize = size - s->internal->data_offset;
     }
 
-    if (   (mp3->is_cbr || fast_seek)
-        && (mp3->usetoc == 0 || !mp3->xing_toc)
+    // Always use "fast seek" (linear interpolation) for CBR. For CBR this is
+    // a precise method and more direct than using TOC. For VBR this is not
+    // perfectly accurate, so prefer TOC if available.
+    if ((mp3->is_cbr || (fast_seek && (mp3->usetoc == 0 || !mp3->xing_toc)))
         && st->duration > 0
         && filesize > 0) {
         ie = &ie1;
-- 
2.6.0.rc2.230.g3dd15c0

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to