[longomatch] encoder: disconnect the signals sooner



commit c359c847a64ae5e3d48390f32a63e4d8350662db
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Fri Jan 31 03:01:56 2014 +0100

    encoder: disconnect the signals sooner

 libcesarplayer/gst-video-encoder.c |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)
---
diff --git a/libcesarplayer/gst-video-encoder.c b/libcesarplayer/gst-video-encoder.c
index 17268aa..0d37d77 100644
--- a/libcesarplayer/gst-video-encoder.c
+++ b/libcesarplayer/gst-video-encoder.c
@@ -117,6 +117,11 @@ gst_video_encoder_finalize (GObject * object)
 {
   GstVideoEncoder *gve = (GstVideoEncoder *) object;
 
+  if (gve->priv->update_id != 0) {
+    g_source_remove (gve->priv->update_id);
+    gve->priv->update_id = 0;
+  }
+
   GST_DEBUG_OBJECT (gve, "Finalizing.");
   if (gve->priv->bus) {
     /* make bus drop all messages to make sure none of our callbacks is ever
@@ -148,11 +153,6 @@ gst_video_encoder_finalize (GObject * object)
     gve->priv->main_pipeline = NULL;
   }
 
-  if (gve->priv->update_id != 0) {
-    g_source_remove (gve->priv->update_id);
-    gve->priv->update_id = 0;
-  }
-
   G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
@@ -434,8 +434,10 @@ gst_video_encoder_select_next_file (GstVideoEncoder *gve)
     gst_video_encoder_create_source (gve, (gchar *) gve->priv->current_file->data);
   } else {
     GST_INFO_OBJECT (gve, "No more files, sending EOS");
-    g_source_remove (gve->priv->update_id);
-    gve->priv->update_id = 0;
+    if (gve->priv->update_id != 0) {
+      g_source_remove (gve->priv->update_id);
+      gve->priv->update_id = 0;
+    }
     /* Enlarge queues to avoid deadlocks */
     g_object_set (gve->priv->aqueue, "max-size-time", 0,
         "max-size-bytes", 0, "max-size-buffers", 0, NULL);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]