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

Side by Side Diff: content/renderer/media/android/webmediaplayer_android.cc

Issue 204463008: Remove all calls to WebMediaPlayerClient::needsWebLayerForVideo() as compositing is always enabled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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/android/webmediaplayer_android.h" 5 #include "content/renderer/media/android/webmediaplayer_android.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 // may play without a surface texture. When we finally get the valid video 655 // may play without a surface texture. When we finally get the valid video
656 // size here, we should call EstablishSurfaceTexturePeer() if it has not been 656 // size here, we should call EstablishSurfaceTexturePeer() if it has not been
657 // previously called. 657 // previously called.
658 if (!paused() && needs_establish_peer_) 658 if (!paused() && needs_establish_peer_)
659 EstablishSurfaceTexturePeer(); 659 EstablishSurfaceTexturePeer();
660 #endif // defined(VIDEO_HOLE) 660 #endif // defined(VIDEO_HOLE)
661 661
662 natural_size_.width = width; 662 natural_size_.width = width;
663 natural_size_.height = height; 663 natural_size_.height = height;
664 ReallocateVideoFrame(); 664 ReallocateVideoFrame();
665 CreateWebLayerIfNeeded(); 665
666 // Lazily allocate compositing layer.
667 if (!video_weblayer_) {
scherkus (not reviewing) 2014/03/20 17:17:45 we don't need to check hasVideo() as it would alwa
668 video_weblayer_.reset(
669 new webkit::WebLayerImpl(cc::VideoLayer::Create(this)));
670 client_->setWebLayer(video_weblayer_);
671 }
672
666 // TODO(qinmin): This is a hack. We need the media element to stop showing the 673 // TODO(qinmin): This is a hack. We need the media element to stop showing the
667 // poster image by forcing it to call setDisplayMode(video). Should move the 674 // poster image by forcing it to call setDisplayMode(video). Should move the
668 // logic into HTMLMediaElement.cpp. 675 // logic into HTMLMediaElement.cpp.
669 client_->timeChanged(); 676 client_->timeChanged();
670 } 677 }
671 678
672 void WebMediaPlayerAndroid::OnTimeUpdate(const base::TimeDelta& current_time) { 679 void WebMediaPlayerAndroid::OnTimeUpdate(const base::TimeDelta& current_time) {
673 DCHECK(main_thread_checker_.CalledOnValidThread()); 680 DCHECK(main_thread_checker_.CalledOnValidThread());
674 current_time_ = current_time.InSecondsF(); 681 current_time_ = current_time.InSecondsF();
675 } 682 }
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
948 media::VideoFrame::ReleaseMailboxCB(), 955 media::VideoFrame::ReleaseMailboxCB(),
949 natural_size_, 956 natural_size_,
950 gfx::Rect(natural_size_), 957 gfx::Rect(natural_size_),
951 natural_size_, 958 natural_size_,
952 base::TimeDelta(), 959 base::TimeDelta(),
953 VideoFrame::ReadPixelsCB()); 960 VideoFrame::ReadPixelsCB());
954 SetCurrentFrameInternal(new_frame); 961 SetCurrentFrameInternal(new_frame);
955 } 962 }
956 } 963 }
957 964
958 void WebMediaPlayerAndroid::CreateWebLayerIfNeeded() {
959 if (!hasVideo() || video_weblayer_ || !client_->needsWebLayerForVideo())
960 return;
961 video_weblayer_.reset(new webkit::WebLayerImpl(cc::VideoLayer::Create(this)));
962 client_->setWebLayer(video_weblayer_.get());
963 }
964
965 void WebMediaPlayerAndroid::SetVideoFrameProviderClient( 965 void WebMediaPlayerAndroid::SetVideoFrameProviderClient(
966 cc::VideoFrameProvider::Client* client) { 966 cc::VideoFrameProvider::Client* client) {
967 // This is called from both the main renderer thread and the compositor 967 // This is called from both the main renderer thread and the compositor
968 // thread (when the main thread is blocked). 968 // thread (when the main thread is blocked).
969 if (video_frame_provider_client_) 969 if (video_frame_provider_client_)
970 video_frame_provider_client_->StopUsingProvider(); 970 video_frame_provider_client_->StopUsingProvider();
971 video_frame_provider_client_ = client; 971 video_frame_provider_client_ = client;
972 972
973 // Set the callback target when a frame is produced. 973 // Set the callback target when a frame is produced.
974 if (stream_texture_proxy_) 974 if (stream_texture_proxy_)
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
1439 1439
1440 void WebMediaPlayerAndroid::exitFullscreen() { 1440 void WebMediaPlayerAndroid::exitFullscreen() {
1441 manager_->ExitFullscreen(player_id_); 1441 manager_->ExitFullscreen(player_id_);
1442 } 1442 }
1443 1443
1444 bool WebMediaPlayerAndroid::canEnterFullscreen() const { 1444 bool WebMediaPlayerAndroid::canEnterFullscreen() const {
1445 return manager_->CanEnterFullscreen(frame_); 1445 return manager_->CanEnterFullscreen(frame_);
1446 } 1446 }
1447 1447
1448 } // namespace content 1448 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/android/webmediaplayer_android.h ('k') | content/renderer/media/webmediaplayer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698