1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00

avcodec/h264: avoid using lost frames as references

Fixes Ticket3386

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2014-02-27 03:21:07 +01:00
parent c4c5351f08
commit b5005def8a
3 changed files with 3 additions and 1 deletions

View File

@ -3788,6 +3788,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
h->prev_frame_num++;
h->prev_frame_num %= 1 << h->sps.log2_max_frame_num;
h->cur_pic_ptr->frame_num = h->prev_frame_num;
h->cur_pic_ptr->invalid_gap = !h->sps.gaps_in_frame_num_allowed_flag;
ff_thread_report_progress(&h->cur_pic_ptr->tf, INT_MAX, 0);
ff_thread_report_progress(&h->cur_pic_ptr->tf, INT_MAX, 1);
ret = ff_generate_sliding_window_mmcos(h, 1);

View File

@ -75,7 +75,7 @@ static int build_def_list(Picture *def, int def_len,
int index = 0;
while (i[0] < len || i[1] < len) {
while (i[0] < len && !(in[i[0]] && (in[i[0]]->reference & sel)))
while (i[0] < len && !(in[i[0]] && (in[i[0]]->reference & sel) && (!in[i[0]]->invalid_gap || sel==3)))
i[0]++;
while (i[1] < len && !(in[i[1]] && (in[i[1]]->reference & (sel ^ 3))))
i[1]++;

View File

@ -204,6 +204,7 @@ typedef struct Picture{
int reference;
int shared;
int recovered; ///< Picture at IDR or recovery point + recovery count
int invalid_gap;
int crop;
int crop_left;