avvidenc: Fix frame memory leak
authorVineeth TM <vineeth.tm@samsung.com>
Mon, 2 Nov 2015 01:00:55 +0000 (10:00 +0900)
committerSebastian Dröge <sebastian@centricular.com>
Mon, 2 Nov 2015 07:25:34 +0000 (09:25 +0200)
The frame being passed to handle_frame should be unref'ed in all cases

https://bugzilla.gnome.org/show_bug.cgi?id=757453

ext/libav/gstavvidenc.c

index fde18a2..e161732 100644 (file)
@@ -626,6 +626,7 @@ gst_ffmpegvidenc_handle_frame (GstVideoEncoder * encoder,
     GST_ERROR_OBJECT (encoder, "Failed to map input buffer");
     gst_buffer_unref (buffer_info->buffer);
     g_slice_free (BufferInfo, buffer_info);
+    gst_video_codec_frame_unref (frame);
     return GST_FLOW_ERROR;
   }
 
@@ -665,7 +666,10 @@ gst_ffmpegvidenc_handle_frame (GstVideoEncoder * encoder,
 
   /* Encoder needs more data */
   if (!have_data)
+  {
+    gst_video_codec_frame_unref (frame);
     return GST_FLOW_OK;
+  }
 
   /* save stats info if there is some as well as a stats file */
   if (ffmpegenc->file && ffmpegenc->context->stats_out)