[webkit-reviews] review denied: [Bug 195948] [GStreamer] Switch back to webkitwebsrc for adaptive streaming fragments downloading : [Attachment 365172] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Mar 20 02:59:15 PDT 2019

Xabier Rodríguez Calvar <calvaris at igalia.com> has denied Philippe Normand
<pnormand at igalia.com>'s request for review:
Bug 195948: [GStreamer] Switch back to webkitwebsrc for adaptive streaming
fragments downloading

Attachment 365172: Patch


--- Comment #2 from Xabier Rodríguez Calvar <calvaris at igalia.com> ---
Comment on attachment 365172
  --> https://bugs.webkit.org/attachment.cgi?id=365172

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

It is not necessarily wrong but I think we should handle the context in a
different and probably more efficient way.

> +	       const char* uri = gst_structure_get_string(structure, "uri");
> +	       const char* redirectionUri = gst_structure_get_string(structure,
> +	       uri = redirectionUri ? redirectionUri : uri;

You can do:

const char* redirectionUri = gst_structure_get_string(structure,
uri = redirectionUri ? redirectionUri : gst_structure_get_string(structure,

and you might be saving one call.

> +		   auto origin = SecurityOrigin::create(url);
> +		   m_origins.add(WTFMove(origin));


> +    if (!g_strcmp0(contextType, WEBKIT_WEB_SRC_PLAYER_CONTEXT_TYPE_NAME)) {
> +	   GRefPtr<GstContext> context =
> +	   GstStructure* contextStructure =
> +
> +	   ASSERT(m_player);
> +	   gst_structure_set(contextStructure, "player", G_TYPE_POINTER,
m_player, nullptr);
> +	   gst_element_set_context(GST_ELEMENT(GST_MESSAGE_SRC(message)),
> +	   return true;
> +    }

This code is ok but unnecessary here.

GstContext is meant to the set on pipelines so that it is the pipeline that
dispatches the context to the elements when they are created and added to it.

The pipeline cannot exist without the player private,  the private creates the
pipeline and the player is (or should be) set to the private prior to that. So
when the pipeline is created, we can set the context to it immediately (fire
and forget!). Once the elements are created and added to it, the context should
be immediately available.

Summing up, IMHO you should neither listen to this message nor send it (read my
comment below) and just set the context to the pipeline when the pipeline is

> Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:165
>      gst_element_class_add_static_pad_template(eklass, &srcTemplate);
> +    gst_element_class_add_static_pad_template(eklass, &srcTemplate);

Am I seeing double here?

> Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:498
> +    if (!priv->player) {
> +	   GRefPtr<GstQuery> query =
> +	   if (gst_pad_peer_query(GST_BASE_SRC_PAD(baseSrc), query.get())) {
> +	       GstContext* context;
> +
> +	       gst_query_parse_context(query.get(), &context);
> +	       gst_element_set_context(GST_ELEMENT_CAST(src), context);
> +	   } else
> +	       gst_element_post_message(GST_ELEMENT_CAST(src),
> +    }

I doubt this is ever run. You could keep it but I'd suggest replacing it with a
[RELEASE_]ASSERT(priv->player) because this is dead code.

My rationale behind  this is that GStreamer doc does indeed suggest querying
for context if you don't have it. Here the context should be available just
after the element is created and added to the pipeline, if the context was
already set to the pipeline (see my comment above).

You can add a comment to explain this.

> Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:768
> -    static const char* protocols[] = {"webkit+http", "webkit+https",
"webkit+blob", nullptr };
> +    static const char* protocols[] = {"http", "https", "blob", nullptr };

Really nice to know that we are not leaking these element anymore cause this
leaves in the web process :D

> Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:886
> +    long long length = response.expectedContentLength();


> Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:920
> +    auto scopeExit = makeScopeExit([&] {
> +	   GstStructure* structure =
> +	   gst_element_post_message(GST_ELEMENT_CAST(src),
gst_message_new_element(GST_OBJECT_CAST(src), structure));
> +    });

Are you ok with this running at the end of the function, AFTER the completion

More information about the webkit-reviews mailing list