[FFmpeg-cvslog] Fix parser not to clobber has_b_frames when extradata is set.
Reimar Döffinger
git at videolan.org
Sat Aug 20 12:29:23 CEST 2011
ffmpeg | branch: master | Reimar Döffinger <Reimar.Doeffinger at gmx.de> | Fri Aug 19 22:38:34 2011 +0200| [31ac0ac29b6bba744493f7d1040757a3f51b9ad7] | committer: Reimar Döffinger
Fix parser not to clobber has_b_frames when extradata is set.
Due to it in contrast to the decoder not setting up low_delay,
the code in parse_nal_units would always end up setting has_b_frames
to 1 (except when stream is explicitly marked as low delay).
Since the parser itself would create extradata, simply reopening
the parser would cause this.
estimate_timings_from_pts would cause the parser to be reopened
on the same stream.
This fixes trac issue #360.
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger at gmx.de>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=31ac0ac29b6bba744493f7d1040757a3f51b9ad7
---
libavcodec/h264_parser.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c
index 27fba4b..ad134b3 100644
--- a/libavcodec/h264_parser.c
+++ b/libavcodec/h264_parser.c
@@ -251,6 +251,12 @@ static int h264_parse(AVCodecParserContext *s,
h->got_first = 1;
if (avctx->extradata_size) {
h->s.avctx = avctx;
+ // must be done like in decoder, otherwise opening the parser,
+ // letting it create extradata and then closing and opening again
+ // will cause has_b_frames to be always set.
+ // Note that estimate_timings_from_pts does exactly this.
+ if (!avctx->has_b_frames)
+ h->s.low_delay = 1;
ff_h264_decode_extradata(h);
}
}
More information about the ffmpeg-cvslog
mailing list