summaryrefslogtreecommitdiffstats
path: root/libavformat/mp3dec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-04-20 20:42:38 +0200
committerMichael Niedermayer <michaelni@gmx.at>2015-04-21 01:31:28 +0200
commitecf34e8fc2f7c8ec67bf939e3fb621605f4a0697 (patch)
tree8097ea1c954e2e3ab92bfc2fa295738b82a93c71 /libavformat/mp3dec.c
parent30ba28fe8e5757ab4ee61b9c0e8a418bd7d54b50 (diff)
downloadffmpeg-streaming-ecf34e8fc2f7c8ec67bf939e3fb621605f4a0697.zip
ffmpeg-streaming-ecf34e8fc2f7c8ec67bf939e3fb621605f4a0697.tar.gz
avformat/mp3dec: Adjust returned timestamp in the CBR seeking case
With this the returned timestamp should match the packet instead of the requested timestamp, which may lay between packets Reviewed-by: wm4 <nfxjfg@googlemail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/mp3dec.c')
-rw-r--r--libavformat/mp3dec.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
index 06bc1d0..0604e31 100644
--- a/libavformat/mp3dec.c
+++ b/libavformat/mp3dec.c
@@ -489,6 +489,12 @@ static int mp3_seek(AVFormatContext *s, int stream_index, int64_t timestamp,
ret = avio_seek(s->pb, best_pos, SEEK_SET);
if (ret < 0)
return ret;
+
+ if (mp3->is_cbr && ie == &ie1) {
+ int frame_duration = av_rescale(st->duration, 1, mp3->frames);
+ ie1.timestamp = frame_duration * av_rescale(best_pos - s->internal->data_offset, mp3->frames, mp3->header_filesize);
+ }
+
ff_update_cur_dts(s, st, ie->timestamp);
st->skip_samples = ie->timestamp <= 0 ? mp3->start_pad + 528 + 1 : 0;
return 0;
OpenPOWER on IntegriCloud