summaryrefslogtreecommitdiffstats
path: root/libavcodec/cook_parser.c
diff options
context:
space:
mode:
authorwangxingchao <wangxingchao@xiaomi.com>2013-11-15 15:42:46 +0800
committerMichael Niedermayer <michaelni@gmx.at>2013-11-16 02:02:51 +0100
commit68900bf16bb4dda35cf5f2801ce72c15056f1939 (patch)
treed9fd867ec3f2299a99f0133b3ca7e4a7f06b4d5d /libavcodec/cook_parser.c
parent8cc59ec881b8706fb3036a2a83f7ededa468dedb (diff)
downloadffmpeg-streaming-68900bf16bb4dda35cf5f2801ce72c15056f1939.zip
ffmpeg-streaming-68900bf16bb4dda35cf5f2801ce72c15056f1939.tar.gz
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: wangxingchao <wangxingchao@xiaomi.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/cook_parser.c')
-rw-r--r--libavcodec/cook_parser.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libavcodec/cook_parser.c b/libavcodec/cook_parser.c
index f17f56e..6dbbfd8 100644
--- a/libavcodec/cook_parser.c
+++ b/libavcodec/cook_parser.c
@@ -40,11 +40,12 @@ static int cook_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
{
CookParseContext *s = s1->priv_data;
- if (s->duration)
- s1->duration = s->duration;
- else if (avctx->extradata && avctx->extradata_size >= 8 && avctx->channels)
+ if (!s->duration &&
+ avctx->extradata && avctx->extradata_size >= 8 && 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
combining, only setting packet duration */
*poutbuf = buf;
OpenPOWER on IntegriCloud