Index: Source/WebKit/chromium/src/VideoFrameChromiumImpl.cpp |
=================================================================== |
--- Source/WebKit/chromium/src/VideoFrameChromiumImpl.cpp (revision 79604) |
+++ Source/WebKit/chromium/src/VideoFrameChromiumImpl.cpp (working copy) |
@@ -72,6 +72,14 @@ |
return 0; |
} |
+unsigned VideoFrameChromiumImpl::width(unsigned plane) const |
+{ |
+ unsigned planeWidth = width(); |
+ if (format() == YV12 && plane != static_cast<unsigned>(yPlane)) |
+ planeWidth /= 2; |
+ return planeWidth; |
+} |
+ |
unsigned VideoFrameChromiumImpl::height() const |
{ |
if (m_webVideoFrame) |
@@ -79,6 +87,14 @@ |
return 0; |
} |
+unsigned VideoFrameChromiumImpl::height(unsigned plane) const |
+{ |
+ unsigned planeHeight = height(); |
+ if (format() == YV12 && plane != static_cast<unsigned>(yPlane)) |
+ planeHeight /= 2; |
+ return planeHeight; |
+} |
+ |
unsigned VideoFrameChromiumImpl::planes() const |
{ |
if (m_webVideoFrame) |
@@ -109,21 +125,14 @@ |
const IntSize VideoFrameChromiumImpl::requiredTextureSize(unsigned plane) const |
{ |
- switch (format()) { |
- case RGBA: |
- case YV16: |
- return IntSize(stride(plane), height()); |
- case YV12: |
- if (plane == static_cast<unsigned>(yPlane)) |
- return IntSize(stride(plane), height()); |
- else if (plane == static_cast<unsigned>(uPlane)) |
- return IntSize(stride(plane), height() / 2); |
- else if (plane == static_cast<unsigned>(vPlane)) |
- return IntSize(stride(plane), height() / 2); |
- default: |
- break; |
- } |
- return IntSize(); |
+ return IntSize(stride(plane), height(plane)); |
} |
+bool VideoFrameChromiumImpl::hasPaddingBytes(unsigned plane) const |
+{ |
+ if (m_webVideoFrame) |
+ return stride(plane) - width(plane) > 0; |
+ return false; |
+} |
+ |
} // namespace WebKit |