| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/android/scoped_java_ref.h" | 9 #include "base/android/scoped_java_ref.h" |
| 10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #include "content/public/browser/render_view_host.h" | 25 #include "content/public/browser/render_view_host.h" |
| 26 #include "content/public/browser/storage_partition.h" | 26 #include "content/public/browser/storage_partition.h" |
| 27 #include "content/public/browser/web_contents.h" | 27 #include "content/public/browser/web_contents.h" |
| 28 #include "content/public/browser/web_contents_delegate.h" | 28 #include "content/public/browser/web_contents_delegate.h" |
| 29 #include "content/public/common/content_client.h" | 29 #include "content/public/common/content_client.h" |
| 30 #include "content/public/common/content_switches.h" | 30 #include "content/public/common/content_switches.h" |
| 31 #include "gpu/ipc/common/android/surface_texture_peer.h" | 31 #include "gpu/ipc/common/android/surface_texture_peer.h" |
| 32 #include "media/base/android/media_player_bridge.h" | 32 #include "media/base/android/media_player_bridge.h" |
| 33 #include "media/base/android/media_source_player.h" | 33 #include "media/base/android/media_source_player.h" |
| 34 #include "media/base/android/media_url_interceptor.h" | 34 #include "media/base/android/media_url_interceptor.h" |
| 35 #include "media/base/media_content_type.h" |
| 35 | 36 |
| 36 #if !defined(USE_AURA) | 37 #if !defined(USE_AURA) |
| 37 #include "content/browser/android/content_view_core_impl.h" | 38 #include "content/browser/android/content_view_core_impl.h" |
| 38 #include "content/browser/renderer_host/render_widget_host_view_android.h" | 39 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
| 39 #endif | 40 #endif |
| 40 | 41 |
| 41 using media::MediaPlayerAndroid; | 42 using media::MediaPlayerAndroid; |
| 42 using media::MediaPlayerBridge; | 43 using media::MediaPlayerBridge; |
| 43 using media::MediaPlayerManager; | 44 using media::MediaPlayerManager; |
| 44 using media::MediaSourcePlayer; | 45 using media::MediaSourcePlayer; |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 } | 436 } |
| 436 | 437 |
| 437 bool BrowserMediaPlayerManager::RequestPlay(int player_id, | 438 bool BrowserMediaPlayerManager::RequestPlay(int player_id, |
| 438 base::TimeDelta duration, | 439 base::TimeDelta duration, |
| 439 bool has_audio) { | 440 bool has_audio) { |
| 440 DCHECK(player_id_to_delegate_id_map_.find(player_id) != | 441 DCHECK(player_id_to_delegate_id_map_.find(player_id) != |
| 441 player_id_to_delegate_id_map_.end()); | 442 player_id_to_delegate_id_map_.end()); |
| 442 return MediaWebContentsObserverAndroid::FromWebContents(web_contents_) | 443 return MediaWebContentsObserverAndroid::FromWebContents(web_contents_) |
| 443 ->RequestPlay(render_frame_host_, | 444 ->RequestPlay(render_frame_host_, |
| 444 player_id_to_delegate_id_map_[player_id], has_audio, | 445 player_id_to_delegate_id_map_[player_id], has_audio, |
| 445 IsPlayingRemotely(player_id), duration); | 446 IsPlayingRemotely(player_id), |
| 447 media::DurationToMediaContentType(duration)); |
| 446 } | 448 } |
| 447 | 449 |
| 448 #if defined(VIDEO_HOLE) | 450 #if defined(VIDEO_HOLE) |
| 449 void BrowserMediaPlayerManager::AttachExternalVideoSurface(int player_id, | 451 void BrowserMediaPlayerManager::AttachExternalVideoSurface(int player_id, |
| 450 jobject surface) { | 452 jobject surface) { |
| 451 MediaPlayerAndroid* player = GetPlayer(player_id); | 453 MediaPlayerAndroid* player = GetPlayer(player_id); |
| 452 if (player) { | 454 if (player) { |
| 453 player->SetVideoSurface( | 455 player->SetVideoSurface( |
| 454 gl::ScopedJavaSurface::AcquireExternalSurface(surface)); | 456 gl::ScopedJavaSurface::AcquireExternalSurface(surface)); |
| 455 } | 457 } |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 793 if (!player) | 795 if (!player) |
| 794 return; | 796 return; |
| 795 player->Start(); | 797 player->Start(); |
| 796 if (fullscreen_player_id_ == player_id && fullscreen_player_is_released_) { | 798 if (fullscreen_player_id_ == player_id && fullscreen_player_is_released_) { |
| 797 video_view_->OpenVideo(); | 799 video_view_->OpenVideo(); |
| 798 fullscreen_player_is_released_ = false; | 800 fullscreen_player_is_released_ = false; |
| 799 } | 801 } |
| 800 } | 802 } |
| 801 | 803 |
| 802 } // namespace content | 804 } // namespace content |
| OLD | NEW |