[totem] Set playbin2's bus to flushing when shutting down until we start playback again



commit fda6b27a40f4e130b48cd2c7ab8f9bed7b8009f3
Author: Sebastian Dröge <sebastian droege collabora co uk>
Date:   Thu Feb 25 17:45:40 2010 +0100

    Set playbin2's bus to flushing when shutting down until we start playback again
    
    This makes sure that we never get any pending messages after we
    stopped playback. Without this change, error messages after a
    missing plugin message could still appear although the codec
    installer was started and playbin2 was stopped already.

 src/backend/bacon-video-widget-gst-0.10.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/src/backend/bacon-video-widget-gst-0.10.c b/src/backend/bacon-video-widget-gst-0.10.c
index 9b9f703..be58447 100644
--- a/src/backend/bacon-video-widget-gst-0.10.c
+++ b/src/backend/bacon-video-widget-gst-0.10.c
@@ -3947,11 +3947,12 @@ static void
 bvw_stop_play_pipeline (BaconVideoWidget * bvw)
 {
   GstState cur_state;
+  GstBus *bus;
 
+  bus = gst_element_get_bus (bvw->priv->play);
   gst_element_get_state (bvw->priv->play, &cur_state, NULL, 0);
   if (cur_state > GST_STATE_READY) {
     GstMessage *msg;
-    GstBus *bus;
 
     GST_DEBUG ("stopping");
     gst_element_set_state (bvw->priv->play, GST_STATE_READY);
@@ -3959,14 +3960,16 @@ bvw_stop_play_pipeline (BaconVideoWidget * bvw)
     /* process all remaining state-change messages so everything gets
      * cleaned up properly (before the state change to NULL flushes them) */
     GST_DEBUG ("processing pending state-change messages");
-    bus = gst_element_get_bus (bvw->priv->play);
     while ((msg = gst_bus_poll (bus, GST_MESSAGE_STATE_CHANGED, 0))) {
       gst_bus_async_signal_func (bus, msg, NULL);
       gst_message_unref (msg);
     }
-    gst_object_unref (bus);
   }
 
+  /* and now drop all following messages until we start again */
+  gst_bus_set_flushing (bus, TRUE);
+  gst_object_unref (bus);
+
   /* Now in READY or lower */
   if (bvw->priv->ready_idle_id) {
     g_source_remove (bvw->priv->ready_idle_id);



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