[FFmpeg-devel] [PATCH 5/5] avformat/mp3dec: alwas prefer xing toc for seeking if present

wm4 nfxjfg at googlemail.com
Tue Apr 14 21:24:37 CEST 2015


For consistency. This masked another bug before.
---
 libavformat/mp3dec.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
index c48f1f1..e157a1a 100644
--- a/libavformat/mp3dec.c
+++ b/libavformat/mp3dec.c
@@ -432,7 +432,12 @@ static int mp3_seek(AVFormatContext *s, int stream_index, int64_t timestamp,
     int64_t best_pos;
     int best_score;
 
-    if (   mp3->is_cbr
+    if (mp3->xing_toc) {
+        if (ret < 0)
+            return ret;
+
+        ie = &st->index_entries[ret];
+    } else if (mp3->is_cbr
         && st->duration > 0
         && mp3->header_filesize > s->internal->data_offset
         && mp3->frames) {
@@ -446,11 +451,6 @@ static int mp3_seek(AVFormatContext *s, int stream_index, int64_t timestamp,
         timestamp = av_clip64(timestamp, 0, duration);
         ie->timestamp = timestamp;
         ie->pos       = av_rescale(timestamp, filesize, duration) + s->internal->data_offset;
-    } else if (mp3->xing_toc) {
-        if (ret < 0)
-            return ret;
-
-        ie = &st->index_entries[ret];
     } else {
         st->skip_samples = timestamp <= 0 ? mp3->start_pad + 528 + 1 : 0;
 
-- 
2.1.4



More information about the ffmpeg-devel mailing list