Title: [203056] trunk/Source/WebCore
- Revision
- 203056
- Author
- [email protected]
- Date
- 2016-07-11 07:35:54 -0700 (Mon, 11 Jul 2016)
Log Message
[GStreamer][GL] crash within triggerRepaint
https://bugs.webkit.org/show_bug.cgi?id=159552
Reviewed by Xabier Rodriguez-Calvar.
Ensure the sizeChanged notification is emitted from the main
thread. When GStreamer-GL rendering is enabled the appsink draw
callbacks are fired in a non-main thread.
The WeakPtr support was moved to the player base class so that it
can be used there as well as in the MediaPlayerPrivateGStreamer
sub-class.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
(WebCore::MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer): Deleted.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
(WebCore::MediaPlayerPrivateGStreamer::createWeakPtr): Deleted.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
(WebCore::MediaPlayerPrivateGStreamerBase::MediaPlayerPrivateGStreamerBase):
(WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
(WebCore::MediaPlayerPrivateGStreamerBase::createWeakPtr):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (203055 => 203056)
--- trunk/Source/WebCore/ChangeLog 2016-07-11 09:47:33 UTC (rev 203055)
+++ trunk/Source/WebCore/ChangeLog 2016-07-11 14:35:54 UTC (rev 203056)
@@ -1,3 +1,29 @@
+2016-07-11 Philippe Normand <[email protected]>
+
+ [GStreamer][GL] crash within triggerRepaint
+ https://bugs.webkit.org/show_bug.cgi?id=159552
+
+ Reviewed by Xabier Rodriguez-Calvar.
+
+ Ensure the sizeChanged notification is emitted from the main
+ thread. When GStreamer-GL rendering is enabled the appsink draw
+ callbacks are fired in a non-main thread.
+
+ The WeakPtr support was moved to the player base class so that it
+ can be used there as well as in the MediaPlayerPrivateGStreamer
+ sub-class.
+
+ * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
+ (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
+ (WebCore::MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer): Deleted.
+ * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
+ (WebCore::MediaPlayerPrivateGStreamer::createWeakPtr): Deleted.
+ * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
+ (WebCore::MediaPlayerPrivateGStreamerBase::MediaPlayerPrivateGStreamerBase):
+ (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint):
+ * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
+ (WebCore::MediaPlayerPrivateGStreamerBase::createWeakPtr):
+
2016-07-10 Chris Dumez <[email protected]>
Setting document.title reuses <title>'s textnode child
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp (203055 => 203056)
--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp 2016-07-11 09:47:33 UTC (rev 203055)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp 2016-07-11 14:35:54 UTC (rev 203056)
@@ -132,7 +132,6 @@
MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer(MediaPlayer* player)
: MediaPlayerPrivateGStreamerBase(player)
- , m_weakPtrFactory(this)
, m_source(0)
, m_seekTime(0)
, m_changingRate(false)
@@ -1929,8 +1928,10 @@
GRefPtr<GstMessage> protectedMessage(message);
auto weakThis = player.createWeakPtr();
RunLoop::main().dispatch([weakThis, protectedMessage] {
- if (weakThis)
- weakThis->handleMessage(protectedMessage.get());
+ if (weakThis) {
+ auto* player = reinterpret_cast<MediaPlayerPrivateGStreamer*>(weakThis.get());
+ player->handleMessage(protectedMessage.get());
+ }
});
}
gst_message_unref(message);
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h (203055 => 203056)
--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h 2016-07-11 09:47:33 UTC (rev 203055)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h 2016-07-11 14:35:54 UTC (rev 203056)
@@ -34,7 +34,6 @@
#include <gst/pbutils/install-plugins.h>
#include <wtf/Forward.h>
#include <wtf/RunLoop.h>
-#include <wtf/WeakPtr.h>
#if ENABLE(VIDEO_TRACK) && USE(GSTREAMER_MPEGTS)
#include <wtf/text/AtomicStringHash.h>
@@ -131,8 +130,6 @@
static bool isAvailable();
- WeakPtr<MediaPlayerPrivateGStreamer> createWeakPtr() { return m_weakPtrFactory.createWeakPtr(); }
-
GstElement* createAudioSink() override;
float playbackPosition() const;
@@ -194,8 +191,6 @@
static GstFlowReturn newTextSampleCallback(MediaPlayerPrivateGStreamer*);
#endif
- WeakPtrFactory<MediaPlayerPrivateGStreamer> m_weakPtrFactory;
-
GRefPtr<GstElement> m_source;
#if ENABLE(VIDEO_TRACK)
GRefPtr<GstElement> m_textAppSink;
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp (203055 => 203056)
--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp 2016-07-11 09:47:33 UTC (rev 203055)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp 2016-07-11 14:35:54 UTC (rev 203056)
@@ -146,7 +146,8 @@
#endif // USE(COORDINATED_GRAPHICS_THREADED) && USE(GSTREAMER_GL)
MediaPlayerPrivateGStreamerBase::MediaPlayerPrivateGStreamerBase(MediaPlayer* player)
- : m_player(player)
+ : m_weakPtrFactory(this)
+ , m_player(player)
, m_fpsSink(0)
, m_readyState(MediaPlayer::HaveNothing)
, m_networkState(MediaPlayer::Empty)
@@ -550,7 +551,15 @@
if (triggerResize) {
LOG_MEDIA_MESSAGE("First sample reached the sink, triggering video dimensions update");
- m_player->sizeChanged();
+ if (isMainThread())
+ m_player->sizeChanged();
+ else {
+ auto weakThis = createWeakPtr();
+ m_notifier.notify(MainThreadNotification::SizeChanged, [weakThis] {
+ if (weakThis)
+ weakThis->m_player->sizeChanged();
+ });
+ }
}
#if USE(COORDINATED_GRAPHICS_THREADED)
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h (203055 => 203056)
--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h 2016-07-11 09:47:33 UTC (rev 203055)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h 2016-07-11 14:35:54 UTC (rev 203056)
@@ -33,6 +33,7 @@
#include <wtf/Condition.h>
#include <wtf/Forward.h>
#include <wtf/RunLoop.h>
+#include <wtf/WeakPtr.h>
#if USE(TEXTURE_MAPPER)
#include "TextureMapperPlatformLayer.h"
@@ -126,6 +127,10 @@
protected:
MediaPlayerPrivateGStreamerBase(MediaPlayer*);
+
+ WeakPtrFactory<MediaPlayerPrivateGStreamerBase> m_weakPtrFactory;
+ WeakPtr<MediaPlayerPrivateGStreamerBase> createWeakPtr() { return m_weakPtrFactory.createWeakPtr(); }
+
virtual GstElement* createVideoSink();
#if USE(GSTREAMER_GL)
@@ -162,6 +167,7 @@
#if ENABLE(VIDEO_TRACK)
TextChanged = 1 << 5,
#endif
+ SizeChanged = 1 << 6
};
MainThreadNotifier<MainThreadNotification> m_notifier;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes