[FFmpeg-devel] [PATCH] h264_parser: force fetching a new timestamp until a frame start was found

Hendrik Leppkes h.leppkes at gmail.com
Wed Sep 30 13:04:15 CEST 2015


This fixes broken timestamps on streams where the SPS/PPS is at the end of
the previous packet, instead of in front of the next packet, observed in
badly packetized MPEG-TS streams.
---
 libavcodec/h264_parser.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c
index 19d1aa3..466008e 100644
--- a/libavcodec/h264_parser.c
+++ b/libavcodec/h264_parser.c
@@ -520,6 +520,9 @@ static int h264_parse(AVCodecParserContext *s,
     } else {
         next = h264_find_frame_end(p, buf, buf_size);
 
+        if (next == END_NOT_FOUND && pc->frame_start_found == 0)
+            s->fetch_timestamp = 1;
+
         if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
             *poutbuf      = NULL;
             *poutbuf_size = 0;
-- 
2.5.3.windows.1



More information about the ffmpeg-devel mailing list