diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 75c5c120e126..0b24c0d71491 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,20 @@ +2018-01-15 Sebastian Dröge + + [GStreamer] Don't wait for draw condition variable when shutting down. + https://bugs.webkit.org/show_bug.cgi?id=180978 + + Reviewed by Carlos Garcia Campos. + + * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: + (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint): + (WebCore::MediaPlayerPrivateGStreamerBase::cancelRepaint): + * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h: + By also waiting for the draw condition variable while shutting down, + it is possible that the GStreamer video sink is waiting for the main + thread to actually render the current frame, while at the same time + the main thread is waiting for the GStreamer video sink to shut down, + resulting in a deadlock. + 2017-10-06 Enrique Ocaña González [MSE][GStreamer] Seek on youtube.com/tv fails after r217185 diff --git a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp b/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp index 8a398d1a0b91..9eafd25a3bad 100644 --- a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp +++ b/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp @@ -661,6 +661,8 @@ void MediaPlayerPrivateGStreamerBase::triggerRepaint(GstSample* sample) if (!m_renderingCanBeAccelerated) { LockHolder locker(m_drawMutex); + if (m_drawCancelled) + return; m_drawTimer.startOneShot(0_s); m_drawCondition.wait(m_drawMutex); return; @@ -672,6 +674,8 @@ void MediaPlayerPrivateGStreamerBase::triggerRepaint(GstSample* sample) #else { LockHolder lock(m_drawMutex); + if (m_drawCancelled) + return; if (!m_platformLayerProxy->scheduleUpdateOnCompositorThread([this] { this->pushTextureToCompositor(); })) return; m_drawCondition.wait(m_drawMutex); @@ -687,11 +691,14 @@ void MediaPlayerPrivateGStreamerBase::repaintCallback(MediaPlayerPrivateGStreame void MediaPlayerPrivateGStreamerBase::cancelRepaint() { + LockHolder locker(m_drawMutex); + if (!m_renderingCanBeAccelerated) { m_drawTimer.stop(); - LockHolder locker(m_drawMutex); - m_drawCondition.notifyOne(); } + + m_drawCancelled = true; + m_drawCondition.notifyOne(); } void MediaPlayerPrivateGStreamerBase::repaintCancelledCallback(MediaPlayerPrivateGStreamerBase* player) diff --git a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h b/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h index a780dee99038..80df2c4ce037 100644 --- a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h +++ b/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h @@ -205,6 +205,7 @@ class MediaPlayerPrivateGStreamerBase : public MediaPlayerPrivateInterface Condition m_drawCondition; Lock m_drawMutex; + bool m_drawCancelled { false }; RunLoop::Timer m_drawTimer; #if USE(TEXTURE_MAPPER_GL)