Bug 150800 - [GStreamer] Use GstBus sync message handler and schedule tasks to the main thread with RunLoop::dispatch
Summary: [GStreamer] Use GstBus sync message handler and schedule tasks to the main th...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: Gtk
Depends on: 152797
Blocks:
  Show dependency treegraph
 
Reported: 2015-11-02 06:32 PST by Carlos Garcia Campos
Modified: 2016-01-06 12:24 PST (History)
2 users (show)

See Also:


Attachments
Patch (13.98 KB, patch)
2015-11-02 06:41 PST, Carlos Garcia Campos
no flags Details | Formatted Diff | Diff
Updated patch (14.12 KB, patch)
2015-11-02 08:38 PST, Carlos Garcia Campos
pnormand: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Carlos Garcia Campos 2015-11-02 06:32:06 PST
This way we would avoid all the GScource + polling mechanism that GST uses internally to handle messages asynchronously in the main thread.
Comment 1 Carlos Garcia Campos 2015-11-02 06:41:27 PST
Created attachment 264584 [details]
Patch
Comment 2 Carlos Garcia Campos 2015-11-02 08:38:02 PST
Created attachment 264591 [details]
Updated patch

I was assuming that sync message handler was always called from a secondary thread, but the main thread can also call gst_bus_post, so I've added a check to not schedule the message to the main thread if we are already in the main thread.
Comment 3 Zan Dobersek 2015-11-03 00:06:29 PST
Comment on attachment 264591 [details]
Updated patch

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

Looks good, I'll leave it to Phil to approve it.

> Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:1949
> +                    if (!weakThis)
> +                        return;
> +                    weakThis->handleMessage(protectMessage.get());

Nit: could be a two-liner.

> if (weakThis)
>     weakThis->handleMessage(protectMessage.get());
Comment 4 Carlos Garcia Campos 2015-11-03 02:44:52 PST
Committed r191948: <http://trac.webkit.org/changeset/191948>