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

Side by Side Diff: content/renderer/media/webmediaplayer_impl.cc

Issue 388643002: Rotation into Video Layer + Content Transform (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Alternative transform Created 6 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/media/webmediaplayer_impl.h" 5 #include "content/renderer/media/webmediaplayer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 533
534 // TODO(scherkus): Clarify paint() API contract to better understand when and 534 // TODO(scherkus): Clarify paint() API contract to better understand when and
535 // why it's being called. For example, today paint() is called when: 535 // why it's being called. For example, today paint() is called when:
536 // - We haven't reached HAVE_CURRENT_DATA and need to paint black 536 // - We haven't reached HAVE_CURRENT_DATA and need to paint black
537 // - We're painting to a canvas 537 // - We're painting to a canvas
538 // See http://crbug.com/341225 http://crbug.com/342621 for details. 538 // See http://crbug.com/341225 http://crbug.com/342621 for details.
539 scoped_refptr<media::VideoFrame> video_frame = 539 scoped_refptr<media::VideoFrame> video_frame =
540 GetCurrentFrameFromCompositor(); 540 GetCurrentFrameFromCompositor();
541 541
542 gfx::Rect gfx_rect(rect); 542 gfx::Rect gfx_rect(rect);
543
544 if (pipeline_metadata_.video_rotation == media::VIDEO_ROTATION_90 ||
545 pipeline_metadata_.video_rotation == media::VIDEO_ROTATION_270)
546 gfx_rect.set_size(
547 gfx::Size(gfx_rect.size().height(), gfx_rect.size().width()));
548
543 skcanvas_video_renderer_.Paint(video_frame.get(), canvas, gfx_rect, alpha); 549 skcanvas_video_renderer_.Paint(video_frame.get(), canvas, gfx_rect, alpha);
544 } 550 }
545 551
546 bool WebMediaPlayerImpl::hasSingleSecurityOrigin() const { 552 bool WebMediaPlayerImpl::hasSingleSecurityOrigin() const {
547 if (data_source_) 553 if (data_source_)
548 return data_source_->HasSingleOrigin(); 554 return data_source_->HasSingleOrigin();
549 return true; 555 return true;
550 } 556 }
551 557
552 bool WebMediaPlayerImpl::didPassCORSAccessCheck() const { 558 bool WebMediaPlayerImpl::didPassCORSAccessCheck() const {
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
960 void WebMediaPlayerImpl::OnPipelineMetadata( 966 void WebMediaPlayerImpl::OnPipelineMetadata(
961 media::PipelineMetadata metadata) { 967 media::PipelineMetadata metadata) {
962 DVLOG(1) << __FUNCTION__; 968 DVLOG(1) << __FUNCTION__;
963 969
964 pipeline_metadata_ = metadata; 970 pipeline_metadata_ = metadata;
965 971
966 SetReadyState(WebMediaPlayer::ReadyStateHaveMetadata); 972 SetReadyState(WebMediaPlayer::ReadyStateHaveMetadata);
967 973
968 if (hasVideo()) { 974 if (hasVideo()) {
969 DCHECK(!video_weblayer_); 975 DCHECK(!video_weblayer_);
970 video_weblayer_.reset( 976 scoped_refptr<cc::VideoLayer> layer =
971 new WebLayerImpl(cc::VideoLayer::Create(compositor_))); 977 cc::VideoLayer::Create(compositor_, pipeline_metadata_.video_rotation);
978
979 if (pipeline_metadata_.video_rotation == media::VIDEO_ROTATION_90 ||
980 pipeline_metadata_.video_rotation == media::VIDEO_ROTATION_270) {
981 gfx::Size size = pipeline_metadata_.natural_size;
982 pipeline_metadata_.natural_size = gfx::Size(size.height(), size.width());
983 }
984
985 video_weblayer_.reset(new WebLayerImpl(layer));
972 video_weblayer_->setOpaque(opaque_); 986 video_weblayer_->setOpaque(opaque_);
973 client_->setWebLayer(video_weblayer_.get()); 987 client_->setWebLayer(video_weblayer_.get());
974 } 988 }
975 989
976 // TODO(scherkus): This should be handled by HTMLMediaElement and controls 990 // TODO(scherkus): This should be handled by HTMLMediaElement and controls
977 // should know when to invalidate themselves http://crbug.com/337015 991 // should know when to invalidate themselves http://crbug.com/337015
978 InvalidateOnMainThread(); 992 InvalidateOnMainThread();
979 } 993 }
980 994
981 void WebMediaPlayerImpl::OnPipelineBufferingStateChanged( 995 void WebMediaPlayerImpl::OnPipelineBufferingStateChanged(
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
1358 compositor_task_runner_->PostTask(FROM_HERE, 1372 compositor_task_runner_->PostTask(FROM_HERE,
1359 base::Bind(&GetCurrentFrameAndSignal, 1373 base::Bind(&GetCurrentFrameAndSignal,
1360 base::Unretained(compositor_), 1374 base::Unretained(compositor_),
1361 &video_frame, 1375 &video_frame,
1362 &event)); 1376 &event));
1363 event.Wait(); 1377 event.Wait();
1364 return video_frame; 1378 return video_frame;
1365 } 1379 }
1366 1380
1367 } // namespace content 1381 } // namespace content
OLDNEW
« cc/layers/video_layer_impl.cc ('K') | « cc/trees/layer_tree_host_unittest_video.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698