[GStreamer] Use GstBus sync message handler and schedule tasks to the main thread...
authorcarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Nov 2015 10:43:52 +0000 (10:43 +0000)
committercarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Nov 2015 10:43:52 +0000 (10:43 +0000)
commit679f727e8711bfe19b3aecf66835e54064343c9a
treed5416ee2aa194ac134a885d953e30cd45e25b4e0
parentd52ca727c784f4e0cc8d24df62da70849d3d7d95
[GStreamer] Use GstBus sync message handler and schedule tasks to the main thread with RunLoop::dispatch
https://bugs.webkit.org/show_bug.cgi?id=150800

Reviewed by Philippe Normand.

This way we would avoid all the GScource + polling mechanism that
GST uses internally to handle messages asynchronously in the main thread.

* platform/graphics/gstreamer/GRefPtrGStreamer.cpp:
(WTF::adoptGRef):
(WTF::refGPtr<GstMessage>):
(WTF::derefGPtr<GstMessage>):
* platform/graphics/gstreamer/GRefPtrGStreamer.h:
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer):
Initialize the WeakPtr factory.
(WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer):
reset the GstBus sync handler.
(WebCore::MediaPlayerPrivateGStreamer::handleMessage): Make it void.
(WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin): Add a
GstBus sync message handler and schedule the messages to the main
thread with RunLoop::main().dispatch().
(WebCore::mediaPlayerPrivateMessageCallback): Deleted.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
(WebCore::MediaPlayerPrivateGStreamer::createWeakPtr): Create a WeakPtr.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
(WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage):
Handle the need context message that needs to be handled in the
caller thread.
(WebCore::mediaPlayerPrivateNeedContextMessageCallback): Deleted.
(WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
(WebCore::MediaPlayerPrivateGStreamerBase::setPipeline): Do not
connect to sync-message signal, handleSyncMessage() will be called
to handled messages synchronously.
(WebCore::MediaPlayerPrivateGStreamerBase::handleNeedContextMessage): Deleted.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191948 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.cpp
Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.h
Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h
Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp
Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h