Bug 54627 - [GStreamer] URI queries support in webkitwebsrc
Summary: [GStreamer] URI queries support in webkitwebsrc
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on: 54628
Blocks:
  Show dependency treegraph
 
Reported: 2011-02-17 01:59 PST by Andoni
Modified: 2011-02-21 02:15 PST (History)
3 users (show)

See Also:


Attachments
Add support for uri queries (2.19 KB, patch)
2011-02-17 01:59 PST, Andoni
no flags Details | Formatted Diff | Diff
Patch (2.41 KB, patch)
2011-02-17 03:22 PST, Andoni
no flags Details | Formatted Diff | Diff
Patch (2.59 KB, patch)
2011-02-18 08:32 PST, Andoni
mrobinson: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andoni 2011-02-17 01:59:08 PST
Created attachment 82770 [details]
Add support for uri queries

Attached patch that adds support for URI queries.

You can find it in the following branch too.
http://gitorious.org/~ylatuya/webkitgtk/ylatuyas-webkit/commits/hls
Comment 1 Philippe Normand 2011-02-17 02:09:01 PST
Can you please add a ChangeLog and check the code style with Tools/Scripts/check-webkit-style ?
Comment 2 Philippe Normand 2011-02-17 02:09:27 PST
ah also see http://www.webkit.org/coding/contributing.html :)
Comment 3 Andoni 2011-02-17 03:22:33 PST
Created attachment 82777 [details]
Patch
Comment 4 Philippe Normand 2011-02-17 03:40:15 PST
LGTM. Any reviewer to flip the switch? :)
Comment 5 Martin Robinson 2011-02-17 07:36:15 PST
Comment on attachment 82777 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=82777&action=review

Thanks for your contribution! Please consider the following review comments. This patch is only a few changes from an r+.

> WebCore/ChangeLog:10
> +        [GStreamer] URI queries support in webkitwebsrc
> +        https://bugs.webkit.org/show_bug.cgi?id=54627
> +
> +        * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
> +        (webkit_web_src_init):
> +        (webKitWebSrcQuery):

Do you mind explaining a bit what this adds? Those familiar with Gstreamer will understand what sry query support means, but not the majority of the people skimming the ChangeLog.

> WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:120
> +static gboolean webKitWebSrcQuery(GstPad * pad, GstQuery * query);

No spaces before the asterisks here.

> WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:493
> +
> +static gboolean webKitWebSrcQuery(GstPad * pad, GstQuery * query)
> +{
> +    WebKitWebSrc * src = WEBKIT_WEB_SRC(gst_pad_get_parent_element(pad));

Ditto.

> WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:494
> +    gboolean ret;

Normally we don't abbreviate variable names in WebKit, so perhaps something like "success"?
Comment 6 Andoni 2011-02-18 08:32:55 PST
Created attachment 82964 [details]
Patch
Comment 7 Andoni 2011-02-18 08:42:40 PST
Updated patch with your suggestions.

I'm currently trying to add support for http live streaming streams[1] to gstreamer and as part of it I wanted to be able to watch them using webkit with the video tag.
The hls demuxer is using gst_element_from_uri() to fetch fragments and update the playlist so that the webkit source element is used.
It needs to have the 'location' property, this way the uri can be set in the element and it also needs to reply to URI queries so that the demuxer can know the uri of the playlist and use it to update it.

You can see a screenshot[2] of epiphany playing a multibitrate stream in gstreamer's bug reports[3] :) 


[1]http://tools.ietf.org/html/draft-pantos-http-live-streaming-05
[2]http://bugzilla-attachments.gnome.org/attachment.cgi?id=181032
[3]https://bugzilla.gnome.org/show_bug.cgi?id=594035
Comment 8 Martin Robinson 2011-02-18 08:44:36 PST
Comment on attachment 82964 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=82964&action=review

Great stuff. Philippe do you mind landing this with the corrected ChangeLog?

> WebCore/ChangeLog:11
> +        No new tests. (OOPS!)

Just need to replace this with an explanation of why there are no tests.

> WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:511
> +    WebKitWebSrc* src = WEBKIT_WEB_SRC(gst_pad_get_parent_element(pad));
> +    gboolean success;
> +
> +    switch (GST_QUERY_TYPE(query)) {
> +    case GST_QUERY_URI:
> +        gst_query_set_uri(query, src->priv->uri);
> +        success = TRUE;
> +        break;
> +    default:
> +        success = FALSE;
> +        break;
> +    }
> +
> +    if (!success)
> +        success = gst_element_query(GST_ELEMENT(src->priv->appsrc), query);
> +
> +    gst_object_unref(src);
> +    return success;

This looks fine, but adding a GRefPtr specialization for GstObjects would make it even cleaner:

{
    GRefPtr<GstObject*> src = adoptGRef(WEBKIT_WEB_SRC(gst_pad_get_parent_element(pad)));
    if (GST_QUERY_TYPE(query) == GST_QUERY_URI) {
        gst_query_set_uri(query, src->priv->uri)
        return TRUE;
    }
    return gst_element_query(GST_ELEMENT(src->priv->appsrc), query);
}
Comment 9 Philippe Normand 2011-02-21 01:56:23 PST
I just noticed this patch was made against an old version of the module. I added DURATION query support since then, so the patch needs fixup before landing, I'll do that, complete the ChangeLog and land the patch ;)
Comment 10 Philippe Normand 2011-02-21 02:13:31 PST
Committed r79200: <http://trac.webkit.org/changeset/79200>
Comment 11 Philippe Normand 2011-02-21 02:15:02 PST
I think the GRefPtr stuff should be part of another patch, I'll try to prepare that.