OLD | NEW |
---|---|
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/browser/media/android/browser_media_player_manager.h" | 5 #include "content/browser/media/android/browser_media_player_manager.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "content/browser/android/content_view_core_impl.h" | 8 #include "content/browser/android/content_view_core_impl.h" |
9 #include "content/browser/media/android/browser_demuxer_android.h" | 9 #include "content/browser/media/android/browser_demuxer_android.h" |
10 #include "content/browser/media/android/media_resource_getter_impl.h" | 10 #include "content/browser/media/android/media_resource_getter_impl.h" |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
460 gfx::ScopedJavaSurface::AcquireExternalSurface(surface)); | 460 gfx::ScopedJavaSurface::AcquireExternalSurface(surface)); |
461 } | 461 } |
462 } | 462 } |
463 | 463 |
464 void BrowserMediaPlayerManager::DetachExternalVideoSurface(int player_id) { | 464 void BrowserMediaPlayerManager::DetachExternalVideoSurface(int player_id) { |
465 MediaPlayerAndroid* player = GetPlayer(player_id); | 465 MediaPlayerAndroid* player = GetPlayer(player_id); |
466 if (player) | 466 if (player) |
467 player->SetVideoSurface(gfx::ScopedJavaSurface()); | 467 player->SetVideoSurface(gfx::ScopedJavaSurface()); |
468 } | 468 } |
469 | 469 |
470 void BrowserMediaPlayerManager::ReleaseExternalVideoSurface(int player_id) { | |
471 WebContentsViewAndroid* view = | |
472 static_cast<WebContentsViewAndroid*>(web_contents_->GetView()); | |
473 if (view) | |
474 view->NotifyExternalSurface(player_id, false, gfx::RectF()); | |
475 } | |
476 | |
470 void BrowserMediaPlayerManager::OnNotifyExternalSurface( | 477 void BrowserMediaPlayerManager::OnNotifyExternalSurface( |
471 int player_id, bool is_request, const gfx::RectF& rect) { | 478 int player_id, bool is_request, const gfx::RectF& rect) { |
472 if (!web_contents_) | 479 if (!web_contents_) |
473 return; | 480 return; |
474 | 481 |
475 WebContentsViewAndroid* view = | 482 WebContentsViewAndroid* view = |
476 static_cast<WebContentsViewAndroid*>(web_contents_->GetView()); | 483 static_cast<WebContentsViewAndroid*>(web_contents_->GetView()); |
477 if (view) | 484 if (view) |
478 view->NotifyExternalSurface(player_id, is_request, rect); | 485 view->NotifyExternalSurface(player_id, is_request, rect); |
479 } | 486 } |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
567 if (player) | 574 if (player) |
568 player->SetVolume(volume); | 575 player->SetVolume(volume); |
569 } | 576 } |
570 | 577 |
571 void BrowserMediaPlayerManager::OnReleaseResources(int player_id) { | 578 void BrowserMediaPlayerManager::OnReleaseResources(int player_id) { |
572 MediaPlayerAndroid* player = GetPlayer(player_id); | 579 MediaPlayerAndroid* player = GetPlayer(player_id); |
573 if (player) | 580 if (player) |
574 player->Release(); | 581 player->Release(); |
575 | 582 |
576 #if defined(VIDEO_HOLE) | 583 #if defined(VIDEO_HOLE) |
577 WebContentsViewAndroid* view = | 584 ReleaseExternalVideoSurface(player_id); |
578 static_cast<WebContentsViewAndroid*>(web_contents_->GetView()); | |
579 if (view) | |
580 view->NotifyExternalSurface(player_id, false, gfx::RectF()); | |
581 #endif // defined(VIDEO_HOLE) | 585 #endif // defined(VIDEO_HOLE) |
582 } | 586 } |
583 | 587 |
584 void BrowserMediaPlayerManager::OnDestroyPlayer(int player_id) { | 588 void BrowserMediaPlayerManager::OnDestroyPlayer(int player_id) { |
589 #if defined(VIDEO_HOLE) | |
590 ReleaseExternalVideoSurface(player_id); | |
boliu
2014/01/24 21:56:32
Maybe question for the media owners.
Why is this
ycheo (away)
2014/01/28 13:08:53
OnDestoryPlayer doesn't call OnReleaseResources.
@
qinmin
2014/01/28 21:17:05
OnReleaseResources happens at tab switching, or ap
| |
591 #endif // defined(VIDEO_HOLE) | |
592 | |
585 RemovePlayer(player_id); | 593 RemovePlayer(player_id); |
586 if (fullscreen_player_id_ == player_id) | 594 if (fullscreen_player_id_ == player_id) |
587 fullscreen_player_id_ = -1; | 595 fullscreen_player_id_ = -1; |
588 } | 596 } |
589 | 597 |
590 void BrowserMediaPlayerManager::OnInitializeCDM( | 598 void BrowserMediaPlayerManager::OnInitializeCDM( |
591 int media_keys_id, | 599 int media_keys_id, |
592 const std::vector<uint8>& uuid, | 600 const std::vector<uint8>& uuid, |
593 const GURL& frame_url) { | 601 const GURL& frame_url) { |
594 if (uuid.size() != kEmeUuidSize) { | 602 if (uuid.size() != kEmeUuidSize) { |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
834 if (pending_fullscreen_player_id_ != media_keys_id) | 842 if (pending_fullscreen_player_id_ != media_keys_id) |
835 return; | 843 return; |
836 | 844 |
837 pending_fullscreen_player_id_ = -1; | 845 pending_fullscreen_player_id_ = -1; |
838 MediaPlayerAndroid* player = GetPlayer(media_keys_id); | 846 MediaPlayerAndroid* player = GetPlayer(media_keys_id); |
839 if (player->IsPlaying()) | 847 if (player->IsPlaying()) |
840 OnProtectedSurfaceRequested(media_keys_id); | 848 OnProtectedSurfaceRequested(media_keys_id); |
841 } | 849 } |
842 | 850 |
843 } // namespace content | 851 } // namespace content |
OLD | NEW |