OLD | NEW |
---|---|
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 "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
11 #include "cc/layers/video_layer.h" | 11 #include "cc/layers/video_layer.h" |
12 #include "gpu/GLES2/gl2extchromium.h" | 12 #include "gpu/GLES2/gl2extchromium.h" |
13 #include "media/base/android/media_player_bridge.h" | 13 #include "media/base/android/media_player_bridge.h" |
14 #include "media/base/video_frame.h" | 14 #include "media/base/video_frame.h" |
15 #include "net/base/mime_util.h" | 15 #include "net/base/mime_util.h" |
16 #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h" | 16 #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h" |
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerClient. h" | 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerClient. h" |
20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaSource.h" | 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaSource.h" |
21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
22 #include "webkit/compositor_bindings/web_layer_impl.h" | 22 #include "webkit/compositor_bindings/web_layer_impl.h" |
23 #include "webkit/media/android/webmediaplayer_manager_android.h" | 23 #include "webkit/media/android/webmediaplayer_manager_android.h" |
24 #include "webkit/media/android/webmediaplayer_proxy_android.h" | 24 #include "webkit/media/android/webmediaplayer_proxy_android.h" |
25 #include "webkit/media/media_switches.h" | 25 #include "webkit/media/media_switches.h" |
26 #include "webkit/media/webmediaplayer_util.h" | 26 #include "webkit/media/webmediaplayer_util.h" |
27 | 27 |
28 #if defined(GOOGLE_TV) | |
29 #include "webkit/media/android/media_source_delegate.h" | |
30 #endif | |
31 | |
32 static const uint32 kGLTextureExternalOES = 0x8D65; | 28 static const uint32 kGLTextureExternalOES = 0x8D65; |
33 | 29 |
34 using WebKit::WebMediaPlayer; | 30 using WebKit::WebMediaPlayer; |
35 using WebKit::WebMediaSource; | 31 using WebKit::WebMediaSource; |
36 using WebKit::WebSize; | 32 using WebKit::WebSize; |
37 using WebKit::WebString; | 33 using WebKit::WebString; |
38 using WebKit::WebTimeRanges; | 34 using WebKit::WebTimeRanges; |
39 using WebKit::WebURL; | 35 using WebKit::WebURL; |
40 using media::MediaPlayerBridge; | 36 using media::MediaPlayerBridge; |
41 using media::VideoFrame; | 37 using media::VideoFrame; |
42 | 38 |
43 namespace webkit_media { | 39 namespace webkit_media { |
44 | 40 |
45 WebMediaPlayerAndroid::WebMediaPlayerAndroid( | 41 WebMediaPlayerAndroid::WebMediaPlayerAndroid( |
46 WebKit::WebFrame* frame, | 42 WebKit::WebFrame* frame, |
47 WebKit::WebMediaPlayerClient* client, | 43 WebKit::WebMediaPlayerClient* client, |
48 WebMediaPlayerManagerAndroid* manager, | 44 WebMediaPlayerManagerAndroid* manager, |
49 WebMediaPlayerProxyAndroid* proxy, | 45 WebMediaPlayerProxyAndroid* proxy, |
50 StreamTextureFactory* factory, | 46 StreamTextureFactory* factory) |
51 media::MediaLog* media_log) | |
52 : frame_(frame), | 47 : frame_(frame), |
53 client_(client), | 48 client_(client), |
54 buffered_(1u), | 49 buffered_(1u), |
55 main_loop_(base::MessageLoop::current()), | 50 main_loop_(base::MessageLoop::current()), |
56 pending_seek_(0), | 51 pending_seek_(0), |
57 seeking_(false), | 52 seeking_(false), |
58 did_loading_progress_(false), | 53 did_loading_progress_(false), |
59 manager_(manager), | 54 manager_(manager), |
60 network_state_(WebMediaPlayer::NetworkStateEmpty), | 55 network_state_(WebMediaPlayer::NetworkStateEmpty), |
61 ready_state_(WebMediaPlayer::ReadyStateHaveNothing), | 56 ready_state_(WebMediaPlayer::ReadyStateHaveNothing), |
62 is_playing_(false), | 57 is_playing_(false), |
63 needs_establish_peer_(true), | 58 needs_establish_peer_(true), |
64 has_size_info_(false), | 59 has_size_info_(false), |
65 stream_texture_factory_(factory), | 60 stream_texture_factory_(factory), |
66 needs_external_surface_(false), | 61 needs_external_surface_(false), |
67 video_frame_provider_client_(NULL), | 62 video_frame_provider_client_(NULL), |
68 proxy_(proxy), | 63 proxy_(proxy), |
69 current_time_(0), | 64 current_time_(0) { |
70 media_log_(media_log) { | |
71 main_loop_->AddDestructionObserver(this); | 65 main_loop_->AddDestructionObserver(this); |
72 if (manager_) | 66 if (manager_) |
73 player_id_ = manager_->RegisterMediaPlayer(this); | 67 player_id_ = manager_->RegisterMediaPlayer(this); |
74 | 68 |
75 if (stream_texture_factory_.get()) { | 69 if (stream_texture_factory_.get()) { |
76 stream_texture_proxy_.reset(stream_texture_factory_->CreateProxy()); | 70 stream_texture_proxy_.reset(stream_texture_factory_->CreateProxy()); |
77 stream_id_ = stream_texture_factory_->CreateStreamTexture(&texture_id_); | 71 stream_id_ = stream_texture_factory_->CreateStreamTexture(&texture_id_); |
78 ReallocateVideoFrame(); | 72 ReallocateVideoFrame(); |
79 } | 73 } |
80 } | 74 } |
(...skipping 19 matching lines...) Expand all Loading... | |
100 load(url, NULL, cors_mode); | 94 load(url, NULL, cors_mode); |
101 } | 95 } |
102 | 96 |
103 void WebMediaPlayerAndroid::load(const WebURL& url, | 97 void WebMediaPlayerAndroid::load(const WebURL& url, |
104 WebMediaSource* media_source, | 98 WebMediaSource* media_source, |
105 CORSMode cors_mode) { | 99 CORSMode cors_mode) { |
106 if (cors_mode != CORSModeUnspecified) | 100 if (cors_mode != CORSModeUnspecified) |
107 NOTIMPLEMENTED() << "No CORS support"; | 101 NOTIMPLEMENTED() << "No CORS support"; |
108 | 102 |
109 scoped_ptr<WebKit::WebMediaSource> scoped_media_source(media_source); | 103 scoped_ptr<WebKit::WebMediaSource> scoped_media_source(media_source); |
110 #if defined(GOOGLE_TV) | |
111 if (media_source) { | |
112 media_source_delegate_.reset( | |
113 new MediaSourceDelegate( | |
114 frame_, client_, proxy_, player_id_, media_log_)); | |
115 // |media_source_delegate_| is owned, so Unretained() is safe here. | |
116 media_source_delegate_->Initialize( | |
117 scoped_media_source.Pass(), | |
118 base::Bind(&WebMediaPlayerAndroid::UpdateNetworkState, | |
119 base::Unretained(this))); | |
120 } | |
121 #endif | |
122 | 104 |
105 InitializeMediaPlayer( | |
106 url, | |
107 media_source == NULL | |
108 ? MediaPlayerBridge::MEDIA_TYPE_DEFAULT | |
109 : MediaPlayerBridge::MEDIA_TYPE_MEDIA_SOURCE_EXTENSIONS); | |
110 } | |
111 | |
112 void WebMediaPlayerAndroid::InitializeMediaPlayer( | |
113 const WebURL& url, | |
114 MediaPlayerBridge::MediaType media_type) { | |
123 url_ = url; | 115 url_ = url; |
124 GURL first_party_url = frame_->document().firstPartyForCookies(); | 116 GURL first_party_url = frame_->document().firstPartyForCookies(); |
125 if (proxy_) { | 117 if (proxy_) { |
126 proxy_->Initialize(player_id_, url_, media_source != NULL, first_party_url); | 118 proxy_->Initialize(player_id_, url, media_type, first_party_url); |
127 if (manager_->IsInFullscreen(frame_)) | 119 if (manager_->IsInFullscreen(frame_)) |
128 proxy_->EnterFullscreen(player_id_); | 120 proxy_->EnterFullscreen(player_id_); |
129 } | 121 } |
130 | 122 |
131 UpdateNetworkState(WebMediaPlayer::NetworkStateLoading); | 123 UpdateNetworkState(WebMediaPlayer::NetworkStateLoading); |
132 UpdateReadyState(WebMediaPlayer::ReadyStateHaveNothing); | 124 UpdateReadyState(WebMediaPlayer::ReadyStateHaveNothing); |
133 } | 125 } |
134 | 126 |
135 void WebMediaPlayerAndroid::cancelLoad() { | 127 void WebMediaPlayerAndroid::cancelLoad() { |
136 NOTIMPLEMENTED(); | 128 NOTIMPLEMENTED(); |
137 } | 129 } |
138 | 130 |
139 void WebMediaPlayerAndroid::play() { | 131 void WebMediaPlayerAndroid::play() { |
140 #if defined(GOOGLE_TV) | |
141 if (hasVideo() && needs_external_surface_) { | |
142 DCHECK(!needs_establish_peer_); | |
143 if (proxy_) | |
144 proxy_->RequestExternalSurface(player_id_); | |
145 } | |
146 #endif | |
147 if (hasVideo() && needs_establish_peer_) | 132 if (hasVideo() && needs_establish_peer_) |
148 EstablishSurfaceTexturePeer(); | 133 EstablishSurfaceTexturePeer(); |
149 | 134 |
150 if (paused() && proxy_) | 135 if (paused() && proxy_) |
151 proxy_->Start(player_id_); | 136 proxy_->Start(player_id_); |
152 is_playing_ = true; | 137 is_playing_ = true; |
153 } | 138 } |
154 | 139 |
155 void WebMediaPlayerAndroid::pause() { | 140 void WebMediaPlayerAndroid::pause() { |
156 if (proxy_) | 141 if (proxy_) |
157 proxy_->Pause(player_id_); | 142 proxy_->Pause(player_id_); |
158 is_playing_ = false; | 143 is_playing_ = false; |
159 } | 144 } |
160 | 145 |
161 void WebMediaPlayerAndroid::seek(double seconds) { | 146 void WebMediaPlayerAndroid::seek(double seconds) { |
162 pending_seek_ = seconds; | 147 pending_seek_ = seconds; |
163 seeking_ = true; | 148 seeking_ = true; |
164 | 149 |
165 base::TimeDelta seek_time = ConvertSecondsToTimestamp(seconds); | 150 base::TimeDelta seek_time = ConvertSecondsToTimestamp(seconds); |
166 #if defined(GOOGLE_TV) | |
167 if (media_source_delegate_) | |
acolwell GONE FROM CHROMIUM
2013/05/01 14:34:28
If the goal of most of the changes in this file ar
wonsik
2013/05/02 15:22:00
Done.
| |
168 media_source_delegate_->Seek(seek_time); | |
169 #endif | |
170 if (proxy_) | 151 if (proxy_) |
171 proxy_->Seek(player_id_, seek_time); | 152 proxy_->Seek(player_id_, seek_time); |
172 } | 153 } |
173 | 154 |
174 bool WebMediaPlayerAndroid::supportsFullscreen() const { | 155 bool WebMediaPlayerAndroid::supportsFullscreen() const { |
175 return true; | 156 return true; |
176 } | 157 } |
177 | 158 |
178 bool WebMediaPlayerAndroid::supportsSave() const { | 159 bool WebMediaPlayerAndroid::supportsSave() const { |
179 return false; | 160 return false; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
255 | 236 |
256 WebMediaPlayer::NetworkState WebMediaPlayerAndroid::networkState() const { | 237 WebMediaPlayer::NetworkState WebMediaPlayerAndroid::networkState() const { |
257 return network_state_; | 238 return network_state_; |
258 } | 239 } |
259 | 240 |
260 WebMediaPlayer::ReadyState WebMediaPlayerAndroid::readyState() const { | 241 WebMediaPlayer::ReadyState WebMediaPlayerAndroid::readyState() const { |
261 return ready_state_; | 242 return ready_state_; |
262 } | 243 } |
263 | 244 |
264 const WebTimeRanges& WebMediaPlayerAndroid::buffered() { | 245 const WebTimeRanges& WebMediaPlayerAndroid::buffered() { |
265 #if defined(GOOGLE_TV) | |
266 if (media_source_delegate_) | |
267 return media_source_delegate_->Buffered(); | |
268 #endif | |
269 return buffered_; | 246 return buffered_; |
270 } | 247 } |
271 | 248 |
272 double WebMediaPlayerAndroid::maxTimeSeekable() const { | 249 double WebMediaPlayerAndroid::maxTimeSeekable() const { |
273 // TODO(hclam): If this stream is not seekable this should return 0. | 250 // TODO(hclam): If this stream is not seekable this should return 0. |
274 return duration(); | 251 return duration(); |
275 } | 252 } |
276 | 253 |
277 bool WebMediaPlayerAndroid::didLoadingProgress() const { | 254 bool WebMediaPlayerAndroid::didLoadingProgress() const { |
278 bool ret = did_loading_progress_; | 255 bool ret = did_loading_progress_; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
339 // Deprecated. | 316 // Deprecated. |
340 // TODO(qinmin): Remove this from WebKit::WebMediaPlayer as it is never used. | 317 // TODO(qinmin): Remove this from WebKit::WebMediaPlayer as it is never used. |
341 return WebMediaPlayer::MovieLoadTypeUnknown; | 318 return WebMediaPlayer::MovieLoadTypeUnknown; |
342 } | 319 } |
343 | 320 |
344 double WebMediaPlayerAndroid::mediaTimeForTimeValue(double timeValue) const { | 321 double WebMediaPlayerAndroid::mediaTimeForTimeValue(double timeValue) const { |
345 return ConvertSecondsToTimestamp(timeValue).InSecondsF(); | 322 return ConvertSecondsToTimestamp(timeValue).InSecondsF(); |
346 } | 323 } |
347 | 324 |
348 unsigned WebMediaPlayerAndroid::decodedFrameCount() const { | 325 unsigned WebMediaPlayerAndroid::decodedFrameCount() const { |
349 #if defined(GOOGLE_TV) | |
350 if (media_source_delegate_) | |
351 return media_source_delegate_->DecodedFrameCount(); | |
352 #endif | |
353 NOTIMPLEMENTED(); | 326 NOTIMPLEMENTED(); |
354 return 0; | 327 return 0; |
355 } | 328 } |
356 | 329 |
357 unsigned WebMediaPlayerAndroid::droppedFrameCount() const { | 330 unsigned WebMediaPlayerAndroid::droppedFrameCount() const { |
358 #if defined(GOOGLE_TV) | |
359 if (media_source_delegate_) | |
360 return media_source_delegate_->DroppedFrameCount(); | |
361 #endif | |
362 NOTIMPLEMENTED(); | 331 NOTIMPLEMENTED(); |
363 return 0; | 332 return 0; |
364 } | 333 } |
365 | 334 |
366 unsigned WebMediaPlayerAndroid::audioDecodedByteCount() const { | 335 unsigned WebMediaPlayerAndroid::audioDecodedByteCount() const { |
367 #if defined(GOOGLE_TV) | |
368 if (media_source_delegate_) | |
369 return media_source_delegate_->AudioDecodedByteCount(); | |
370 #endif | |
371 NOTIMPLEMENTED(); | 336 NOTIMPLEMENTED(); |
372 return 0; | 337 return 0; |
373 } | 338 } |
374 | 339 |
375 unsigned WebMediaPlayerAndroid::videoDecodedByteCount() const { | 340 unsigned WebMediaPlayerAndroid::videoDecodedByteCount() const { |
376 #if defined(GOOGLE_TV) | |
377 if (media_source_delegate_) | |
378 return media_source_delegate_->VideoDecodedByteCount(); | |
379 #endif | |
380 NOTIMPLEMENTED(); | 341 NOTIMPLEMENTED(); |
381 return 0; | 342 return 0; |
382 } | 343 } |
383 | 344 |
384 void WebMediaPlayerAndroid::OnMediaMetadataChanged( | 345 void WebMediaPlayerAndroid::OnMediaMetadataChanged( |
385 base::TimeDelta duration, int width, int height, bool success) { | 346 base::TimeDelta duration, int width, int height, bool success) { |
386 if (url_.SchemeIs("file")) | 347 if (url_.SchemeIs("file")) |
387 UpdateNetworkState(WebMediaPlayer::NetworkStateLoaded); | 348 UpdateNetworkState(WebMediaPlayer::NetworkStateLoaded); |
388 | 349 |
389 if (ready_state_ != WebMediaPlayer::ReadyStateHaveEnoughData) { | 350 if (ready_state_ != WebMediaPlayer::ReadyStateHaveEnoughData) { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
447 break; | 408 break; |
448 } | 409 } |
449 client_->repaint(); | 410 client_->repaint(); |
450 } | 411 } |
451 | 412 |
452 void WebMediaPlayerAndroid::OnVideoSizeChanged(int width, int height) { | 413 void WebMediaPlayerAndroid::OnVideoSizeChanged(int width, int height) { |
453 has_size_info_ = true; | 414 has_size_info_ = true; |
454 if (natural_size_.width == width && natural_size_.height == height) | 415 if (natural_size_.width == width && natural_size_.height == height) |
455 return; | 416 return; |
456 | 417 |
457 #if defined(GOOGLE_TV) | |
458 static bool has_switch = CommandLine::ForCurrentProcess()->HasSwitch( | |
459 switches::kUseExternalVideoSurfaceThresholdInPixels); | |
460 static int threshold = 0; | |
461 static bool parsed_arg = | |
462 has_switch && | |
463 base::StringToInt( | |
464 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | |
465 switches::kUseExternalVideoSurfaceThresholdInPixels), | |
466 &threshold); | |
467 | |
468 if ((parsed_arg && threshold <= width * height) || | |
469 // Use H/W surface for MSE as the content is protected. | |
470 media_source_delegate_) { | |
471 needs_external_surface_ = true; | |
472 SetNeedsEstablishPeer(false); | |
473 if (!paused() && proxy_) | |
474 proxy_->RequestExternalSurface(player_id_); | |
475 } | |
476 #endif | |
477 | |
478 natural_size_.width = width; | 418 natural_size_.width = width; |
479 natural_size_.height = height; | 419 natural_size_.height = height; |
480 ReallocateVideoFrame(); | 420 ReallocateVideoFrame(); |
481 } | 421 } |
482 | 422 |
483 void WebMediaPlayerAndroid::OnTimeUpdate(base::TimeDelta current_time) { | 423 void WebMediaPlayerAndroid::OnTimeUpdate(base::TimeDelta current_time) { |
484 current_time_ = static_cast<float>(current_time.InSecondsF()); | 424 current_time_ = static_cast<float>(current_time.InSecondsF()); |
485 } | 425 } |
486 | 426 |
487 void WebMediaPlayerAndroid::OnDidEnterFullscreen() { | 427 void WebMediaPlayerAndroid::OnDidEnterFullscreen() { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
567 stream_texture_factory_->DestroyStreamTexture(texture_id_); | 507 stream_texture_factory_->DestroyStreamTexture(texture_id_); |
568 stream_id_ = 0; | 508 stream_id_ = 0; |
569 } | 509 } |
570 | 510 |
571 current_frame_ = NULL; | 511 current_frame_ = NULL; |
572 manager_ = NULL; | 512 manager_ = NULL; |
573 proxy_ = NULL; | 513 proxy_ = NULL; |
574 } | 514 } |
575 | 515 |
576 void WebMediaPlayerAndroid::ReallocateVideoFrame() { | 516 void WebMediaPlayerAndroid::ReallocateVideoFrame() { |
577 if (needs_external_surface_) { | 517 if (NeedsExternalSurface()) { |
578 // VideoFrame::CreateHoleFrame is only defined under GOOGLE_TV. | 518 // VideoFrame::CreateHoleFrame is only defined under GOOGLE_TV. |
579 #if defined(GOOGLE_TV) | 519 #if defined(GOOGLE_TV) |
580 if (!natural_size_.isEmpty()) | 520 if (!natural_size_.isEmpty()) |
581 current_frame_ = VideoFrame::CreateHoleFrame(natural_size_); | 521 current_frame_ = VideoFrame::CreateHoleFrame(natural_size_); |
582 #else | 522 #else |
583 NOTIMPLEMENTED() << "Hole punching not supported outside of Google TV"; | 523 NOTIMPLEMENTED() << "Hole punching not supported outside of Google TV"; |
584 #endif | 524 #endif |
585 } else if (texture_id_) { | 525 } else if (texture_id_) { |
586 current_frame_ = VideoFrame::WrapNativeTexture( | 526 current_frame_ = VideoFrame::WrapNativeTexture( |
587 texture_id_, kGLTextureExternalOES, natural_size_, | 527 texture_id_, kGLTextureExternalOES, natural_size_, |
(...skipping 11 matching lines...) Expand all Loading... | |
599 video_frame_provider_client_->StopUsingProvider(); | 539 video_frame_provider_client_->StopUsingProvider(); |
600 video_frame_provider_client_ = client; | 540 video_frame_provider_client_ = client; |
601 | 541 |
602 // Set the callback target when a frame is produced. | 542 // Set the callback target when a frame is produced. |
603 if (stream_texture_proxy_) | 543 if (stream_texture_proxy_) |
604 stream_texture_proxy_->SetClient(client); | 544 stream_texture_proxy_->SetClient(client); |
605 } | 545 } |
606 | 546 |
607 scoped_refptr<media::VideoFrame> WebMediaPlayerAndroid::GetCurrentFrame() { | 547 scoped_refptr<media::VideoFrame> WebMediaPlayerAndroid::GetCurrentFrame() { |
608 if (stream_texture_proxy_ && !stream_texture_proxy_->IsBoundToThread() && | 548 if (stream_texture_proxy_ && !stream_texture_proxy_->IsBoundToThread() && |
609 stream_id_ && !needs_external_surface_) { | 549 stream_id_ && !NeedsExternalSurface()) { |
610 gfx::Size natural_size = current_frame_->natural_size(); | 550 gfx::Size natural_size = current_frame_->natural_size(); |
611 stream_texture_proxy_->BindToCurrentThread( | 551 stream_texture_proxy_->BindToCurrentThread( |
612 stream_id_, natural_size.width(), natural_size.height()); | 552 stream_id_, natural_size.width(), natural_size.height()); |
613 } | 553 } |
614 return current_frame_; | 554 return current_frame_; |
615 } | 555 } |
616 | 556 |
617 void WebMediaPlayerAndroid::PutCurrentFrame( | 557 void WebMediaPlayerAndroid::PutCurrentFrame( |
618 const scoped_refptr<media::VideoFrame>& frame) { | 558 const scoped_refptr<media::VideoFrame>& frame) { |
619 } | 559 } |
(...skipping 26 matching lines...) Expand all Loading... | |
646 } | 586 } |
647 | 587 |
648 // Return false when the geometry hasn't been changed from the last time. | 588 // Return false when the geometry hasn't been changed from the last time. |
649 if (last_computed_rect_ == *rect) | 589 if (last_computed_rect_ == *rect) |
650 return false; | 590 return false; |
651 | 591 |
652 // Store the changed geometry information when it is actually changed. | 592 // Store the changed geometry information when it is actually changed. |
653 last_computed_rect_ = *rect; | 593 last_computed_rect_ = *rect; |
654 return true; | 594 return true; |
655 } | 595 } |
656 | |
657 WebMediaPlayer::MediaKeyException | |
658 WebMediaPlayerAndroid::generateKeyRequest(const WebString& key_system, | |
659 const unsigned char* init_data, | |
660 unsigned init_data_length) { | |
661 if (media_source_delegate_) { | |
662 return media_source_delegate_->GenerateKeyRequest( | |
663 key_system, init_data, init_data_length); | |
664 } | |
665 return MediaKeyExceptionKeySystemNotSupported; | |
666 } | |
667 | |
668 WebMediaPlayer::MediaKeyException WebMediaPlayerAndroid::addKey( | |
669 const WebString& key_system, | |
670 const unsigned char* key, | |
671 unsigned key_length, | |
672 const unsigned char* init_data, | |
673 unsigned init_data_length, | |
674 const WebString& session_id) { | |
675 if (media_source_delegate_) { | |
676 return media_source_delegate_->AddKey( | |
677 key_system, key, key_length, init_data, init_data_length, session_id); | |
678 } | |
679 return MediaKeyExceptionKeySystemNotSupported; | |
680 } | |
681 | |
682 WebMediaPlayer::MediaKeyException WebMediaPlayerAndroid::cancelKeyRequest( | |
683 const WebString& key_system, | |
684 const WebString& session_id) { | |
685 if (media_source_delegate_) | |
686 return media_source_delegate_->CancelKeyRequest(key_system, session_id); | |
687 return MediaKeyExceptionKeySystemNotSupported; | |
688 } | |
689 | |
690 void WebMediaPlayerAndroid::OnReadFromDemuxer( | |
691 media::DemuxerStream::Type type, bool seek_done) { | |
692 if (media_source_delegate_) | |
693 media_source_delegate_->OnReadFromDemuxer(type, seek_done); | |
694 else | |
695 NOTIMPLEMENTED(); | |
696 } | |
697 #endif | 596 #endif |
698 | 597 |
699 void WebMediaPlayerAndroid::enterFullscreen() { | 598 void WebMediaPlayerAndroid::enterFullscreen() { |
700 if (proxy_ && manager_->CanEnterFullscreen(frame_)) { | 599 if (proxy_ && manager_->CanEnterFullscreen(frame_)) { |
701 proxy_->EnterFullscreen(player_id_); | 600 proxy_->EnterFullscreen(player_id_); |
702 SetNeedsEstablishPeer(false); | 601 SetNeedsEstablishPeer(false); |
703 } | 602 } |
704 } | 603 } |
705 | 604 |
706 void WebMediaPlayerAndroid::exitFullscreen() { | 605 void WebMediaPlayerAndroid::exitFullscreen() { |
707 if (proxy_) | 606 if (proxy_) |
708 proxy_->ExitFullscreen(player_id_); | 607 proxy_->ExitFullscreen(player_id_); |
709 } | 608 } |
710 | 609 |
711 bool WebMediaPlayerAndroid::canEnterFullscreen() const { | 610 bool WebMediaPlayerAndroid::canEnterFullscreen() const { |
712 return manager_->CanEnterFullscreen(frame_); | 611 return manager_->CanEnterFullscreen(frame_); |
713 } | 612 } |
714 | 613 |
614 bool WebMediaPlayerAndroid::NeedsExternalSurface() { | |
615 return needs_external_surface_; | |
616 } | |
617 | |
618 void WebMediaPlayerAndroid::SetNeedsExternalSurface( | |
619 bool needs_external_surface) { | |
620 needs_external_surface_ = needs_external_surface; | |
621 } | |
622 | |
715 } // namespace webkit_media | 623 } // namespace webkit_media |
OLD | NEW |