x264enc: Port to new way of passing frame reference
authorNicolas Dufresne <nicolas.dufresne@collabora.co.uk>
Tue, 1 May 2012 18:45:33 +0000 (18:45 +0000)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Mon, 18 Jun 2012 15:01:20 +0000 (16:01 +0100)
ext/x264/gstx264enc.c

index 48e0fee97a63763afb8e851afc37811208a5563d..e2f448af06591b2e1bec38346c09924f74abc501 100644 (file)
@@ -1662,8 +1662,11 @@ gst_x264_enc_encode_frame (GstX264Enc * encoder, x264_picture_t * pic_in,
   guint8 *data;
   GstPad *srcpad;
 
-  if (G_UNLIKELY (encoder->x264enc == NULL))
+  if (G_UNLIKELY (encoder->x264enc == NULL)) {
+    if (input_frame)
+      gst_video_codec_frame_unref (input_frame);
     return GST_FLOW_NOT_NEGOTIATED;
+  }
 
   GST_OBJECT_LOCK (encoder);
   if (encoder->reconfig) {
@@ -1696,8 +1699,9 @@ gst_x264_enc_encode_frame (GstX264Enc * encoder, x264_picture_t * pic_in,
     goto out;
   }
 
-  /* This frame is now queued */
-  frame = NULL;
+  /* Input frame is now queued */
+  if (input_frame)
+    gst_video_codec_frame_unref (input_frame);
 
   if (!*i_nal) {
     ret = GST_FLOW_OK;
@@ -1731,10 +1735,8 @@ gst_x264_enc_encode_frame (GstX264Enc * encoder, x264_picture_t * pic_in,
   }
 
 out:
-  if (frame) {
+  if (frame)
     gst_video_encoder_finish_frame (GST_VIDEO_ENCODER (encoder), frame);
-    gst_video_codec_frame_unref (frame);
-  }
 
   return ret;
 }