[GTK] Several tests crashing on debug bot in (anonymous namespace)::MediaPlayerPrivat...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 21 Oct 2016 10:26:50 +0000 (10:26 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 21 Oct 2016 10:26:50 +0000 (10:26 +0000)
https://bugs.webkit.org/show_bug.cgi?id=163511

Patch by Miguel Gomez <magomez@igalia.com> on 2016-10-21
Reviewed by Carlos Garcia Campos.

Perform the video repaint in the main thread when accelerated compositing is disabled. Added a new method to
MediaPlayerClient to get whether accelerated compositing is enabled from the MediaPlayer. This is needed
because mediaPlayerAcceleratedCompositingEnabled() will return false while HTMLMediaElement doesn't have a
RenderVideo, even when accelerated compositing is enabled.

Covered by existent tests.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::mediaPlayerAcceleratedCompositingEnabled):
* html/HTMLMediaElement.h:
* platform/graphics/MediaPlayer.h:
(WebCore::MediaPlayerClient::mediaPlayerAcceleratedCompositingEnabled):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
(WebCore::MediaPlayerPrivateGStreamerBase::MediaPlayerPrivateGStreamerBase):
(WebCore::MediaPlayerPrivateGStreamerBase::repaint):
(WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207666 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/html/HTMLMediaElement.h
Source/WebCore/platform/graphics/MediaPlayer.h
Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp
Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h

index 0d75902..a9084c8 100644 (file)
@@ -1,3 +1,28 @@
+2016-10-21  Miguel Gomez  <magomez@igalia.com>
+
+        [GTK] Several tests crashing on debug bot in (anonymous namespace)::MediaPlayerPrivateGStreamerBase::repaint
+        https://bugs.webkit.org/show_bug.cgi?id=163511
+
+        Reviewed by Carlos Garcia Campos.
+
+        Perform the video repaint in the main thread when accelerated compositing is disabled. Added a new method to
+        MediaPlayerClient to get whether accelerated compositing is enabled from the MediaPlayer. This is needed
+        because mediaPlayerAcceleratedCompositingEnabled() will return false while HTMLMediaElement doesn't have a
+        RenderVideo, even when accelerated compositing is enabled.
+
+        Covered by existent tests.
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::mediaPlayerAcceleratedCompositingEnabled):
+        * html/HTMLMediaElement.h:
+        * platform/graphics/MediaPlayer.h:
+        (WebCore::MediaPlayerClient::mediaPlayerAcceleratedCompositingEnabled):
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
+        (WebCore::MediaPlayerPrivateGStreamerBase::MediaPlayerPrivateGStreamerBase):
+        (WebCore::MediaPlayerPrivateGStreamerBase::repaint):
+        (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint):
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
+
 2016-10-21  Adam Bergkvist  <adam.bergkvist@ericsson.com>
 
         WebRTC: [GTK] Add MediaEndpointOwr - an OpenWebRTC WebRTC backend
index abedcd3..01bdc42 100644 (file)
@@ -4579,6 +4579,11 @@ void HTMLMediaElement::mediaPlayerRenderingModeChanged(MediaPlayer*)
     invalidateStyleAndLayerComposition();
 }
 
+bool HTMLMediaElement::mediaPlayerAcceleratedCompositingEnabled()
+{
+    return document().settings() && document().settings()->acceleratedCompositingEnabled();
+}
+
 #if PLATFORM(WIN) && USE(AVFOUNDATION)
 
 GraphicsDeviceAdapter* HTMLMediaElement::mediaPlayerGraphicsDeviceAdapter(const MediaPlayer*) const
index 1e446e2..6edc005 100644 (file)
@@ -564,6 +564,7 @@ private:
     void mediaPlayerSizeChanged(MediaPlayer*) override;
     bool mediaPlayerRenderingCanBeAccelerated(MediaPlayer*) override;
     void mediaPlayerRenderingModeChanged(MediaPlayer*) override;
+    bool mediaPlayerAcceleratedCompositingEnabled() override;
     void mediaPlayerEngineUpdated(MediaPlayer*) override;
     void mediaEngineWasUpdated();
 
index f578a6e..4b99145 100644 (file)
@@ -195,6 +195,9 @@ public:
     // availability of the platformLayer().
     virtual void mediaPlayerRenderingModeChanged(MediaPlayer*) { }
 
+    // whether accelerated compositing is enabled for video rendering
+    virtual bool mediaPlayerAcceleratedCompositingEnabled() { return false; }
+
     virtual void mediaPlayerActiveSourceBuffersChanged(const MediaPlayer*) { }
 
 #if PLATFORM(WIN) && USE(AVFOUNDATION)
index 1fe2a63..6b8ac32 100644 (file)
@@ -175,7 +175,7 @@ MediaPlayerPrivateGStreamerBase::MediaPlayerPrivateGStreamerBase(MediaPlayer* pl
     , m_fpsSink(0)
     , m_readyState(MediaPlayer::HaveNothing)
     , m_networkState(MediaPlayer::Empty)
-#if USE(GSTREAMER_GL)
+#if USE(GSTREAMER_GL) || USE(COORDINATED_GRAPHICS_THREADED)
     , m_drawTimer(RunLoop::main(), this, &MediaPlayerPrivateGStreamerBase::repaint)
 #endif
     , m_usingFallbackVideoSink(false)
@@ -575,7 +575,7 @@ void MediaPlayerPrivateGStreamerBase::repaint()
 
     m_player->repaint();
 
-#if USE(GSTREAMER_GL)
+#if USE(GSTREAMER_GL) || USE(COORDINATED_GRAPHICS_THREADED)
     m_drawCondition.notifyOne();
 #endif
 }
@@ -595,22 +595,22 @@ void MediaPlayerPrivateGStreamerBase::triggerRepaint(GstSample* sample)
     }
 
 #if USE(COORDINATED_GRAPHICS_THREADED)
-#if USE(GSTREAMER_GL)
-    if (m_player->client().mediaPlayerRenderingCanBeAccelerated(m_player))
-        pushTextureToCompositor();
-    else {
+    if (!m_player->client().mediaPlayerAcceleratedCompositingEnabled()) {
         LockHolder locker(m_drawMutex);
         m_drawTimer.startOneShot(0);
         m_drawCondition.wait(m_drawMutex);
+        return;
     }
+
+#if USE(GSTREAMER_GL)
+    pushTextureToCompositor();
 #else
-    if (m_player->client().mediaPlayerRenderingCanBeAccelerated(m_player)) {
+    {
         LockHolder lock(m_drawMutex);
         if (!m_platformLayerProxy->scheduleUpdateOnCompositorThread([this] { this->pushTextureToCompositor(); }))
             return;
         m_drawCondition.wait(m_drawMutex);
-    } else
-        repaint();
+    }
 #endif
     return;
 #else
index 2456e52..940b306 100644 (file)
@@ -184,7 +184,7 @@ protected:
     IntSize m_size;
     mutable GMutex m_sampleMutex;
     GRefPtr<GstSample> m_sample;
-#if USE(GSTREAMER_GL)
+#if USE(GSTREAMER_GL) || USE(COORDINATED_GRAPHICS_THREADED)
     RunLoop::Timer<MediaPlayerPrivateGStreamerBase> m_drawTimer;
 #endif
     mutable FloatSize m_videoSize;