summaryrefslogtreecommitdiffstats
path: root/cc/layers/video_layer_impl.cc
diff options
context:
space:
mode:
authorsheu@chromium.org <sheu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-23 23:08:59 +0000
committersheu@chromium.org <sheu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-23 23:08:59 +0000
commit9b6b5e0ee779f1c51946bbacb34a47699b9072d2 (patch)
tree8ce35a6267bae4a524e0e0b93da05b8901c6fcac /cc/layers/video_layer_impl.cc
parentca2d0d3de414c9107c3ec273c06bfde76c055577 (diff)
downloadchromium_src-9b6b5e0ee779f1c51946bbacb34a47699b9072d2.zip
chromium_src-9b6b5e0ee779f1c51946bbacb34a47699b9072d2.tar.gz
chromium_src-9b6b5e0ee779f1c51946bbacb34a47699b9072d2.tar.bz2
Fix VideoLayerImpl upload of YUV->RGBA converted frames.
Fixes issues introduced by r189506. This CL has already been LGTM'ed by danakj@ on https://chromiumcodereview.appspot.com/12998003/. Resubmitting as a new issue due to CQ having gotten into a bad state. BUG=chromium:167417 BUG=chromium-os:38376 TEST=local build, unittests TBR=danakj Change-Id: Ic1ed42e897a7c89b574a653ca7a7ef3fa5395375 Review URL: https://chromiumcodereview.appspot.com/12634034 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@190106 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/layers/video_layer_impl.cc')
-rw-r--r--cc/layers/video_layer_impl.cc26
1 files changed, 8 insertions, 18 deletions
diff --git a/cc/layers/video_layer_impl.cc b/cc/layers/video_layer_impl.cc
index fbef0a5..5efbd49 100644
--- a/cc/layers/video_layer_impl.cc
+++ b/cc/layers/video_layer_impl.cc
@@ -366,19 +366,18 @@ void VideoLayerImpl::FramePlane::FreeData(ResourceProvider* resource_provider) {
}
// Convert media::VideoFrame::Format to OpenGL enum values.
-static GLenum ConvertVFCFormatToGLenum(const media::VideoFrame& frame) {
- switch (frame.format()) {
+static GLenum ConvertVFCFormatToGLenum(const media::VideoFrame::Format format) {
+ switch (format) {
case media::VideoFrame::YV12:
case media::VideoFrame::YV16:
return GL_LUMINANCE;
+ case media::VideoFrame::RGB32:
+ return GL_RGBA;
case media::VideoFrame::NATIVE_TEXTURE:
- return frame.texture_target();
#if defined(GOOGLE_TV)
case media::VideoFrame::HOLE:
- return GL_INVALID_VALUE;
#endif
case media::VideoFrame::INVALID:
- case media::VideoFrame::RGB32:
case media::VideoFrame::EMPTY:
case media::VideoFrame::I420:
NOTREACHED();
@@ -387,23 +386,13 @@ static GLenum ConvertVFCFormatToGLenum(const media::VideoFrame& frame) {
return GL_INVALID_VALUE;
}
-size_t VideoLayerImpl::NumPlanes() const {
- if (!frame_)
- return 0;
-
- if (convert_yuv_)
- return 1;
-
- return media::VideoFrame::NumPlanes(frame_->format());
-}
-
bool VideoLayerImpl::SetupFramePlanes(ResourceProvider* resource_provider) {
- const size_t plane_count = NumPlanes();
+ const size_t plane_count = media::VideoFrame::NumPlanes(format_);
if (!plane_count)
return true;
const int max_texture_size = resource_provider->max_texture_size();
- const GLenum pixel_format = ConvertVFCFormatToGLenum(*frame_);
+ const GLenum pixel_format = ConvertVFCFormatToGLenum(format_);
for (size_t plane_index = 0; plane_index < plane_count; ++plane_index) {
VideoLayerImpl::FramePlane* plane = &frame_planes_[plane_index];
@@ -464,7 +453,8 @@ void VideoLayerImpl::FreeFramePlanes(ResourceProvider* resource_provider) {
}
void VideoLayerImpl::FreeUnusedFramePlanes(ResourceProvider* resource_provider) {
- size_t first_unused_plane = NumPlanes();
+ size_t first_unused_plane = (frame_ ? media::VideoFrame::NumPlanes(format_)
+ : 0);
for (size_t i = first_unused_plane; i < media::VideoFrame::kMaxPlanes; ++i)
frame_planes_[i].FreeData(resource_provider);
}