[totem] Check on buffering-left in the buffering query timeout



commit 3c757b351c7bc518bb7acb3a71c6a5a36521f7f7
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Nov 5 14:35:53 2009 +0000

    Check on buffering-left in the buffering query timeout
    
    Because we won't be receiving buffering messages forever.
    
    Also make sure that we disable the timeout when switching
    from download mode to normal buffering.

 src/backend/bacon-video-widget-gst-0.10.c |   28 +++++++++++++++-------------
 1 files changed, 15 insertions(+), 13 deletions(-)
---
diff --git a/src/backend/bacon-video-widget-gst-0.10.c b/src/backend/bacon-video-widget-gst-0.10.c
index 5ca7947..82e348e 100644
--- a/src/backend/bacon-video-widget-gst-0.10.c
+++ b/src/backend/bacon-video-widget-gst-0.10.c
@@ -1575,9 +1575,6 @@ bvw_reconfigure_tick_timeout (BaconVideoWidget *bvw, guint msecs)
 static void
 bvw_reconfigure_fill_timeout (BaconVideoWidget *bvw, guint msecs)
 {
-  if (bvw->priv->fill_id != 0 && msecs > 0)
-    return;
-
   if (bvw->priv->fill_id != 0) {
     GST_DEBUG ("removing fill timeout");
     g_source_remove (bvw->priv->fill_id);
@@ -1822,13 +1819,10 @@ static void
 bvw_handle_buffering_message (GstMessage * message, BaconVideoWidget *bvw)
 {
   GstBufferingMode mode;
-  gint64 buffering_left;
   gint percent = 0;
 
-   gst_message_parse_buffering_stats (message, &mode, NULL, NULL, &buffering_left);
+   gst_message_parse_buffering_stats (message, &mode, NULL, NULL, NULL);
    if (mode == GST_BUFFERING_DOWNLOAD) {
-     bvw->priv->buffering_left = buffering_left;
-
      if (bvw->priv->download_buffering == FALSE) {
        bvw->priv->download_buffering = TRUE;
 
@@ -1839,15 +1833,15 @@ bvw_handle_buffering_message (GstMessage * message, BaconVideoWidget *bvw)
        bvw_reconfigure_fill_timeout (bvw, 200);
      }
 
-     /* Start playing when we've download enough */
-     if (bvw_buffering_done (bvw) != FALSE &&
-	 bvw->priv->target_state == GST_STATE_PLAYING) {
-       GST_DEBUG ("Starting playback because the download buffer is filled enough");
-       bacon_video_widget_play (bvw, NULL);
-     }
      return;
    }
 
+   /* We switched from download mode to normal buffering */
+   if (bvw->priv->download_buffering != FALSE) {
+     bvw_reconfigure_fill_timeout (bvw, 0);
+     bvw->priv->download_buffering = FALSE;
+   }
+
    /* Live, timeshift and stream buffering modes */
   gst_message_parse_buffering (message, &percent);
   g_signal_emit (bvw, bvw_signals[SIGNAL_BUFFERING], 0, percent);
@@ -2258,6 +2252,7 @@ bvw_query_buffering_timeout (BaconVideoWidget *bvw)
     gboolean busy;
     gint percent;
 
+    gst_query_parse_buffering_stats (query, NULL, NULL, NULL, &bvw->priv->buffering_left);
     gst_query_parse_buffering_percent (query, &busy, &percent);
     gst_query_parse_buffering_range (query, &format, &start, &stop, NULL);
 
@@ -2273,6 +2268,13 @@ bvw_query_buffering_timeout (BaconVideoWidget *bvw)
 
     g_signal_emit (bvw, bvw_signals[SIGNAL_DOWNLOAD_BUFFERING], 0, fill);
 
+     /* Start playing when we've download enough */
+     if (bvw_buffering_done (bvw) != FALSE &&
+	 bvw->priv->target_state == GST_STATE_PLAYING) {
+       GST_DEBUG ("Starting playback because the download buffer is filled enough");
+       bacon_video_widget_play (bvw, NULL);
+     }
+
     /* Finished buffering, so don't run the timeout anymore */
     if (fill == 1.0) {
       bvw->priv->fill_id = 0;



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