diff mbox

[FFmpeg-devel] h264_slice: Fix return of incomplete frames from decoder

Message ID 20180627221224.20278-1-jstebbins@jetheaddev.com
State Accepted
Commit 08b1d1d8122517d07f2335437cde0aeedc50143f
Headers show

Commit Message

John Stebbins June 27, 2018, 10:12 p.m. UTC
When not using libavformat for demuxing, AVCodecContext.has_b_frames
gets set too late causing the recovery frame heuristic in h264_refs to
incorrectly flag an early frame as recovered.

This patch sets has_b_frames earlier to prevent improperly flagging the
frame as recovered.
---
 libavcodec/h264_slice.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Michael Niedermayer June 28, 2018, 7:13 p.m. UTC | #1
On Wed, Jun 27, 2018 at 03:12:24PM -0700, John Stebbins wrote:
> When not using libavformat for demuxing, AVCodecContext.has_b_frames
> gets set too late causing the recovery frame heuristic in h264_refs to
> incorrectly flag an early frame as recovered.
> 
> This patch sets has_b_frames earlier to prevent improperly flagging the
> frame as recovered.
> ---
>  libavcodec/h264_slice.c | 5 +++++
>  1 file changed, 5 insertions(+)

will apply

thanks

[...]
diff mbox

Patch

diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index d71ddbe9ba..ede9a1a6ea 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1407,6 +1407,11 @@  static int h264_field_start(H264Context *h, const H264SliceContext *sl,
 
     sps = h->ps.sps;
 
+    if (sps && sps->bitstream_restriction_flag &&
+        h->avctx->has_b_frames < sps->num_reorder_frames) {
+        h->avctx->has_b_frames = sps->num_reorder_frames;
+    }
+
     last_pic_droppable   = h->droppable;
     last_pic_structure   = h->picture_structure;
     h->droppable         = (nal->ref_idc == 0);