diff options
author | Janne Grunau <janne-libav@jannau.net> | 2012-11-16 17:31:09 +0400 |
---|---|---|
committer | Janne Grunau <janne-libav@jannau.net> | 2012-11-26 13:25:39 +0400 |
commit | 706acb558a38eba633056773280155d66c2f4b24 (patch) | |
tree | 38484e8825db6f2328054f81631d28bce2edd8a0 /libavcodec/h264.c | |
parent | 7ee40713621dbabf3d62e3cc3c4b26ce19b43146 (diff) |
h264: enable low delay only if no delayed frames were seen
Dropping frames is undesirable but that is the only way by which the
decoder could return to low delay mode. Instead emit a warning and
continue with delayed frames.
Fixes a crash in fuzzed sample nasa-8s2.ts_s20033 caused by a larger
than expected has_b_frames value. Low delay keeps getting re-enabled
from a presumely broken SPS.
CC: libav-stable@libav.org
Diffstat (limited to 'libavcodec/h264.c')
-rw-r--r-- | libavcodec/h264.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c index f45c572a41..658d865339 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -3867,8 +3867,14 @@ again: if (s->flags & CODEC_FLAG_LOW_DELAY || (h->sps.bitstream_restriction_flag && - !h->sps.num_reorder_frames)) - s->low_delay = 1; + !h->sps.num_reorder_frames)) { + if (s->avctx->has_b_frames > 1 || h->delayed_pic[0]) + av_log(avctx, AV_LOG_WARNING, "Delayed frames seen " + "reenabling low delay requires a codec " + "flush.\n"); + else + s->low_delay = 1; + } if (avctx->has_b_frames < 2) avctx->has_b_frames = !s->low_delay; |