[FFmpeg-devel] [PATCH] libavcodec/parser.c: re-fetch PTS/DTS if fetch failed

luckliuyuxin luckliuyuxin at 163.com
Wed Apr 22 13:17:59 CEST 2015


From 00b457adb855b0b25ac7cde4a9cb8c7b53fd0511 Mon Sep 17 00:00:00 2001
From: liuyuxin <liuyuxin at xiaomi.com>
Date: Wed, 22 Apr 2015 16:56:42 +0800
Subject: [PATCH] re-fetch PTS/DTS if fetch failed


Signed-off-by: liuyuxin <liuyuxin at xiaomi.com>
---
 libavcodec/parser.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/parser.c b/libavcodec/parser.c
index b06a959..e62407b 100644
--- a/libavcodec/parser.c
+++ b/libavcodec/parser.c
@@ -163,6 +163,11 @@ int av_parser_parse2(AVCodecParserContext *s, AVCodecContext *avctx,
         s->last_dts        = s->dts;
         s->last_pos        = s->pos;
         ff_fetch_timestamp(s, 0, 0, 0);
+        if (s->dts == AV_NOPTS_VALUE && s->pts == AV_NOPTS_VALUE
+                && s->pos == -1 && !s->offset) {
+            //fetch failed, re-fetch next time
+            s->fetch_timestamp = 1;
+        }
     }
     /* WARNING: the returned index can be negative */
     index = s->parser->parser_parse(s, avctx, (const uint8_t **) poutbuf,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-re-fetch-PTS-DTS-if-fetch-failed.patch
Type: application/octet-stream
Size: 1563 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150422/02ededa3/attachment.obj>


More information about the ffmpeg-devel mailing list