[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [phonon-gstreamer/1.0-porting-for-merge] gstreamer: Fix http streaming
From:       Rohan Garg <rohangarg () kubuntu ! org>
Date:       2013-04-12 11:48:53
Message-ID: 20130412114853.73E7AA605E () git ! kde ! org
[Download RAW message or body]

Git commit a33265a3a960f8c1d7dc1021cc990bded8fef095 by Rohan Garg.
Committed on 12/04/2013 at 13:45.
Pushed by garg into branch '1.0-porting-for-merge'.

Fix http streaming

Let GStreamer finish downloading the stream before trying to play it.
This involves pausing the pipeline while gst buffers the stream. Once the
buffering is done, we start playing again.

CCBUG: 308319

M  +12   -1    gstreamer/pipeline.cpp

http://commits.kde.org/phonon-gstreamer/a33265a3a960f8c1d7dc1021cc990bded8fef095

diff --git a/gstreamer/pipeline.cpp b/gstreamer/pipeline.cpp
index 7715692..596175e 100644
--- a/gstreamer/pipeline.cpp
+++ b/gstreamer/pipeline.cpp
@@ -342,10 +342,21 @@ qint64 Pipeline::totalDuration() const
 
 gboolean Pipeline::cb_buffering(GstBus *bus, GstMessage *gstMessage, gpointer data)
 {
+    DEBUG_BLOCK;
     Q_UNUSED(bus)
     Pipeline *that = static_cast<Pipeline*>(data);
     gint percent = 0;
-    gst_structure_get_int (gst_message_get_structure(gstMessage), "buffer-percent", \
&percent); //gst_message_parse_buffering was introduced in 0.10.11 +    \
gst_message_parse_buffering(gstMessage, &percent); +
+    debug() << Q_FUNC_INFO << "Buffering :" << percent;
+
+    // Instead of playing when the pipeline is still streaming, we pause
+    // and let gst finish streaming.
+    if ( percent < 100 && gstMessage->type == GST_MESSAGE_BUFFERING) {
+        that->setState(GST_STATE_PAUSED);
+    } else {
+        that->setState(GST_STATE_PLAYING);
+    }
 
     if (that->m_bufferPercent != percent) {
         emit that->buffering(percent);


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic