summaryrefslogtreecommitdiff
authorRobert Swain <robert.swain@collabora.co.uk>2010-07-29 07:41:49 (GMT)
committer Robert Swain <robert.swain@collabora.co.uk>2010-07-30 07:59:08 (GMT)
commita441e5b6ef5575a178c27f2c993a893e572a6191 (patch) (side-by-side diff)
tree1835d8a8da010f3db292bbb37a6cabb4b01155d2
parent60d647dcf520e7c8c46acde8344c89bb20a47f8c (diff)
downloadgst-plugins-ugly-a441e5b6ef5575a178c27f2c993a893e572a6191.zip
gst-plugins-ugly-a441e5b6ef5575a178c27f2c993a893e572a6191.tar.gz
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.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--ext/x264/gstx264enc.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/ext/x264/gstx264enc.c b/ext/x264/gstx264enc.c
index dba17a0..131fb71 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))