aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2016-05-03 15:45:02 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2016-05-03 15:56:57 +0200
commit1ef267b83f8b71c07c2453852ce8bb44fa27a2da (patch)
tree849a7ef772e51798846b19199cb2b5034be88cf6 /libavcodec
parent7966ddfc0bb7ee87dc2606b7b146701db6f6c717 (diff)
downloadffmpeg-1ef267b83f8b71c07c2453852ce8bb44fa27a2da.tar.gz
avcodec/h264: Put the removed SPS handling code back
reverts one hunk from 7966ddfc0bb7ee87dc2606b7b146701db6f6c717 The new code from 7966ddfc0bb7ee87dc2606b7b146701db6f6c717 only covers extradata based SPS Fixes: ffplay -ss 13 58af5798-fa2c-42a2-997d-dc8e49de2d8a.flv Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/h264.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 113c96fa55..7784026afb 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -1490,9 +1490,23 @@ again:
break;
case NAL_SPS:
init_get_bits(&h->gb, ptr, bit_length);
- ret = ff_h264_decode_seq_parameter_set(h, 0);
- if (ret < 0 && (h->avctx->err_recognition & AV_EF_EXPLODE))
- goto end;
+ if (ff_h264_decode_seq_parameter_set(h, 0) >= 0)
+ break;
+ if (h->is_avc ? nalsize : 1) {
+ av_log(h->avctx, AV_LOG_DEBUG,
+ "SPS decoding failure, trying again with the complete NAL\n");
+ if (h->is_avc)
+ av_assert0(next_avc - buf_index + consumed == nalsize);
+ if ((next_avc - buf_index + consumed - 1) >= INT_MAX/8)
+ break;
+ init_get_bits(&h->gb, &buf[buf_index + 1 - consumed],
+ 8*(next_avc - buf_index + consumed - 1));
+ if (ff_h264_decode_seq_parameter_set(h, 0) >= 0)
+ break;
+ }
+ init_get_bits(&h->gb, ptr, bit_length);
+ ff_h264_decode_seq_parameter_set(h, 1);
+
break;
case NAL_PPS:
init_get_bits(&h->gb, ptr, bit_length);