[FFmpeg-cvslog] avcodec: Fix duration error after seek operation

wangxingchao git at videolan.org
Sat Nov 16 02:34:57 CET 2013


ffmpeg | branch: master | wangxingchao <wangxingchao at xiaomi.com> | Fri Nov 15 15:42:46 2013 +0800| [68900bf16bb4dda35cf5f2801ce72c15056f1939] | committer: 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: wangxingchao <wangxingchao at xiaomi.com>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=68900bf16bb4dda35cf5f2801ce72c15056f1939
---

 libavcodec/cook_parser.c |    7 ++++---
 1 file 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;



More information about the ffmpeg-cvslog mailing list