From 3997d9d7f9ce3754a4cc3aa1f5c3e211fa2dad2a Mon Sep 17 00:00:00 2001 From: "jamesr@google.com" Date: Fri, 13 Apr 2012 20:43:24 +0000 Subject: [PATCH] [chromium] Move WebVideoFrame into Platform and remove WebCore::VideoFrameChromium wrapper API https://bugs.webkit.org/show_bug.cgi?id=83851 Reviewed by Adam Barth. Source/Platform: Move WebVideoFrame API into Platform. * Platform.gypi: * chromium/public/WebVideoFrame.h: Renamed from Source/WebCore/platform/graphics/chromium/VideoFrameChromium.h. (WebKit): (WebVideoFrame): (WebKit::WebVideoFrame::~WebVideoFrame): (WebKit::WebVideoFrame::format): (WebKit::WebVideoFrame::width): (WebKit::WebVideoFrame::height): (WebKit::WebVideoFrame::planes): (WebKit::WebVideoFrame::stride): (WebKit::WebVideoFrame::data): (WebKit::WebVideoFrame::textureId): (WebKit::WebVideoFrame::textureTarget): * chromium/src/WebVideoFrame.cpp: Renamed from Source/WebCore/platform/graphics/chromium/VideoFrameChromium.cpp. (WebKit): Source/WebCore: Remove VideoFrameChromium wrapper and converts WebCore code to using the Platform WebVideoFrame API directly. Some utility code that previously existed on VideoFrameChromium and only had one caller, such as doing width/height adjustements for YV12 frames, is moved into the calling code (CCVideoLayerImpl). Covered by existing media/ and compositing/ layout tests. * WebCore.gypi: * platform/graphics/chromium/LayerRendererChromium.cpp: (WebCore::LayerRendererChromium::drawYUV): (WebCore::LayerRendererChromium::drawRGBA): (WebCore::LayerRendererChromium::copyFrameToTextures): * platform/graphics/chromium/LayerRendererChromium.h: * platform/graphics/chromium/VideoFrameProvider.h: (VideoFrameProvider): * platform/graphics/chromium/cc/CCVideoDrawQuad.cpp: (WebCore::CCVideoDrawQuad::create): (WebCore::CCVideoDrawQuad::CCVideoDrawQuad): * platform/graphics/chromium/cc/CCVideoDrawQuad.h: (WebKit): (CCVideoDrawQuad): (WebCore::CCVideoDrawQuad::frame): * platform/graphics/chromium/cc/CCVideoLayerImpl.cpp: (WebCore): (WebCore::convertVFCFormatToGC3DFormat): (WebCore::CCVideoLayerImpl::willDraw): (WebCore::videoFrameDimension): (WebCore::hasPaddingBytes): (WebCore::CCVideoLayerImpl::computeVisibleSize): (WebCore::CCVideoLayerImpl::reserveTextures): * platform/graphics/chromium/cc/CCVideoLayerImpl.h: (WebKit): Source/WebKit/chromium: Moves the WebVideoFrame interface into Platform and removes the now unnecessary VideoFrameChromiumImpl adapter implementation. * WebKit.gyp: * public/WebVideoFrame.h: * src/AssertMatchingEnums.cpp: * src/VideoFrameChromiumImpl.cpp: Removed. * src/VideoFrameChromiumImpl.h: Removed. * src/WebMediaPlayerClientImpl.cpp: (WebKit::WebMediaPlayerClientImpl::getCurrentFrame): (WebKit::WebMediaPlayerClientImpl::putCurrentFrame): (WebKit::WebMediaPlayerClientImpl::supportsType): * src/WebMediaPlayerClientImpl.h: (WebMediaPlayerClientImpl): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@114164 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Source/Platform/ChangeLog | 25 ++++ Source/Platform/Platform.gypi | 1 + .../chromium/public/WebVideoFrame.h} | 53 ++++---- .../chromium/src/WebVideoFrame.cpp} | 23 ++-- Source/WebCore/ChangeLog | 39 ++++++ Source/WebCore/WebCore.gypi | 2 - .../graphics/chromium/LayerRendererChromium.cpp | 16 +-- .../graphics/chromium/LayerRendererChromium.h | 1 - .../graphics/chromium/VideoFrameProvider.h | 12 +- .../graphics/chromium/cc/CCVideoDrawQuad.cpp | 4 +- .../graphics/chromium/cc/CCVideoDrawQuad.h | 12 +- .../graphics/chromium/cc/CCVideoLayerImpl.cpp | 63 ++++++---- .../graphics/chromium/cc/CCVideoLayerImpl.h | 11 +- Source/WebKit/chromium/ChangeLog | 22 ++++ Source/WebKit/chromium/WebKit.gyp | 2 - Source/WebKit/chromium/WebKitUnitTests.gyp | 5 + Source/WebKit/chromium/public/WebVideoFrame.h | 76 +++--------- Source/WebKit/chromium/src/AssertMatchingEnums.cpp | 7 -- .../WebKit/chromium/src/VideoFrameChromiumImpl.cpp | 138 --------------------- .../WebKit/chromium/src/VideoFrameChromiumImpl.h | 69 ----------- .../chromium/src/WebMediaPlayerClientImpl.cpp | 24 ++-- .../WebKit/chromium/src/WebMediaPlayerClientImpl.h | 7 +- 22 files changed, 225 insertions(+), 387 deletions(-) rename Source/{WebCore/platform/graphics/chromium/VideoFrameChromium.h => Platform/chromium/public/WebVideoFrame.h} (64%) rename Source/{WebCore/platform/graphics/chromium/VideoFrameChromium.cpp => Platform/chromium/src/WebVideoFrame.cpp} (77%) delete mode 100644 Source/WebKit/chromium/src/VideoFrameChromiumImpl.cpp delete mode 100644 Source/WebKit/chromium/src/VideoFrameChromiumImpl.h diff --git a/Source/Platform/ChangeLog b/Source/Platform/ChangeLog index bed4b42..2cf5796 100644 --- a/Source/Platform/ChangeLog +++ b/Source/Platform/ChangeLog @@ -1,3 +1,28 @@ +2012-04-13 James Robinson + + [chromium] Move WebVideoFrame into Platform and remove WebCore::VideoFrameChromium wrapper API + https://bugs.webkit.org/show_bug.cgi?id=83851 + + Reviewed by Adam Barth. + + Move WebVideoFrame API into Platform. + + * Platform.gypi: + * chromium/public/WebVideoFrame.h: Renamed from Source/WebCore/platform/graphics/chromium/VideoFrameChromium.h. + (WebKit): + (WebVideoFrame): + (WebKit::WebVideoFrame::~WebVideoFrame): + (WebKit::WebVideoFrame::format): + (WebKit::WebVideoFrame::width): + (WebKit::WebVideoFrame::height): + (WebKit::WebVideoFrame::planes): + (WebKit::WebVideoFrame::stride): + (WebKit::WebVideoFrame::data): + (WebKit::WebVideoFrame::textureId): + (WebKit::WebVideoFrame::textureTarget): + * chromium/src/WebVideoFrame.cpp: Renamed from Source/WebCore/platform/graphics/chromium/VideoFrameChromium.cpp. + (WebKit): + 2012-04-12 Sheriff Bot Unreviewed, rolling out r114075. diff --git a/Source/Platform/Platform.gypi b/Source/Platform/Platform.gypi index 8c54cac..a3ecbb8 100644 --- a/Source/Platform/Platform.gypi +++ b/Source/Platform/Platform.gypi @@ -94,6 +94,7 @@ 'chromium/src/WebCString.cpp', 'chromium/src/WebFloatQuad.cpp', 'chromium/src/WebString.cpp', + 'chromium/src/WebVideoFrame.cpp', ] } } diff --git a/Source/WebCore/platform/graphics/chromium/VideoFrameChromium.h b/Source/Platform/chromium/public/WebVideoFrame.h similarity index 64% rename from Source/WebCore/platform/graphics/chromium/VideoFrameChromium.h rename to Source/Platform/chromium/public/WebVideoFrame.h index 77af07c..db0aa7d 100644 --- a/Source/WebCore/platform/graphics/chromium/VideoFrameChromium.h +++ b/Source/Platform/chromium/public/WebVideoFrame.h @@ -28,15 +28,15 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef VideoFrameChromium_h -#define VideoFrameChromium_h +#ifndef WebVideoFrame_h +#define WebVideoFrame_h -#include "IntSize.h" +namespace WebKit { -namespace WebCore { - -// A class that represents a video frame in chromium. -class VideoFrameChromium { +// A proxy video frame interface to communicate frame data between chromium +// and WebKit. +// Keep in sync with chromium's media::VideoFrame::Format. +class WebVideoFrame { public: static const unsigned maxPlanes; static const unsigned numRGBPlanes; @@ -46,32 +46,27 @@ public: static const unsigned uPlane; static const unsigned vPlane; - // These enums must be kept in sync with WebKit::WebVideoFrame. enum Format { - Invalid = 0, - RGB32 = 4, - YV12 = 6, - YV16 = 7, - Empty = 9, - I420 = 11, - NativeTexture = 12, + FormatInvalid = 0, + FormatRGB32 = 4, + FormatYV12 = 6, + FormatYV16 = 7, + FormatEmpty = 9, + FormatI420 = 11, + FormatNativeTexture = 12, }; - virtual ~VideoFrameChromium(); - virtual Format format() const = 0; - virtual unsigned width() const = 0; - virtual unsigned width(unsigned plane) const = 0; - virtual unsigned height() const = 0; - virtual unsigned height(unsigned plane) const = 0; - virtual unsigned planes() const = 0; - virtual int stride(unsigned plane) const = 0; - virtual const void* data(unsigned plane) const = 0; - virtual const IntSize requiredTextureSize(unsigned plane) const = 0; - virtual bool hasPaddingBytes(unsigned plane) const = 0; - virtual unsigned textureId() const = 0; - virtual unsigned textureTarget() const = 0; + virtual ~WebVideoFrame() { } + virtual Format format() const { return FormatInvalid; } + virtual unsigned width() const { return 0; } + virtual unsigned height() const { return 0; } + virtual unsigned planes() const { return 0; } + virtual int stride(unsigned plane) const { return 0; } + virtual const void* data(unsigned plane) const { return 0; } + virtual unsigned textureId() const { return 0; } + virtual unsigned textureTarget() const { return 0; } }; -} // namespace WebCore +} // namespace WebKit #endif diff --git a/Source/WebCore/platform/graphics/chromium/VideoFrameChromium.cpp b/Source/Platform/chromium/src/WebVideoFrame.cpp similarity index 77% rename from Source/WebCore/platform/graphics/chromium/VideoFrameChromium.cpp rename to Source/Platform/chromium/src/WebVideoFrame.cpp index ca92842..8c86659 100644 --- a/Source/WebCore/platform/graphics/chromium/VideoFrameChromium.cpp +++ b/Source/Platform/chromium/src/WebVideoFrame.cpp @@ -30,20 +30,17 @@ #include "config.h" -#include "VideoFrameChromium.h" +#include -namespace WebCore { +namespace WebKit { -const unsigned VideoFrameChromium::maxPlanes = 3; -const unsigned VideoFrameChromium::numRGBPlanes = 1; -const unsigned VideoFrameChromium::rgbPlane = 0; -const unsigned VideoFrameChromium::numYUVPlanes = 3; -const unsigned VideoFrameChromium::yPlane = 0; -const unsigned VideoFrameChromium::uPlane = 1; -const unsigned VideoFrameChromium::vPlane = 2; - -VideoFrameChromium::~VideoFrameChromium() { } - -} // namespace WebCore +const unsigned WebVideoFrame::maxPlanes = 3; +const unsigned WebVideoFrame::numRGBPlanes = 1; +const unsigned WebVideoFrame::rgbPlane = 0; +const unsigned WebVideoFrame::numYUVPlanes = 3; +const unsigned WebVideoFrame::yPlane = 0; +const unsigned WebVideoFrame::uPlane = 1; +const unsigned WebVideoFrame::vPlane = 2; +} // namespace WebKit diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 7b9fba3..15e9e65 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,42 @@ +2012-04-13 James Robinson + + [chromium] Move WebVideoFrame into Platform and remove WebCore::VideoFrameChromium wrapper API + https://bugs.webkit.org/show_bug.cgi?id=83851 + + Reviewed by Adam Barth. + + Remove VideoFrameChromium wrapper and converts WebCore code to using the Platform WebVideoFrame API directly. + Some utility code that previously existed on VideoFrameChromium and only had one caller, such as doing + width/height adjustements for YV12 frames, is moved into the calling code (CCVideoLayerImpl). + + Covered by existing media/ and compositing/ layout tests. + + * WebCore.gypi: + * platform/graphics/chromium/LayerRendererChromium.cpp: + (WebCore::LayerRendererChromium::drawYUV): + (WebCore::LayerRendererChromium::drawRGBA): + (WebCore::LayerRendererChromium::copyFrameToTextures): + * platform/graphics/chromium/LayerRendererChromium.h: + * platform/graphics/chromium/VideoFrameProvider.h: + (VideoFrameProvider): + * platform/graphics/chromium/cc/CCVideoDrawQuad.cpp: + (WebCore::CCVideoDrawQuad::create): + (WebCore::CCVideoDrawQuad::CCVideoDrawQuad): + * platform/graphics/chromium/cc/CCVideoDrawQuad.h: + (WebKit): + (CCVideoDrawQuad): + (WebCore::CCVideoDrawQuad::frame): + * platform/graphics/chromium/cc/CCVideoLayerImpl.cpp: + (WebCore): + (WebCore::convertVFCFormatToGC3DFormat): + (WebCore::CCVideoLayerImpl::willDraw): + (WebCore::videoFrameDimension): + (WebCore::hasPaddingBytes): + (WebCore::CCVideoLayerImpl::computeVisibleSize): + (WebCore::CCVideoLayerImpl::reserveTextures): + * platform/graphics/chromium/cc/CCVideoLayerImpl.h: + (WebKit): + 2012-04-13 Rob Flack Chromium: Should enable -webkit-image-set diff --git a/Source/WebCore/WebCore.gypi b/Source/WebCore/WebCore.gypi index e00eeef..1a27d63 100644 --- a/Source/WebCore/WebCore.gypi +++ b/Source/WebCore/WebCore.gypi @@ -3583,8 +3583,6 @@ 'platform/graphics/chromium/UniscribeHelperTextRun.h', 'platform/graphics/chromium/VDMXParser.cpp', 'platform/graphics/chromium/VDMXParser.h', - 'platform/graphics/chromium/VideoFrameChromium.cpp', - 'platform/graphics/chromium/VideoFrameChromium.h', 'platform/graphics/chromium/VideoFrameProvider.h', 'platform/graphics/chromium/VideoLayerChromium.cpp', 'platform/graphics/chromium/VideoLayerChromium.h', diff --git a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp index e8f6a74..aad83ef 100644 --- a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp @@ -68,6 +68,7 @@ #include "Extensions3D.h" #include "NativeImageSkia.h" #include "PlatformContextSkia.h" +#include #include #include @@ -831,9 +832,9 @@ void LayerRendererChromium::drawYUV(const CCVideoDrawQuad* quad) const CCVideoLayerImpl::YUVProgram* program = videoLayerYUVProgram(); ASSERT(program && program->initialized()); - const CCVideoLayerImpl::Texture& yTexture = quad->textures()[VideoFrameChromium::yPlane]; - const CCVideoLayerImpl::Texture& uTexture = quad->textures()[VideoFrameChromium::uPlane]; - const CCVideoLayerImpl::Texture& vTexture = quad->textures()[VideoFrameChromium::vPlane]; + const CCVideoLayerImpl::Texture& yTexture = quad->textures()[WebKit::WebVideoFrame::yPlane]; + const CCVideoLayerImpl::Texture& uTexture = quad->textures()[WebKit::WebVideoFrame::uPlane]; + const CCVideoLayerImpl::Texture& vTexture = quad->textures()[WebKit::WebVideoFrame::vPlane]; GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE1)); GLC(context(), context()->bindTexture(GraphicsContext3D::TEXTURE_2D, yTexture.m_texture->textureId())); @@ -889,7 +890,7 @@ void LayerRendererChromium::drawSingleTextureVideoQuad(const CCVideoDrawQuad* qu void LayerRendererChromium::drawRGBA(const CCVideoDrawQuad* quad) { const CCVideoLayerImpl::RGBAProgram* program = videoLayerRGBAProgram(); - const CCVideoLayerImpl::Texture& texture = quad->textures()[VideoFrameChromium::rgbPlane]; + const CCVideoLayerImpl::Texture& texture = quad->textures()[WebKit::WebVideoFrame::rgbPlane]; float widthScaleFactor = static_cast(texture.m_visibleSize.width()) / texture.m_texture->size().width(); drawSingleTextureVideoQuad(quad, program, widthScaleFactor, texture.m_texture->textureId(), GraphicsContext3D::TEXTURE_2D); } @@ -914,12 +915,11 @@ void LayerRendererChromium::drawStreamTexture(const CCVideoDrawQuad* quad) bool LayerRendererChromium::copyFrameToTextures(const CCVideoDrawQuad* quad) { - const VideoFrameChromium* frame = quad->frame(); + const WebKit::WebVideoFrame* frame = quad->frame(); - for (unsigned plane = 0; plane < frame->planes(); ++plane) { - ASSERT(quad->frame()->requiredTextureSize(plane) == quad->textures()[plane].m_texture->size()); + for (unsigned plane = 0; plane < frame->planes(); ++plane) copyPlaneToTexture(quad, frame->data(plane), plane); - } + for (unsigned plane = frame->planes(); plane < CCVideoLayerImpl::MaxPlanes; ++plane) { CCVideoLayerImpl::Texture* texture = &quad->textures()[plane]; texture->m_texture.clear(); diff --git a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h index a05f9fd..194a18b 100644 --- a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h +++ b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h @@ -40,7 +40,6 @@ #include "LayerChromium.h" #include "TextureCopier.h" #include "TrackingTextureAllocator.h" -#include "VideoLayerChromium.h" #include "cc/CCDrawQuad.h" #include "cc/CCHeadsUpDisplay.h" #include "cc/CCLayerTreeHost.h" diff --git a/Source/WebCore/platform/graphics/chromium/VideoFrameProvider.h b/Source/WebCore/platform/graphics/chromium/VideoFrameProvider.h index 9794794..0aa442d 100644 --- a/Source/WebCore/platform/graphics/chromium/VideoFrameProvider.h +++ b/Source/WebCore/platform/graphics/chromium/VideoFrameProvider.h @@ -31,7 +31,7 @@ #ifndef VideoFrameProvider_h #define VideoFrameProvider_h -#include "VideoFrameChromium.h" +#include namespace WebCore { @@ -49,17 +49,15 @@ public: virtual void setVideoFrameProviderClient(Client*) = 0; - // This function returns a pointer to a VideoFrameChromium, which is - // the WebCore wrapper for a video frame in Chromium. getCurrentFrame() - // places a lock on the frame in Chromium. Calls to this method should - // always be followed with a call to putCurrentFrame(). + // This function places a lock on the current frame and returns a pointer to it. + // Calls to this method should always be followed with a call to putCurrentFrame(). // The ownership of the object is not transferred to the caller and // the caller should not free the returned object. - virtual VideoFrameChromium* getCurrentFrame() = 0; + virtual WebKit::WebVideoFrame* getCurrentFrame() = 0; // This function releases the lock on the video frame in chromium. It should // always be called after getCurrentFrame(). Frames passed into this method // should no longer be referenced after the call is made. - virtual void putCurrentFrame(VideoFrameChromium*) = 0; + virtual void putCurrentFrame(WebKit::WebVideoFrame*) = 0; }; } // namespace WebCore diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCVideoDrawQuad.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCVideoDrawQuad.cpp index ba57349..9cca714 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCVideoDrawQuad.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCVideoDrawQuad.cpp @@ -29,12 +29,12 @@ namespace WebCore { -PassOwnPtr CCVideoDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, CCVideoLayerImpl::Texture* textures, VideoFrameChromium* frame, GC3Denum format) +PassOwnPtr CCVideoDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, CCVideoLayerImpl::Texture* textures, WebKit::WebVideoFrame* frame, GC3Denum format) { return adoptPtr(new CCVideoDrawQuad(sharedQuadState, quadRect, textures, frame, format)); } -CCVideoDrawQuad::CCVideoDrawQuad(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, CCVideoLayerImpl::Texture* textures, VideoFrameChromium* frame, GC3Denum format) +CCVideoDrawQuad::CCVideoDrawQuad(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, CCVideoLayerImpl::Texture* textures, WebKit::WebVideoFrame* frame, GC3Denum format) : CCDrawQuad(sharedQuadState, CCDrawQuad::VideoContent, quadRect) , m_textures(textures) , m_frame(frame) diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCVideoDrawQuad.h b/Source/WebCore/platform/graphics/chromium/cc/CCVideoDrawQuad.h index aef7847..9eb357f 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCVideoDrawQuad.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCVideoDrawQuad.h @@ -31,25 +31,29 @@ #include "cc/CCVideoLayerImpl.h" #include +namespace WebKit { +class WebVideoFrame; +} + namespace WebCore { class CCVideoDrawQuad : public CCDrawQuad { WTF_MAKE_NONCOPYABLE(CCVideoDrawQuad); public: - static PassOwnPtr create(const CCSharedQuadState*, const IntRect&, CCVideoLayerImpl::Texture* textures, VideoFrameChromium*, GC3Denum format); + static PassOwnPtr create(const CCSharedQuadState*, const IntRect&, CCVideoLayerImpl::Texture* textures, WebKit::WebVideoFrame*, GC3Denum format); CCVideoLayerImpl::Texture* textures() const { return m_textures; } - VideoFrameChromium* frame() const { return m_frame; } + WebKit::WebVideoFrame* frame() const { return m_frame; } GC3Denum format() const { return m_format; } const float* matrix() const { return m_matrix; } void setMatrix(const float* matrix) { m_matrix = matrix; } private: - CCVideoDrawQuad(const CCSharedQuadState*, const IntRect&, CCVideoLayerImpl::Texture* textures, VideoFrameChromium*, GC3Denum format); + CCVideoDrawQuad(const CCSharedQuadState*, const IntRect&, CCVideoLayerImpl::Texture* textures, WebKit::WebVideoFrame*, GC3Denum format); CCVideoLayerImpl::Texture* m_textures; - VideoFrameChromium* m_frame; + WebKit::WebVideoFrame* m_frame; GC3Denum m_format; const float* m_matrix; }; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp index 0e6dca7..c71e0e0 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp @@ -38,6 +38,7 @@ #include "cc/CCProxy.h" #include "cc/CCQuadCuller.h" #include "cc/CCVideoDrawQuad.h" +#include #include namespace WebCore { @@ -99,19 +100,19 @@ void CCVideoLayerImpl::stopUsingProvider() m_provider = 0; } -// Convert VideoFrameChromium::Format to GraphicsContext3D's format enum values. -static GC3Denum convertVFCFormatToGC3DFormat(const VideoFrameChromium* frame) +// Convert WebKit::WebVideoFrame::Format to GraphicsContext3D's format enum values. +static GC3Denum convertVFCFormatToGC3DFormat(const WebKit::WebVideoFrame& frame) { - switch (frame->format()) { - case VideoFrameChromium::YV12: - case VideoFrameChromium::YV16: + switch (frame.format()) { + case WebKit::WebVideoFrame::FormatYV12: + case WebKit::WebVideoFrame::FormatYV16: return GraphicsContext3D::LUMINANCE; - case VideoFrameChromium::NativeTexture: - return frame->textureTarget(); - case VideoFrameChromium::Invalid: - case VideoFrameChromium::RGB32: - case VideoFrameChromium::Empty: - case VideoFrameChromium::I420: + case WebKit::WebVideoFrame::FormatNativeTexture: + return frame.textureTarget(); + case WebKit::WebVideoFrame::FormatInvalid: + case WebKit::WebVideoFrame::FormatRGB32: + case WebKit::WebVideoFrame::FormatEmpty: + case WebKit::WebVideoFrame::FormatI420: notImplemented(); } return GraphicsContext3D::INVALID_VALUE; @@ -133,7 +134,7 @@ void CCVideoLayerImpl::willDraw(LayerRendererChromium* layerRenderer) if (!m_frame) return; - m_format = convertVFCFormatToGC3DFormat(m_frame); + m_format = convertVFCFormatToGC3DFormat(*m_frame); if (m_format == GraphicsContext3D::INVALID_VALUE) { m_provider->putCurrentFrame(m_frame); @@ -141,7 +142,7 @@ void CCVideoLayerImpl::willDraw(LayerRendererChromium* layerRenderer) return; } - if (!reserveTextures(m_frame, m_format, layerRenderer)) { + if (!reserveTextures(*m_frame, m_format, layerRenderer)) { m_provider->putCurrentFrame(m_frame); m_frame = 0; } @@ -176,37 +177,49 @@ void CCVideoLayerImpl::didDraw() m_frame = 0; } -IntSize CCVideoLayerImpl::computeVisibleSize(const VideoFrameChromium* frame, unsigned plane) +static int videoFrameDimension(int originalDimension, unsigned plane, int format) { - int visibleWidth = frame->width(plane); - int visibleHeight = frame->height(plane); + if (format == WebKit::WebVideoFrame::FormatYV12 && plane != WebKit::WebVideoFrame::yPlane) + return originalDimension / 2; + return originalDimension; +} + +static bool hasPaddingBytes(const WebKit::WebVideoFrame& frame, unsigned plane) +{ + return frame.stride(plane) > videoFrameDimension(frame.width(), plane, frame.format()); +} + +IntSize CCVideoLayerImpl::computeVisibleSize(const WebKit::WebVideoFrame& frame, unsigned plane) +{ + int visibleWidth = videoFrameDimension(frame.width(), plane, frame.format()); + int originalWidth = visibleWidth; + int visibleHeight = videoFrameDimension(frame.height(), plane, frame.format()); + // When there are dead pixels at the edge of the texture, decrease // the frame width by 1 to prevent the rightmost pixels from // interpolating with the dead pixels. - if (frame->hasPaddingBytes(plane)) + if (hasPaddingBytes(frame, plane)) --visibleWidth; // In YV12, every 2x2 square of Y values corresponds to one U and // one V value. If we decrease the width of the UV plane, we must decrease the // width of the Y texture by 2 for proper alignment. This must happen // always, even if Y's texture does not have padding bytes. - if (plane == VideoFrameChromium::yPlane && frame->format() == VideoFrameChromium::YV12) { - if (frame->hasPaddingBytes(VideoFrameChromium::uPlane)) { - int originalWidth = frame->width(plane); + if (plane == WebKit::WebVideoFrame::yPlane && frame.format() == WebKit::WebVideoFrame::FormatYV12) { + if (hasPaddingBytes(frame, WebKit::WebVideoFrame::uPlane)) visibleWidth = originalWidth - 2; - } } return IntSize(visibleWidth, visibleHeight); } -bool CCVideoLayerImpl::reserveTextures(const VideoFrameChromium* frame, GC3Denum format, LayerRendererChromium* layerRenderer) +bool CCVideoLayerImpl::reserveTextures(const WebKit::WebVideoFrame& frame, GC3Denum format, LayerRendererChromium* layerRenderer) { - if (frame->planes() > MaxPlanes) + if (frame.planes() > MaxPlanes) return false; int maxTextureSize = layerRenderer->capabilities().maxTextureSize; - for (unsigned plane = 0; plane < frame->planes(); ++plane) { - IntSize requiredTextureSize = frame->requiredTextureSize(plane); + for (unsigned plane = 0; plane < frame.planes(); ++plane) { + IntSize requiredTextureSize(frame.stride(plane), videoFrameDimension(frame.height(), plane, frame.format())); // If the renderer cannot handle this large of a texture, return false. // FIXME: Remove this test when tiled layers are implemented. if (requiredTextureSize.isZero() || requiredTextureSize.width() > maxTextureSize || requiredTextureSize.height() > maxTextureSize) diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.h index 39e2f22..e119230 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.h @@ -28,11 +28,14 @@ #include "ManagedTexture.h" #include "ShaderChromium.h" -#include "VideoFrameChromium.h" #include "VideoFrameProvider.h" #include "VideoLayerChromium.h" #include "cc/CCLayerImpl.h" +namespace WebKit { +class WebVideoFrame; +} + namespace WebCore { class CCLayerTreeHostImpl; @@ -83,10 +86,10 @@ public: private: explicit CCVideoLayerImpl(int, VideoFrameProvider*); - static IntSize computeVisibleSize(const VideoFrameChromium*, unsigned plane); + static IntSize computeVisibleSize(const WebKit::WebVideoFrame&, unsigned plane); virtual const char* layerTypeAsString() const OVERRIDE { return "VideoLayer"; } - bool reserveTextures(const VideoFrameChromium*, GC3Denum format, LayerRendererChromium*); + bool reserveTextures(const WebKit::WebVideoFrame&, GC3Denum format, LayerRendererChromium*); Mutex m_providerMutex; // Guards m_provider below. VideoFrameProvider* m_provider; @@ -96,7 +99,7 @@ private: float m_streamTextureMatrix[16]; CCLayerTreeHostImpl* m_layerTreeHostImpl; - VideoFrameChromium* m_frame; + WebKit::WebVideoFrame* m_frame; GC3Denum m_format; }; diff --git a/Source/WebKit/chromium/ChangeLog b/Source/WebKit/chromium/ChangeLog index 6b1b94b..9ae7c1f 100644 --- a/Source/WebKit/chromium/ChangeLog +++ b/Source/WebKit/chromium/ChangeLog @@ -1,3 +1,25 @@ +2012-04-13 James Robinson + + [chromium] Move WebVideoFrame into Platform and remove WebCore::VideoFrameChromium wrapper API + https://bugs.webkit.org/show_bug.cgi?id=83851 + + Reviewed by Adam Barth. + + Moves the WebVideoFrame interface into Platform and removes the now unnecessary VideoFrameChromiumImpl adapter + implementation. + + * WebKit.gyp: + * public/WebVideoFrame.h: + * src/AssertMatchingEnums.cpp: + * src/VideoFrameChromiumImpl.cpp: Removed. + * src/VideoFrameChromiumImpl.h: Removed. + * src/WebMediaPlayerClientImpl.cpp: + (WebKit::WebMediaPlayerClientImpl::getCurrentFrame): + (WebKit::WebMediaPlayerClientImpl::putCurrentFrame): + (WebKit::WebMediaPlayerClientImpl::supportsType): + * src/WebMediaPlayerClientImpl.h: + (WebMediaPlayerClientImpl): + 2012-04-13 Rob Flack Chromium: Should enable -webkit-image-set diff --git a/Source/WebKit/chromium/WebKit.gyp b/Source/WebKit/chromium/WebKit.gyp index e1b37f7..fe4c3dd 100644 --- a/Source/WebKit/chromium/WebKit.gyp +++ b/Source/WebKit/chromium/WebKit.gyp @@ -486,8 +486,6 @@ 'src/WebTextCheckingCompletionImpl.h', 'src/WebTextCheckingCompletionImpl.cpp', 'src/WebTextCheckingResult.cpp', - 'src/VideoFrameChromiumImpl.cpp', - 'src/VideoFrameChromiumImpl.h', 'src/WebAccessibilityObject.cpp', 'src/WebAnimationControllerImpl.cpp', 'src/WebAnimationControllerImpl.h', diff --git a/Source/WebKit/chromium/WebKitUnitTests.gyp b/Source/WebKit/chromium/WebKitUnitTests.gyp index 4776dc4..6f1ed11 100644 --- a/Source/WebKit/chromium/WebKitUnitTests.gyp +++ b/Source/WebKit/chromium/WebKitUnitTests.gyp @@ -72,6 +72,11 @@ 'include_dirs': [ 'public', 'src', + # WebKit unit tests are allowed to include WebKit and WebCore header files, which may include headers in the + # Platform API as . Thus we need to have the Platform API include path, but we can't depend + # directly on Platform.gyp:webkit_platform since platform cannot link as a separate library. Instead, we just + # add the include path directly. + '../../Platform/chromium', ], 'conditions': [ ['inside_chromium_build==1 and component=="shared_library"', { diff --git a/Source/WebKit/chromium/public/WebVideoFrame.h b/Source/WebKit/chromium/public/WebVideoFrame.h index 4fab1f2..948a7a4 100644 --- a/Source/WebKit/chromium/public/WebVideoFrame.h +++ b/Source/WebKit/chromium/public/WebVideoFrame.h @@ -1,64 +1,26 @@ /* - * Copyright (C) 2010 Google Inc. All rights reserved. + * Copyright (C) 2012 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: + * modification, are permitted provided that the following conditions + * are met: * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WebVideoFrame_h -#define WebVideoFrame_h - -namespace WebKit { - -// A proxy video frame interface to communicate frame data between chromium -// and WebKit. -// Keep in sync with VideoFrameChromium and chromium's media::VideoFrame::Format. -class WebVideoFrame { -public: - enum Format { - FormatInvalid = 0, - FormatRGB32 = 4, - FormatYV12 = 6, - FormatYV16 = 7, - FormatEmpty = 9, - FormatI420 = 11, - FormatNativeTexture = 12, - }; - - virtual ~WebVideoFrame() { } - virtual Format format() const { return FormatInvalid; } - virtual unsigned width() const { return 0; } - virtual unsigned height() const { return 0; } - virtual unsigned planes() const { return 0; } - virtual int stride(unsigned plane) const { return 0; } - virtual const void* data(unsigned plane) const { return 0; } - virtual unsigned textureId() const { return 0; } - virtual unsigned textureTarget() const { return 0; } -}; - -} // namespace WebKit - -#endif +#include "../../../Platform/chromium/public/WebVideoFrame.h" diff --git a/Source/WebKit/chromium/src/AssertMatchingEnums.cpp b/Source/WebKit/chromium/src/AssertMatchingEnums.cpp index 72c2be6..4851ec9 100644 --- a/Source/WebKit/chromium/src/AssertMatchingEnums.cpp +++ b/Source/WebKit/chromium/src/AssertMatchingEnums.cpp @@ -69,7 +69,6 @@ #include "UserContentTypes.h" #include "UserScriptTypes.h" #include "UserStyleSheetTypes.h" -#include "VideoFrameChromium.h" #include "WebAccessibilityNotification.h" #include "WebAccessibilityObject.h" #include "WebApplicationCacheHost.h" @@ -99,7 +98,6 @@ #include "WebTextCaseSensitivity.h" #include "WebTextCheckingResult.h" #include "WebTextCheckingType.h" -#include "WebVideoFrame.h" #include "WebView.h" #include "platform/WebClipboard.h" #include "platform/WebFileSystem.h" @@ -402,11 +400,6 @@ COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayerClient::HardwareChangeError, MediaPla COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayerClient::DomainError, MediaPlayerClient::DomainError); #endif -COMPILE_ASSERT_MATCHING_ENUM(WebVideoFrame::FormatInvalid, VideoFrameChromium::Invalid); -COMPILE_ASSERT_MATCHING_ENUM(WebVideoFrame::FormatRGB32, VideoFrameChromium::RGB32); -COMPILE_ASSERT_MATCHING_ENUM(WebVideoFrame::FormatYV12, VideoFrameChromium::YV12); -COMPILE_ASSERT_MATCHING_ENUM(WebVideoFrame::FormatYV16, VideoFrameChromium::YV16); -COMPILE_ASSERT_MATCHING_ENUM(WebVideoFrame::FormatEmpty, VideoFrameChromium::Empty); #endif #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) diff --git a/Source/WebKit/chromium/src/VideoFrameChromiumImpl.cpp b/Source/WebKit/chromium/src/VideoFrameChromiumImpl.cpp deleted file mode 100644 index fcce939..0000000 --- a/Source/WebKit/chromium/src/VideoFrameChromiumImpl.cpp +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "VideoFrameChromiumImpl.h" - -#include "VideoFrameChromium.h" -#include "WebVideoFrame.h" - -using namespace WebCore; - -namespace WebKit { - -WebVideoFrame* VideoFrameChromiumImpl::toWebVideoFrame(VideoFrameChromium* videoFrame) -{ - VideoFrameChromiumImpl* wrappedFrame = static_cast(videoFrame); - if (wrappedFrame) - return wrappedFrame->m_webVideoFrame; - return 0; -} - -VideoFrameChromiumImpl::VideoFrameChromiumImpl(WebVideoFrame* webVideoFrame) - : m_webVideoFrame(webVideoFrame) -{ -} - -VideoFrameChromium::Format VideoFrameChromiumImpl::format() const -{ - if (m_webVideoFrame) - return static_cast(m_webVideoFrame->format()); - return Invalid; -} - -unsigned VideoFrameChromiumImpl::width() const -{ - if (m_webVideoFrame) - return m_webVideoFrame->width(); - return 0; -} - -unsigned VideoFrameChromiumImpl::width(unsigned plane) const -{ - unsigned planeWidth = width(); - if (format() == YV12 && plane != static_cast(yPlane)) - planeWidth /= 2; - return planeWidth; -} - -unsigned VideoFrameChromiumImpl::height() const -{ - if (m_webVideoFrame) - return m_webVideoFrame->height(); - return 0; -} - -unsigned VideoFrameChromiumImpl::height(unsigned plane) const -{ - unsigned planeHeight = height(); - if (format() == YV12 && plane != static_cast(yPlane)) - planeHeight /= 2; - return planeHeight; -} - -unsigned VideoFrameChromiumImpl::planes() const -{ - if (m_webVideoFrame) - return m_webVideoFrame->planes(); - return 0; -} - -int VideoFrameChromiumImpl::stride(unsigned plane) const -{ - if (m_webVideoFrame) - return m_webVideoFrame->stride(plane); - return 0; -} - -const void* VideoFrameChromiumImpl::data(unsigned plane) const -{ - if (m_webVideoFrame) - return m_webVideoFrame->data(plane); - return 0; -} - -const IntSize VideoFrameChromiumImpl::requiredTextureSize(unsigned plane) const -{ - return IntSize(stride(plane), height(plane)); -} - -bool VideoFrameChromiumImpl::hasPaddingBytes(unsigned plane) const -{ - if (m_webVideoFrame) - return stride(plane) - width(plane) > 0; - return false; -} - -unsigned VideoFrameChromiumImpl::textureId() const -{ - if (m_webVideoFrame) - return m_webVideoFrame->textureId(); - return 0; -} - -unsigned VideoFrameChromiumImpl::textureTarget() const -{ - if (m_webVideoFrame) - return m_webVideoFrame->textureTarget(); - return 0; -} - -} // namespace WebKit diff --git a/Source/WebKit/chromium/src/VideoFrameChromiumImpl.h b/Source/WebKit/chromium/src/VideoFrameChromiumImpl.h deleted file mode 100644 index 6792086..0000000 --- a/Source/WebKit/chromium/src/VideoFrameChromiumImpl.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef VideoFrameChromiumImpl_h -#define VideoFrameChromiumImpl_h - -#include "VideoFrameChromium.h" -#include "WebVideoFrame.h" - -namespace WebKit { - -// A wrapper class for WebKit::WebVideoFrame. Objects can be created in WebKit -// and used in WebCore because of the VideoFrameChromium interface. -class VideoFrameChromiumImpl : public WebCore::VideoFrameChromium { -public: - // Converts a WebCore::VideoFrameChromium to a WebKit::WebVideoFrame. - static WebVideoFrame* toWebVideoFrame(WebCore::VideoFrameChromium*); - - // Creates a VideoFrameChromiumImpl object to wrap the given WebVideoFrame. - // The VideoFrameChromiumImpl does not take ownership of the WebVideoFrame - // and should not free the frame's memory. - VideoFrameChromiumImpl(WebVideoFrame*); - virtual Format format() const; - virtual unsigned width() const; - virtual unsigned width(unsigned plane) const; - virtual unsigned height() const; - virtual unsigned height(unsigned plane) const; - virtual unsigned planes() const; - virtual int stride(unsigned plane) const; - virtual const void* data(unsigned plane) const; - virtual const WebCore::IntSize requiredTextureSize(unsigned plane) const; - virtual bool hasPaddingBytes(unsigned plane) const; - virtual unsigned textureId() const; - virtual unsigned textureTarget() const; - -private: - WebVideoFrame* m_webVideoFrame; -}; - -} // namespace WebKit - -#endif diff --git a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp index 5c7b2c9..4600fb8 100644 --- a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp +++ b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp @@ -19,8 +19,6 @@ #include "PlatformContextSkia.h" #include "RenderView.h" #include "TimeRanges.h" -#include "VideoFrameChromium.h" -#include "VideoFrameChromiumImpl.h" #include "VideoLayerChromium.h" #include "WebAudioSourceProvider.h" #include "WebFrameClient.h" @@ -663,29 +661,24 @@ void WebMediaPlayerClientImpl::setVideoFrameProviderClient(VideoFrameProvider::C m_webMediaPlayer->setStreamTextureClient(client ? this : 0); } -VideoFrameChromium* WebMediaPlayerClientImpl::getCurrentFrame() +WebVideoFrame* WebMediaPlayerClientImpl::getCurrentFrame() { MutexLocker locker(m_compositingMutex); ASSERT(!m_currentVideoFrame); - if (m_webMediaPlayer) { - WebVideoFrame* webkitVideoFrame = m_webMediaPlayer->getCurrentFrame(); - if (webkitVideoFrame) - m_currentVideoFrame = adoptPtr(new VideoFrameChromiumImpl(webkitVideoFrame)); - } - return m_currentVideoFrame.get(); + if (m_webMediaPlayer) + m_currentVideoFrame = m_webMediaPlayer->getCurrentFrame(); + return m_currentVideoFrame; } -void WebMediaPlayerClientImpl::putCurrentFrame(VideoFrameChromium* videoFrame) +void WebMediaPlayerClientImpl::putCurrentFrame(WebVideoFrame* videoFrame) { MutexLocker locker(m_compositingMutex); ASSERT(videoFrame == m_currentVideoFrame); if (!videoFrame) return; - if (m_webMediaPlayer) { - m_webMediaPlayer->putCurrentFrame( - VideoFrameChromiumImpl::toWebVideoFrame(videoFrame)); - } - m_currentVideoFrame.clear(); + if (m_webMediaPlayer) + m_webMediaPlayer->putCurrentFrame(videoFrame); + m_currentVideoFrame = 0; } #endif @@ -767,6 +760,7 @@ void WebMediaPlayerClientImpl::didUpdateMatrix(const float* matrix) WebMediaPlayerClientImpl::WebMediaPlayerClientImpl() : m_mediaPlayer(0) + , m_currentVideoFrame(0) , m_delayingLoad(false) , m_preload(MediaPlayer::MetaData) #if USE(ACCELERATED_COMPOSITING) diff --git a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h index 50bcc01..ba1730f 100644 --- a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h +++ b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h @@ -35,7 +35,6 @@ #include "AudioSourceProvider.h" #include "MediaPlayerPrivate.h" -#include "VideoFrameChromium.h" #include "VideoFrameProvider.h" #include "VideoLayerChromium.h" #include "WebAudioSourceProviderClient.h" @@ -145,8 +144,8 @@ public: // VideoFrameProvider methods: virtual void setVideoFrameProviderClient(VideoFrameProvider::Client*); - virtual WebCore::VideoFrameChromium* getCurrentFrame(); - virtual void putCurrentFrame(WebCore::VideoFrameChromium*); + virtual WebVideoFrame* getCurrentFrame(); + virtual void putCurrentFrame(WebVideoFrame*); #endif #if ENABLE(MEDIA_SOURCE) @@ -185,7 +184,7 @@ private: Mutex m_compositingMutex; // Guards m_currentVideoFrame and m_videoFrameProviderClient. WebCore::MediaPlayer* m_mediaPlayer; OwnPtr m_webMediaPlayer; - OwnPtr m_currentVideoFrame; + WebVideoFrame* m_currentVideoFrame; String m_url; bool m_delayingLoad; WebCore::MediaPlayer::Preload m_preload; -- 2.7.4