[Webkit-unassigned] [Bug 30004] [GStreamer] Should handle BUFFERING messages
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Fri Jan 22 02:43:44 PST 2010
https://bugs.webkit.org/show_bug.cgi?id=30004
--- Comment #18 from Philippe Normand <pnormand at igalia.com> 2010-01-22 02:43:44 PST ---
(In reply to comment #17)
> (From update of attachment 46262 [details])
> Just a few nitpicks on top of gustavo's comments.
>
> >+#include <glib/gstdio.h>
>
> You should not include anything other than the toplevel glib header.
>
Right and in fact Bastien Nocera told me that I should not need to manually
remove the temp file so this include should be removed in the next iteration of
the patch :)
> > #include <gst/gst.h>
> > #include <gst/interfaces/mixer.h>
> > #include <gst/interfaces/xoverlay.h>
> >@@ -48,6 +49,18 @@
> > #include <math.h>
> > #include <wtf/gtk/GOwnPtr.h>
> >
>
> I have been informed that this stuff is not public and that you have to copy it
> like this in order to use it, but a comment saying just that would be good
> IMHO.
>
Yes sorry I will add a comment.
> >+// GstPlayFlags flags from playbin2
> >+typedef enum {
> >+ GST_PLAY_FLAG_VIDEO = 0x01,
> >+ GST_PLAY_FLAG_AUDIO = 0x02,
> >+ GST_PLAY_FLAG_TEXT = 0x04,
> >+ GST_PLAY_FLAG_VIS = 0x08,
> >+ GST_PLAY_FLAG_SOFT_VOLUME = 0x10,
> >+ GST_PLAY_FLAG_NATIVE_AUDIO = 0x20,
> >+ GST_PLAY_FLAG_NATIVE_VIDEO = 0x40,
> >+ GST_PLAY_FLAG_DOWNLOAD = 0x80
> >+} GstPlayFlags;
> >+
>
>
>
> >+void MediaPlayerPrivate::processBufferingStats(GstMessage* message)
> >+{
> >+ GstBufferingMode mode;
> >+
> >+ gst_message_parse_buffering_stats(message, &mode, 0, 0, 0);
> >+ if (mode != GST_BUFFERING_DOWNLOAD)
> >+ return;
> >+
> >+ if (!m_startedBuffering) {
> >+ m_startedBuffering = true;
> >+
> >+ if (m_fillTimeoutId > 0) {
> >+ g_source_remove(m_fillTimeoutId);
> >+ m_fillTimeoutId = 0;
>
> I guess there's really no need to set the id to anything if you are going to
> write over it in the next line.
>
I guess yes :)
> >+ }
> >+
> >+ m_fillTimeoutId = g_timeout_add(200, (GSourceFunc) bufferingTimeoutCallback, this);
> >+ }
> >+}
> >+
> >+bool MediaPlayerPrivate::queryBufferingStats()
> >+{
> >+ GstQuery* query = gst_query_new_buffering(GST_FORMAT_PERCENT);
> >+
> >+ if (gst_element_query(m_playBin, query)) {
> >+ gint64 start, stop;
> >+ gdouble fillStatus;
> >+
> >+ gst_query_parse_buffering_range(query, 0, &start, &stop, 0);
> >+
> >+ if (stop != -1)
> >+ fillStatus = 100.0 * stop / GST_FORMAT_PERCENT_MAX;
> >+ else
> >+ fillStatus = 100.0;
> >+
> >+ LOG_VERBOSE(Media, "Download buffer filled up to %f%%", fillStatus);
> >+
> >+ // Update maxTimeLoaded only if the media duration is
> >+ // available. Otherwise we can't compute it.
> >+ if (!m_mediaDuration) {
> >+ float newDuration = duration();
> >+ if (!isinf(newDuration)) {
> >+ m_mediaDuration = newDuration;
> >+ durationChanged();
> >+ }
> >+ }
> >+
> >+ if (m_mediaDuration) {
> >+ m_maxTimeLoaded = static_cast<float>((fillStatus * m_mediaDuration) / 100.0);
> >+ LOG_VERBOSE(Media, "Updated maxTimeLoaded: %f", m_maxTimeLoaded);
> >+ }
> >+
> >+ if (fillStatus == 100.0) {
> >+ // Buffering is done, remove the fill source from the main loop.
> >+ m_fillTimeoutId = 0;
>
> Unless I'm missing something you are not actually removing any source here.
>
>
if this callback returns FALSE (see few lines above) the source will be removed
from the main loop.
> >+ gst_query_unref(query);
> >+
> >+ // Media is now fully loaded. It will play even if network
> >+ // connection is cut.
> >+ m_networkState = MediaPlayer::Loaded;
> >+ m_player->networkStateChanged();
> >+
> >+ return FALSE;
> >+ }
> >+
> >+ if ((fillStatus > 0) && (m_readyState < MediaPlayer::HaveFutureData)) {
> >+ // Buffering started, we should now have enough data to
> >+ // start playback if it was requested.
> >+ m_readyState = MediaPlayer::HaveFutureData;
> >+ m_player->readyStateChanged();
> >+ if (m_paused && m_playRequired) {
> >+ m_playRequired = false;
> >+ gst_element_set_state(m_playBin, GST_STATE_PLAYING);
> >+ }
> >+ }
> >+ }
> >+
> >+ gst_query_unref(query);
> >+ return TRUE;
> >+}
> >+
--
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the webkit-unassigned
mailing list