[Blackberry] Add a software rendering path for media player
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Sep 2012 03:13:21 +0000 (03:13 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Sep 2012 03:13:21 +0000 (03:13 +0000)
https://bugs.webkit.org/show_bug.cgi?id=97443

Patch by Robin Cao <robin.cao@torchmobile.com.cn> on 2012-09-24
Reviewed by Yong Li.

This patch adds a software rendering path for media player. When accelerated rendering
is not supported by the media engine for the current media, the rendering will fallback
to this software path.

PR #212386
Reviewed internally by Max Feil.

* platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp:
(WebCore::MediaPlayerPrivate::paint):
(WebCore::MediaPlayerPrivate::updateStates):
(WebCore::MediaPlayerPrivate::supportsAcceleratedRendering):
(WebCore):
* platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h:
(MediaPlayerPrivate):

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

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp
Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h

index b981afe..842ed05 100644 (file)
@@ -1,3 +1,25 @@
+2012-09-24  Robin Cao  <robin.cao@torchmobile.com.cn>
+
+        [Blackberry] Add a software rendering path for media player
+        https://bugs.webkit.org/show_bug.cgi?id=97443
+
+        Reviewed by Yong Li.
+
+        This patch adds a software rendering path for media player. When accelerated rendering
+        is not supported by the media engine for the current media, the rendering will fallback
+        to this software path.
+
+        PR #212386
+        Reviewed internally by Max Feil.
+
+        * platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp:
+        (WebCore::MediaPlayerPrivate::paint):
+        (WebCore::MediaPlayerPrivate::updateStates):
+        (WebCore::MediaPlayerPrivate::supportsAcceleratedRendering):
+        (WebCore):
+        * platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h:
+        (MediaPlayerPrivate):
+
 2012-09-24  Benjamin Poulain  <bpoulain@apple.com>
 
         Fix Geolocation error reporting in the test support
index af06a23..867d815 100644 (file)
@@ -347,13 +347,16 @@ void MediaPlayerPrivate::paint(GraphicsContext* context, const IntRect& rect)
         return;
 
 #if USE(ACCELERATED_COMPOSITING)
-    // Only process paint calls coming via the accelerated compositing code
-    // path, where we get called with a null graphics context. See
-    // LayerCompositingThread::drawTextures(). Ignore calls from the regular
-    // rendering path.
-    if (!context)
-        m_platformPlayer->notifyOutputUpdate(BlackBerry::Platform::IntRect(rect.x(), rect.y(), rect.width(), rect.height()));
-    return;
+    if (supportsAcceleratedRendering()) {
+        // Only process paint calls coming via the accelerated compositing code
+        // path, where we get called with a null graphics context. See
+        // LayerCompositingThread::drawTextures(). Ignore calls from the regular
+        // rendering path.
+        if (!context)
+            m_platformPlayer->notifyOutputUpdate(BlackBerry::Platform::IntRect(rect.x(), rect.y(), rect.width(), rect.height()));
+
+        return;
+    }
 #endif
 
     paintCurrentFrameInContext(context, rect);
@@ -540,7 +543,7 @@ void MediaPlayerPrivate::updateStates()
             m_showBufferingImage = false;
             m_mediaIsBuffering = false;
             // Create platform layer for video (create hole punch rect).
-            if (!m_platformLayer)
+            if (!m_platformLayer && supportsAcceleratedRendering())
                 m_platformLayer = VideoLayerWebKitThread::create(m_webCorePlayer);
 #endif
             break;
@@ -820,6 +823,13 @@ bool MediaPlayerPrivate::isTabVisible() const
     return m_webCorePlayer->mediaPlayerClient()->mediaPlayerHostWindow()->platformPageClient()->isVisible();
 }
 
+bool MediaPlayerPrivate::supportsAcceleratedRendering() const
+{
+    if (m_platformPlayer)
+        return m_platformPlayer->supportsAcceleratedRendering();
+    return false;
+}
+
 #if USE(ACCELERATED_COMPOSITING)
 static const double BufferingAnimationDelay = 1.0 / 24;
 static char* s_bufferingImageData = 0;
index 2896692..2629e04 100644 (file)
@@ -96,7 +96,7 @@ public:
 
 #if USE(ACCELERATED_COMPOSITING)
     // Whether accelerated rendering is supported by the media engine for the current media.
-    virtual bool supportsAcceleratedRendering() const { return true; }
+    virtual bool supportsAcceleratedRendering() const;
     // Called when the rendering system flips the into or out of accelerated rendering mode.
     virtual void acceleratedRenderingStateChanged() { }
 #endif