diff options
Diffstat (limited to 'libavcodec/h264.c')
-rw-r--r-- | libavcodec/h264.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 5be216a71b..44bacffb90 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -1014,7 +1014,7 @@ int ff_h264_decode_extradata(H264Context *h) { AVCodecContext *avctx = h->s.avctx; - if(*(char *)avctx->extradata == 1){ + if(avctx->extradata[0] == 1){ int i, cnt, nalsize; unsigned char *p = avctx->extradata; @@ -1049,7 +1049,7 @@ int ff_h264_decode_extradata(H264Context *h) p += nalsize; } // Now store right nal length size, that will be use to parse all other nals - h->nal_length_size = ((*(((char*)(avctx->extradata))+4))&0x03)+1; + h->nal_length_size = (avctx->extradata[4] & 0x03) + 1; } else { h->is_avc = 0; if(decode_nal_units(h, avctx->extradata, avctx->extradata_size) < 0) @@ -2984,7 +2984,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0){ h0->last_slice_type = slice_type; h->slice_num = ++h0->current_slice; if(h->slice_num >= MAX_SLICES){ - av_log(s->avctx, AV_LOG_ERROR, "Too many slices, increase MAX_SLICES and recompile\n"); + av_log(s->avctx, AV_LOG_ERROR, "Too many slices (%d >= %d), increase MAX_SLICES and recompile\n", h->slice_num, MAX_SLICES); } for(j=0; j<2; j++){ @@ -3690,6 +3690,8 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){ switch (hx->nal_unit_type) { case NAL_SPS: case NAL_PPS: + case NAL_IDR_SLICE: + case NAL_SLICE: nals_needed = nal_index; } continue; @@ -3794,8 +3796,8 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){ init_get_bits(&s->gb, ptr, bit_length); ff_h264_decode_seq_parameter_set(h); - if(s->flags& CODEC_FLAG_LOW_DELAY || - (h->sps.bitstream_restriction_flag && !h->sps.num_reorder_frames)) + if (s->flags& CODEC_FLAG_LOW_DELAY || + (h->sps.bitstream_restriction_flag && !h->sps.num_reorder_frames)) s->low_delay=1; if(avctx->has_b_frames < 2) |