1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

make decoder a little bit more tolerant to missing NAL units

Originally committed as revision 4385 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Michael Niedermayer 2005-06-19 23:33:09 +00:00
parent 2fdf9cb2fb
commit 806bb93fe2

View File

@ -3894,8 +3894,10 @@ static int execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count){
switch(mmco[i].opcode){ switch(mmco[i].opcode){
case MMCO_SHORT2UNUSED: case MMCO_SHORT2UNUSED:
pic= remove_short(h, mmco[i].short_frame_num); pic= remove_short(h, mmco[i].short_frame_num);
if(pic==NULL) return -1; if(pic)
unreference_pic(h, pic); unreference_pic(h, pic);
else if(s->avctx->debug&FF_DEBUG_MMCO)
av_log(h->s.avctx, AV_LOG_DEBUG, "mmco: remove_short() failure\n");
break; break;
case MMCO_SHORT2LONG: case MMCO_SHORT2LONG:
pic= remove_long(h, mmco[i].long_index); pic= remove_long(h, mmco[i].long_index);
@ -3907,8 +3909,10 @@ static int execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count){
break; break;
case MMCO_LONG2UNUSED: case MMCO_LONG2UNUSED:
pic= remove_long(h, mmco[i].long_index); pic= remove_long(h, mmco[i].long_index);
if(pic==NULL) return -1; if(pic)
unreference_pic(h, pic); unreference_pic(h, pic);
else if(s->avctx->debug&FF_DEBUG_MMCO)
av_log(h->s.avctx, AV_LOG_DEBUG, "mmco: remove_long() failure\n");
break; break;
case MMCO_LONG: case MMCO_LONG:
pic= remove_long(h, mmco[i].long_index); pic= remove_long(h, mmco[i].long_index);
@ -4297,7 +4301,8 @@ static int decode_slice_header(H264Context *h){
fill_default_ref_list(h); fill_default_ref_list(h);
} }
decode_ref_pic_list_reordering(h); if(decode_ref_pic_list_reordering(h) < 0)
return -1;
if( (h->pps.weighted_pred && (h->slice_type == P_TYPE || h->slice_type == SP_TYPE )) if( (h->pps.weighted_pred && (h->slice_type == P_TYPE || h->slice_type == SP_TYPE ))
|| (h->pps.weighted_bipred_idc==1 && h->slice_type==B_TYPE ) ) || (h->pps.weighted_bipred_idc==1 && h->slice_type==B_TYPE ) )
@ -7166,6 +7171,7 @@ static int decode_nal_units(H264Context *h, uint8_t *buf, int buf_size){
} }
#endif #endif
h->slice_num = 0; h->slice_num = 0;
s->current_picture_ptr= NULL;
for(;;){ for(;;){
int consumed; int consumed;
int dst_length; int dst_length;