Commit 68900bf1 authored by wangxingchao's avatar wangxingchao Committed by Michael Niedermayer

avcodec: Fix duration error after seek operation

After seek, s->duration need recalculation, AVCodecParserContext need be set
again. Without the fix, the first audio packet would be dropped after
compute_pkt_fields() as the final pts/dts become invalid.
Signed-off-by: 's avatarwangxingchao <wangxingchao@xiaomi.com>
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 8cc59ec8
...@@ -40,11 +40,12 @@ static int cook_parse(AVCodecParserContext *s1, AVCodecContext *avctx, ...@@ -40,11 +40,12 @@ static int cook_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
{ {
CookParseContext *s = s1->priv_data; CookParseContext *s = s1->priv_data;
if (s->duration) if (!s->duration &&
s1->duration = s->duration; avctx->extradata && avctx->extradata_size >= 8 && avctx->channels)
else if (avctx->extradata && avctx->extradata_size >= 8 && avctx->channels)
s->duration = AV_RB16(avctx->extradata + 4) / avctx->channels; s->duration = AV_RB16(avctx->extradata + 4) / avctx->channels;
s1->duration = s->duration;
/* always return the full packet. this parser isn't doing any splitting or /* always return the full packet. this parser isn't doing any splitting or
combining, only setting packet duration */ combining, only setting packet duration */
*poutbuf = buf; *poutbuf = buf;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment