summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2009-11-05 14:35:53 +0000
committerBastien Nocera <hadess@hadess.net>2009-11-05 15:02:17 +0000
commit3c757b351c7bc518bb7acb3a71c6a5a36521f7f7 (patch)
treeae60a34dca179b8175563605c63392d9051a0943 /src
parentf03c5713b591358056e9798042fadcede8c75203 (diff)
downloadtotem-3c757b351c7bc518bb7acb3a71c6a5a36521f7f7.tar.gz
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.
Diffstat (limited to 'src')
-rw-r--r--src/backend/bacon-video-widget-gst-0.10.c28
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 5ca794747..82e348e63 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;