comparison h264.c @ 5643:bf02fa211648 libavcodec

Avoid a crash when H264 MMC operation causes the short term reference list to be emptied. Patch by Jeff Downs: [heydowns borg com]
author benoit
date Wed, 05 Sep 2007 20:04:09 +0000
parents d2598034f2a9
children adc9ec0f7385
comparison
equal deleted inserted replaced
5642:d2598034f2a9 5643:bf02fa211648
3157 Picture *pic= h->short_ref[i]; 3157 Picture *pic= h->short_ref[i];
3158 if(s->avctx->debug&FF_DEBUG_MMCO) 3158 if(s->avctx->debug&FF_DEBUG_MMCO)
3159 av_log(h->s.avctx, AV_LOG_DEBUG, "%d %d %p\n", i, pic->frame_num, pic); 3159 av_log(h->s.avctx, AV_LOG_DEBUG, "%d %d %p\n", i, pic->frame_num, pic);
3160 if(pic->frame_num == frame_num){ 3160 if(pic->frame_num == frame_num){
3161 h->short_ref[i]= NULL; 3161 h->short_ref[i]= NULL;
3162 memmove(&h->short_ref[i], &h->short_ref[i+1], (h->short_ref_count - i - 1)*sizeof(Picture*)); 3162 if (--h->short_ref_count)
3163 h->short_ref_count--; 3163 memmove(&h->short_ref[i], &h->short_ref[i+1], (h->short_ref_count - i)*sizeof(Picture*));
3164 return pic; 3164 return pic;
3165 } 3165 }
3166 } 3166 }
3167 return NULL; 3167 return NULL;
3168 } 3168 }