From a441e5b6ef5575a178c27f2c993a893e572a6191 Mon Sep 17 00:00:00 2001 From: Robert Swain Date: Thu, 29 Jul 2010 09:41:49 +0200 Subject: [PATCH] x264enc: Fix flushing of delayed frames x264_encoder_encode() should be called with a NULL picture until at least x264_encoder_delayed_frames() returns 0. This fixes what appeared to be a regression in make check due to the recent change in defaults which enabled b-frames and b-pyramid, both of which I believe increase the number of delayed frames when encoding. --- ext/x264/gstx264enc.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ext/x264/gstx264enc.c b/ext/x264/gstx264enc.c index dba17a0d85..131fb710d5 100644 --- a/ext/x264/gstx264enc.c +++ b/ext/x264/gstx264enc.c @@ -75,6 +75,10 @@ #include "gstx264enc.h" +#if X264_BUILD >= 71 +#define X264_DELAYED_FRAMES_API +#endif + #if X264_BUILD >= 76 #define X264_ENC_NALS 1 #endif @@ -1628,7 +1632,13 @@ gst_x264_enc_flush_frames (GstX264Enc * encoder, gboolean send) if (encoder->x264enc) do { flow_ret = gst_x264_enc_encode_frame (encoder, NULL, &i_nal, send); +#ifdef X264_DELAYED_FRAMES_API + } while (flow_ret == GST_FLOW_OK + && x264_encoder_delayed_frames (encoder->x264enc) > 0); +#else + /* note that this doesn't flush all frames for > 1 delayed frame */ } while (flow_ret == GST_FLOW_OK && i_nal > 0); +#endif /* in any case, make sure the delay queue is emptied */ while (!g_queue_is_empty (encoder->delay))