Title: [226947] trunk/Source/WebCore
Revision
226947
Author
[email protected]
Date
2018-01-15 02:50:44 -0800 (Mon, 15 Jan 2018)

Log Message

[GStreamer] Don't wait for draw condition variable when shutting down.
https://bugs.webkit.org/show_bug.cgi?id=180978

Patch by Sebastian Dröge <[email protected]> on 2018-01-15
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.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (226946 => 226947)


--- trunk/Source/WebCore/ChangeLog	2018-01-15 09:36:36 UTC (rev 226946)
+++ trunk/Source/WebCore/ChangeLog	2018-01-15 10:50:44 UTC (rev 226947)
@@ -1,3 +1,20 @@
+2018-01-15  Sebastian Dröge  <[email protected]>
+
+        [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.
+
 2018-01-13  Minsheng Liu  <[email protected]>
 
         MathML Lengths should take zoom level into account

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp (226946 => 226947)


--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp	2018-01-15 09:36:36 UTC (rev 226946)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp	2018-01-15 10:50:44 UTC (rev 226947)
@@ -772,6 +772,8 @@
 
     if (!m_renderingCanBeAccelerated) {
         LockHolder locker(m_drawMutex);
+        if (m_drawCancelled)
+            return;
         m_drawTimer.startOneShot(0_s);
         m_drawCondition.wait(m_drawMutex);
         return;
@@ -783,6 +785,8 @@
 #else
     {
         LockHolder lock(m_drawMutex);
+        if (m_drawCancelled)
+            return;
         if (!m_platformLayerProxy->scheduleUpdateOnCompositorThread([this] { this->pushTextureToCompositor(); }))
             return;
         m_drawCondition.wait(m_drawMutex);
@@ -798,11 +802,14 @@
 
 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)

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h (226946 => 226947)


--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h	2018-01-15 09:36:36 UTC (rev 226946)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h	2018-01-15 10:50:44 UTC (rev 226947)
@@ -231,6 +231,7 @@
 
     Condition m_drawCondition;
     Lock m_drawMutex;
+    bool m_drawCancelled { false };
     RunLoop::Timer<MediaPlayerPrivateGStreamerBase> m_drawTimer;
 
 #if USE(TEXTURE_MAPPER_GL)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to