Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4508)

Unified Diff: cc/layers/video_layer_impl.cc

Issue 1125303005: cc: VideoLayerImpl VideoFrame::TEXTURE_YUV_420 support. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: No alpha for native textures. DCHECK_IMPLIES. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | cc/layers/video_layer_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/video_layer_impl.cc
diff --git a/cc/layers/video_layer_impl.cc b/cc/layers/video_layer_impl.cc
index 51719717e6d49698db972ee9c80580348524d490..a6f5942e1a9204110f030557d307784de017c110 100644
--- a/cc/layers/video_layer_impl.cc
+++ b/cc/layers/video_layer_impl.cc
@@ -221,8 +221,7 @@ void VideoLayerImpl::AppendQuads(RenderPass* render_pass,
}
case VideoFrameExternalResources::YUV_RESOURCE: {
DCHECK_GE(frame_resources_.size(), 3u);
- if (frame_resources_.size() < 3u)
- break;
+
YUVVideoDrawQuad::ColorSpace color_space = YUVVideoDrawQuad::REC_601;
if (frame_->format() == media::VideoFrame::YV12J) {
color_space = YUVVideoDrawQuad::JPEG;
@@ -231,15 +230,26 @@ void VideoLayerImpl::AppendQuads(RenderPass* render_pass,
}
const gfx::Size ya_tex_size = coded_size;
- const gfx::Size uv_tex_size = media::VideoFrame::PlaneSize(
- frame_->format(), media::VideoFrame::kUPlane, coded_size);
- DCHECK(uv_tex_size ==
- media::VideoFrame::PlaneSize(
- frame_->format(), media::VideoFrame::kVPlane, coded_size));
- if (frame_resources_.size() > 3) {
- DCHECK(ya_tex_size ==
+ gfx::Size uv_tex_size;
+
+ if (frame_->format() == media::VideoFrame::NATIVE_TEXTURE) {
+ DCHECK_EQ(media::VideoFrame::TEXTURE_YUV_420, frame_->texture_format());
+ DCHECK_EQ(3u, frame_resources_.size()); // Alpha is not supported yet.
+ DCHECK(visible_rect.origin().IsOrigin());
+ DCHECK(visible_rect.size() == coded_size);
+ uv_tex_size.SetSize((ya_tex_size.width() + 1) / 2,
+ (ya_tex_size.height() + 1) / 2);
+ } else {
+ uv_tex_size = media::VideoFrame::PlaneSize(
+ frame_->format(), media::VideoFrame::kUPlane, coded_size);
+ DCHECK(uv_tex_size ==
media::VideoFrame::PlaneSize(
- frame_->format(), media::VideoFrame::kAPlane, coded_size));
+ frame_->format(), media::VideoFrame::kVPlane, coded_size));
+ DCHECK_IMPLIES(
+ frame_resources_.size() > 3,
+ ya_tex_size ==
+ media::VideoFrame::PlaneSize(
+ frame_->format(), media::VideoFrame::kAPlane, coded_size));
}
gfx::RectF tex_coord_rect(
« no previous file with comments | « no previous file | cc/layers/video_layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698