History

avcodec/h264dec: Handle non-recovered frames when draining

When starting on a SEI recovery point close enough to the end of the stream that draining starts before the recovery point's frame is output, there can be non-recovered frames in the delayed picture buffer that would currently cause the decoder to fail to output a frame. This commit skips such frames and outputs the first recovered frame, if there exists one.

arch1t3cht committed 2 years ago

Commit 728ffe61 parent 5a856ac1 file · +6 −1Browse files

Showing the changes to libavcodec (1 of 1 file). Show all

Unified · Split

libavcodec/h264dec.c+6−1
@@ -994,11 +994,13 @@ static int send_next_delayed_frame(H264Context *h, AVFrame *dst_frame, · 993 unmodified lines
994994 int *got_frame, int buf_index)
995995 {
996996 int ret, i, out_idx;
997− H264Picture *out = h->delayed_pic[0];
997+ H264Picture *out;
998998
999999 h->cur_pic_ptr = NULL;
10001000 h->first_field = 0;
10011001
1002+ while (h->delayed_pic[0]) {
1003+ out = h->delayed_pic[0];
10021004 out_idx = 0;
10031005 for (i = 1;
10041006 h->delayed_pic[i] &&
@@ -1021,6 +1023,9 @@ static int send_next_delayed_frame(H264Context *h, AVFrame *dst_frame, · 16 unmodified lines
10211023 ret = finalize_frame(h, dst_frame, out, got_frame);
10221024 if (ret < 0)
10231025 return ret;
1026+ if (*got_frame)
1027+ break;
1028+ }
10241029 }
10251030
10261031 return buf_index;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t