To test this new patch, again use testcount.mp3 <http://happyworm.com/jPlayerLab/halite/jumptest/testcount.mp3> (CBR, corrupt TOC).
Current ffmpeg (with none of my mp3 patches) ./ffplay testcount.mp3 -ss 00:33:20 -usetoc 0 plays out "1395", which is correct ./ffplay testcount.mp3 -ss 00:33:20 -usetoc 1 plays out "..378, 1389", which is incorrect due to the corrupted TOC. ./ffplay testcount.mp3 -ss 00:33:20 -fflags fastseek also plays out "..378, 1389" because current fast_seek logic uses the TOC whenever available for CBR and VBR alike. After applying my *latest* patch: ./ffplay testcount.mp3 -ss 00:33:20 -usetoc 0 is unchanged: plays out "1395", which is correct ./ffplay testcount.mp3 -ss 00:33:20 -usetoc 1 is unchanged: still plays out "378, 1389". This is wrong, but it allows users to force using TOC should they prefer. ./ffplay testcount.mp3 -ss 00:33:20 -fflags fastseek *is changed: *plays out "1395", which is correct. fast seek no longer uses the TOC for CBR files. What do you think? I personally prefer this way so that usetoc is still meaningful for CBR files. Thanks, Chris On Mon, Nov 16, 2015 at 4:58 PM, <chcunning...@chromium.org> wrote: > From: Chris Cunningham <chcunning...@chromium.org> > > "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..e12266c 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) > + // When fast seeking, prefer to use the TOC when available for VBR > files > + // since av_rescale may not be accurate for VBR. For CBR, rescaling is > + // always accurate and more direct than a TOC lookup. > + if (fast_seek && (mp3->is_cbr || !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