diff options
Diffstat (limited to 'chromium/third_party/ffmpeg/libavformat/oggparseopus.c')
-rw-r--r-- | chromium/third_party/ffmpeg/libavformat/oggparseopus.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/chromium/third_party/ffmpeg/libavformat/oggparseopus.c b/chromium/third_party/ffmpeg/libavformat/oggparseopus.c index aafefbbe65b..75c611413ec 100644 --- a/chromium/third_party/ffmpeg/libavformat/oggparseopus.c +++ b/chromium/third_party/ffmpeg/libavformat/oggparseopus.c @@ -32,6 +32,7 @@ struct oggopus_private { int64_t cur_dts; }; +#define OPUS_SEEK_PREROLL_MS 80 #define OPUS_HEAD_SIZE 19 static int opus_header(AVFormatContext *avf, int idx) @@ -66,6 +67,9 @@ static int opus_header(AVFormatContext *avf, int idx) memcpy(st->codec->extradata, packet, os->psize); st->codec->sample_rate = 48000; + av_codec_set_seek_preroll(st->codec, + av_rescale(OPUS_SEEK_PREROLL_MS, + st->codec->sample_rate, 1000)); avpriv_set_pts_info(st, 64, 1, 48000); priv->need_comments = 1; return 1; @@ -130,16 +134,13 @@ static int opus_packet(AVFormatContext *avf, int idx) duration += d; last_pkt = next_pkt = next_pkt + os->psize; for (; seg < os->nsegs; seg++) { - if (os->segments[seg] < 255) { - int d = opus_duration(last_pkt, os->segments[seg]); - if (d < 0) { - duration = os->granule; - break; - } - duration += d; - last_pkt = next_pkt + os->segments[seg]; - } next_pkt += os->segments[seg]; + if (os->segments[seg] < 255 && next_pkt != last_pkt) { + int d = opus_duration(last_pkt, next_pkt - last_pkt); + if (d > 0) + duration += d; + last_pkt = next_pkt; + } } os->lastpts = os->lastdts = os->granule - duration; |