[rhythmbox] playbin2: always pause the pipeline when buffering



commit 8cd160d02ff761808dca053972b1f38ae36db501
Author: Jonathan Matthew <jonathan d14n org>
Date:   Fri Apr 13 22:44:52 2012 +1000

    playbin2: always pause the pipeline when buffering
    
    It works a lot better if we let the buffer fill up before starting
    to play rather than hoping it'll somehow get there while we're
    playing from it.

 backends/gstreamer/rb-player-gst.c |   13 ++++---------
 1 files changed, 4 insertions(+), 9 deletions(-)
---
diff --git a/backends/gstreamer/rb-player-gst.c b/backends/gstreamer/rb-player-gst.c
index d4f888e..70e3db3 100644
--- a/backends/gstreamer/rb-player-gst.c
+++ b/backends/gstreamer/rb-player-gst.c
@@ -524,8 +524,8 @@ bus_cb (GstBus *bus, GstMessage *message, RBPlayerGst *mp)
 			GstState pending;
 			gst_message_parse_state_changed (message, &oldstate, &newstate, &pending);
 			if (GST_MESSAGE_SRC (message) == GST_OBJECT (mp->priv->playbin)) {
-				rb_debug ("playbin reached state %s", gst_element_state_get_name (newstate));
 				if (pending == GST_STATE_VOID_PENDING) {
+					rb_debug ("playbin reached state %s", gst_element_state_get_name (newstate));
 					state_change_finished (mp, NULL);
 				}
 			}
@@ -554,6 +554,7 @@ bus_cb (GstBus *bus, GstMessage *message, RBPlayerGst *mp)
 			g_warning ("Could not get value from BUFFERING message");
 			break;
 		}
+
 		if (progress >= 100) {
 			mp->priv->buffering = FALSE;
 			if (mp->priv->playing) {
@@ -563,15 +564,9 @@ bus_cb (GstBus *bus, GstMessage *message, RBPlayerGst *mp)
 				rb_debug ("buffering done, leaving pipeline PAUSED");
 			}
 		} else if (mp->priv->buffering == FALSE && mp->priv->playing) {
-			GstState cur_state;
 
-			gst_element_get_state (mp->priv->playbin, &cur_state, NULL, 0);
-			if (cur_state == GST_STATE_PLAYING) {
-				rb_debug ("buffering - temporarily pausing playback");
-				gst_element_set_state (mp->priv->playbin, GST_STATE_PAUSED);
-			} else {
-				rb_debug ("buffering - during preroll; doing nothing");
-			}
+			rb_debug ("buffering - temporarily pausing playback");
+			gst_element_set_state (mp->priv->playbin, GST_STATE_PAUSED);
 			mp->priv->buffering = TRUE;
 		}
 



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