vaapiencode: release internal encoder at stop()
authorHyunjun Ko <zzoon@igalia.com>
Tue, 29 Nov 2016 06:14:32 +0000 (15:14 +0900)
committerVíctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
Mon, 5 Dec 2016 16:23:56 +0000 (17:23 +0100)
As the internal encoder is created at start(), let's release it at
stop() vmethod, to be consistent.

gst_vaapiencode_destroy() is called since it also resets the input and
output states, which is something that the base class does internally
after calling stop() vmethod.

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

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
gst/vaapi/gstvaapiencode.c

index a68384a..8d76b3c 100644 (file)
@@ -445,12 +445,15 @@ gst_vaapiencode_start (GstVideoEncoder * venc)
 }
 
 static gboolean
-gst_vaapiencode_close (GstVideoEncoder * venc)
+gst_vaapiencode_stop (GstVideoEncoder * venc)
 {
-  GstVaapiEncode *const encode = GST_VAAPIENCODE_CAST (venc);
+  return gst_vaapiencode_destroy (GST_VAAPIENCODE_CAST (venc));
+}
 
-  gst_vaapiencode_destroy (encode);
-  gst_vaapi_plugin_base_close (GST_VAAPI_PLUGIN_BASE (encode));
+static gboolean
+gst_vaapiencode_close (GstVideoEncoder * venc)
+{
+  gst_vaapi_plugin_base_close (GST_VAAPI_PLUGIN_BASE (venc));
   return TRUE;
 }
 
@@ -718,6 +721,7 @@ gst_vaapiencode_class_init (GstVaapiEncodeClass * klass)
   venc_class->open = GST_DEBUG_FUNCPTR (gst_vaapiencode_open);
   venc_class->close = GST_DEBUG_FUNCPTR (gst_vaapiencode_close);
   venc_class->start = GST_DEBUG_FUNCPTR (gst_vaapiencode_start);
+  venc_class->stop = GST_DEBUG_FUNCPTR (gst_vaapiencode_stop);
   venc_class->set_format = GST_DEBUG_FUNCPTR (gst_vaapiencode_set_format);
   venc_class->handle_frame = GST_DEBUG_FUNCPTR (gst_vaapiencode_handle_frame);
   venc_class->finish = GST_DEBUG_FUNCPTR (gst_vaapiencode_finish);