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

Side by Side Diff: webkit/media/android/webmediaplayer_android.cc

Issue 13688004: Location/size change notification when external rendering is enabled (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Yuncheol's comments. Created 7 years, 8 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "webkit/media/android/webmediaplayer_android.h" 5 #include "webkit/media/android/webmediaplayer_android.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "cc/layers/video_layer.h" 10 #include "cc/layers/video_layer.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 has_size_info_(false), 47 has_size_info_(false),
48 stream_texture_factory_(factory), 48 stream_texture_factory_(factory),
49 needs_external_surface_(false), 49 needs_external_surface_(false),
50 video_frame_provider_client_(NULL) { 50 video_frame_provider_client_(NULL) {
51 main_loop_->AddDestructionObserver(this); 51 main_loop_->AddDestructionObserver(this);
52 if (manager_) 52 if (manager_)
53 player_id_ = manager_->RegisterMediaPlayer(this); 53 player_id_ = manager_->RegisterMediaPlayer(this);
54 54
55 if (CommandLine::ForCurrentProcess()->HasSwitch( 55 if (CommandLine::ForCurrentProcess()->HasSwitch(
56 switches::kUseExternalVideoSurface)) { 56 switches::kUseExternalVideoSurface)) {
57 #if defined(GOOGLE_TV)
57 needs_external_surface_ = true; 58 needs_external_surface_ = true;
58 SetNeedsEstablishPeer(false); 59 SetNeedsEstablishPeer(false);
59 ReallocateVideoFrame(); 60 ReallocateVideoFrame();
61 #else
62 NOTIMPLEMENTED() << "No external video surface rendering support";
63 #endif
60 } else if (stream_texture_factory_.get()) { 64 } else if (stream_texture_factory_.get()) {
61 stream_texture_proxy_.reset(stream_texture_factory_->CreateProxy()); 65 stream_texture_proxy_.reset(stream_texture_factory_->CreateProxy());
62 stream_id_ = stream_texture_factory_->CreateStreamTexture(&texture_id_); 66 stream_id_ = stream_texture_factory_->CreateStreamTexture(&texture_id_);
63 ReallocateVideoFrame(); 67 ReallocateVideoFrame();
64 } 68 }
65 } 69 }
66 70
67 WebMediaPlayerAndroid::~WebMediaPlayerAndroid() { 71 WebMediaPlayerAndroid::~WebMediaPlayerAndroid() {
68 SetVideoFrameProviderClient(NULL); 72 SetVideoFrameProviderClient(NULL);
69 client_->setWebLayer(NULL); 73 client_->setWebLayer(NULL);
(...skipping 21 matching lines...) Expand all
91 WebMediaSource* media_source, 95 WebMediaSource* media_source,
92 CORSMode cors_mode) { 96 CORSMode cors_mode) {
93 NOTIMPLEMENTED(); 97 NOTIMPLEMENTED();
94 } 98 }
95 99
96 void WebMediaPlayerAndroid::cancelLoad() { 100 void WebMediaPlayerAndroid::cancelLoad() {
97 NOTIMPLEMENTED(); 101 NOTIMPLEMENTED();
98 } 102 }
99 103
100 void WebMediaPlayerAndroid::play() { 104 void WebMediaPlayerAndroid::play() {
105 #if defined(GOOGLE_TV)
101 if (hasVideo() && needs_external_surface_) { 106 if (hasVideo() && needs_external_surface_) {
102 DCHECK(!needs_establish_peer_); 107 DCHECK(!needs_establish_peer_);
103 RequestExternalSurface(); 108 RequestExternalSurface();
104 } 109 }
110 #endif
105 if (hasVideo() && needs_establish_peer_) 111 if (hasVideo() && needs_establish_peer_)
106 EstablishSurfaceTexturePeer(); 112 EstablishSurfaceTexturePeer();
107 113
108 PlayInternal(); 114 PlayInternal();
109 is_playing_ = true; 115 is_playing_ = true;
110 } 116 }
111 117
112 void WebMediaPlayerAndroid::pause() { 118 void WebMediaPlayerAndroid::pause() {
113 PauseInternal(); 119 PauseInternal();
114 is_playing_ = false; 120 is_playing_ = false;
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 } 511 }
506 512
507 void WebMediaPlayerAndroid::SetNeedsEstablishPeer(bool needs_establish_peer) { 513 void WebMediaPlayerAndroid::SetNeedsEstablishPeer(bool needs_establish_peer) {
508 needs_establish_peer_ = needs_establish_peer; 514 needs_establish_peer_ = needs_establish_peer;
509 } 515 }
510 516
511 void WebMediaPlayerAndroid::UpdatePlayingState(bool is_playing) { 517 void WebMediaPlayerAndroid::UpdatePlayingState(bool is_playing) {
512 is_playing_ = is_playing; 518 is_playing_ = is_playing;
513 } 519 }
514 520
521 #if defined(GOOGLE_TV)
522 bool WebMediaPlayerAndroid::GetGeometryChange(gfx::RectF* rect) {
523 if (!video_weblayer_)
524 return false;
525
526 // Compute the geometry of video frame layer.
527 cc::Layer* layer = video_weblayer_->layer();
528 rect->set_size(layer->bounds());
palmer 2013/04/12 18:51:21 Maybe this function should be called |SetGeometryC
wonsik 2013/04/15 02:44:16 Good point. I will use |RetrieveGeometryChange| to
529 while (layer) {
530 rect->Offset(layer->position().OffsetFromOrigin());
531 layer = layer->parent();
532 }
533
534 // Return false when the geometry hasn't been changed from the last time.
535 if (last_computed_rect_ == *rect)
536 return false;
537
538 // Store the changed geometry information when it is actually changed.
539 last_computed_rect_ = *rect;
540 return true;
541 }
542 #endif
543
515 } // namespace webkit_media 544 } // namespace webkit_media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698