comparison h264.c @ 6019:42de24a34fd2 libavcodec

Fix brain-dead parts of r11216, specifically: Actually unreference removed pics And check for too many reference frames as originally intended, not equal to max reference frames.
author heydowns
date Fri, 14 Dec 2007 22:49:30 +0000
parents 9d1654835629
children c531defb03ee
comparison
equal deleted inserted replaced
6018:9d1654835629 6019:42de24a34fd2
3610 h->short_ref[0]->long_ref=0; 3610 h->short_ref[0]->long_ref=0;
3611 h->short_ref_count++; 3611 h->short_ref_count++;
3612 s->current_picture_ptr->reference |= s->picture_structure; 3612 s->current_picture_ptr->reference |= s->picture_structure;
3613 } 3613 }
3614 3614
3615 if (h->sps.ref_frame_count && 3615 if (h->long_ref_count + h->short_ref_count > h->sps.ref_frame_count){
3616 h->long_ref_count + h->short_ref_count == h->sps.ref_frame_count){
3617 3616
3618 /* We have too many reference frames, probably due to corrupted 3617 /* We have too many reference frames, probably due to corrupted
3619 * stream. Need to discard one frame. Prevents overrun of the 3618 * stream. Need to discard one frame. Prevents overrun of the
3620 * short_ref and long_ref buffers. 3619 * short_ref and long_ref buffers.
3621 */ 3620 */
3627 for (i = 0; i < 16; ++i) 3626 for (i = 0; i < 16; ++i)
3628 if (h->long_ref[i]) 3627 if (h->long_ref[i])
3629 break; 3628 break;
3630 3629
3631 assert(i < 16); 3630 assert(i < 16);
3631 pic = h->long_ref[i];
3632 remove_long_at_index(h, i); 3632 remove_long_at_index(h, i);
3633 } else { 3633 } else {
3634 pic = h->short_ref[h->short_ref_count - 1];
3634 remove_short_at_index(h, h->short_ref_count - 1); 3635 remove_short_at_index(h, h->short_ref_count - 1);
3635 } 3636 }
3637 unreference_pic(h, pic, 0);
3636 } 3638 }
3637 3639
3638 print_short_term(h); 3640 print_short_term(h);
3639 print_long_term(h); 3641 print_long_term(h);
3640 return 0; 3642 return 0;