[Pkg-gstreamer-commits] [gstreamer-vaapi] 127/176: vaapiencode: fix possible hang on SIGINT.

Vincent Cheng vcheng at moszumanska.debian.org
Tue Jun 3 08:09:34 UTC 2014


This is an automated email from the git hooks/post-receive script.

vcheng pushed a commit to branch upstream
in repository gstreamer-vaapi.

commit 830566c17e3e2be79a2bbc6caf5b8e53643b3be8
Author: Wind Yuan <feng.yuan at intel.com>
Date:   Tue Dec 17 04:23:42 2013 -0500

    vaapiencode: fix possible hang on SIGINT.
    
    vaapiencode might hang when the pipeline is stopped without any EOS,
    e.g. when <Ctrl>+C is pressed, thus causing the srcpad task to keep
    running and locked. This fixes a possible deadlock on state change
    from PAUSED to READY.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=720584
    
    Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne at intel.com>
---
 gst/vaapi/gstvaapiencode.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/gst/vaapi/gstvaapiencode.c b/gst/vaapi/gstvaapiencode.c
index 2ac023d..9344f97 100644
--- a/gst/vaapi/gstvaapiencode.c
+++ b/gst/vaapi/gstvaapiencode.c
@@ -595,6 +595,22 @@ gst_vaapiencode_finish (GstVideoEncoder * venc)
   return ret;
 }
 
+static GstStateChangeReturn
+gst_vaapiencode_change_state (GstElement * element, GstStateChange transition)
+{
+  GstVaapiEncode *const encode = GST_VAAPIENCODE_CAST (element);
+
+  switch (transition) {
+    case GST_STATE_CHANGE_PAUSED_TO_READY:
+      gst_pad_stop_task (GST_VAAPI_PLUGIN_BASE_SRC_PAD (encode));
+      break;
+    default:
+      break;
+  }
+  return GST_ELEMENT_CLASS (gst_vaapiencode_parent_class)->
+      change_state (element, transition);
+}
+
 #if GST_CHECK_VERSION(1,0,0)
 static gboolean
 gst_vaapiencode_propose_allocation (GstVideoEncoder * venc, GstQuery * query)
@@ -639,6 +655,7 @@ static void
 gst_vaapiencode_class_init (GstVaapiEncodeClass * klass)
 {
   GObjectClass *const object_class = G_OBJECT_CLASS (klass);
+  GstElementClass *const element_class = GST_ELEMENT_CLASS (klass);
   GstVideoEncoderClass *const venc_class = GST_VIDEO_ENCODER_CLASS (klass);
 
   GST_DEBUG_CATEGORY_INIT (gst_vaapiencode_debug,
@@ -648,6 +665,9 @@ gst_vaapiencode_class_init (GstVaapiEncodeClass * klass)
 
   object_class->finalize = gst_vaapiencode_finalize;
 
+  element_class->change_state =
+      GST_DEBUG_FUNCPTR (gst_vaapiencode_change_state);
+
   venc_class->open = GST_DEBUG_FUNCPTR (gst_vaapiencode_open);
   venc_class->close = GST_DEBUG_FUNCPTR (gst_vaapiencode_close);
   venc_class->set_format = GST_DEBUG_FUNCPTR (gst_vaapiencode_set_format);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gstreamer/gstreamer-vaapi.git



More information about the Pkg-gstreamer-commits mailing list