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> |
| 8 |
7 #include "base/android/scoped_java_ref.h" | 9 #include "base/android/scoped_java_ref.h" |
8 #include "content/browser/frame_host/render_frame_host_impl.h" | 10 #include "content/browser/frame_host/render_frame_host_impl.h" |
9 #include "content/browser/media/android/browser_demuxer_android.h" | 11 #include "content/browser/media/android/browser_demuxer_android.h" |
10 #include "content/browser/media/android/media_resource_getter_impl.h" | 12 #include "content/browser/media/android/media_resource_getter_impl.h" |
11 #include "content/browser/media/android/media_session.h" | 13 #include "content/browser/media/android/media_session.h" |
12 #include "content/browser/media/android/media_throttler.h" | 14 #include "content/browser/media/android/media_throttler.h" |
13 #include "content/browser/media/media_web_contents_observer.h" | 15 #include "content/browser/media/media_web_contents_observer.h" |
14 #include "content/browser/renderer_host/render_view_host_impl.h" | 16 #include "content/browser/renderer_host/render_view_host_impl.h" |
15 #include "content/browser/web_contents/web_contents_impl.h" | 17 #include "content/browser/web_contents/web_contents_impl.h" |
16 #include "content/common/media/media_player_messages_android.h" | 18 #include "content/common/media/media_player_messages_android.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 } | 113 } |
112 | 114 |
113 media::MediaPlayerAndroid* player = player_manager->GetPlayer(player_id); | 115 media::MediaPlayerAndroid* player = player_manager->GetPlayer(player_id); |
114 if (!player) { | 116 if (!player) { |
115 DVLOG(1) << "Cannot find media player for player_id " << player_id; | 117 DVLOG(1) << "Cannot find media player for player_id " << player_id; |
116 return; | 118 return; |
117 } | 119 } |
118 | 120 |
119 if (player != player_manager->GetFullscreenPlayer()) { | 121 if (player != player_manager->GetFullscreenPlayer()) { |
120 gfx::ScopedJavaSurface scoped_surface(surface_texture.get()); | 122 gfx::ScopedJavaSurface scoped_surface(surface_texture.get()); |
121 player->SetVideoSurface(scoped_surface.Pass()); | 123 player->SetVideoSurface(std::move(scoped_surface)); |
122 } | 124 } |
123 } | 125 } |
124 | 126 |
125 // static | 127 // static |
126 BrowserMediaPlayerManager* BrowserMediaPlayerManager::Create( | 128 BrowserMediaPlayerManager* BrowserMediaPlayerManager::Create( |
127 RenderFrameHost* rfh) { | 129 RenderFrameHost* rfh) { |
128 if (g_factory) | 130 if (g_factory) |
129 return g_factory(rfh); | 131 return g_factory(rfh); |
130 return new BrowserMediaPlayerManager(rfh); | 132 return new BrowserMediaPlayerManager(rfh); |
131 } | 133 } |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 RoutingID(), player_id, current_timestamp, current_time_ticks)); | 274 RoutingID(), player_id, current_timestamp, current_time_ticks)); |
273 } | 275 } |
274 | 276 |
275 void BrowserMediaPlayerManager::SetVideoSurface( | 277 void BrowserMediaPlayerManager::SetVideoSurface( |
276 gfx::ScopedJavaSurface surface) { | 278 gfx::ScopedJavaSurface surface) { |
277 MediaPlayerAndroid* player = GetFullscreenPlayer(); | 279 MediaPlayerAndroid* player = GetFullscreenPlayer(); |
278 if (!player) | 280 if (!player) |
279 return; | 281 return; |
280 | 282 |
281 bool empty_surface = surface.IsEmpty(); | 283 bool empty_surface = surface.IsEmpty(); |
282 player->SetVideoSurface(surface.Pass()); | 284 player->SetVideoSurface(std::move(surface)); |
283 if (empty_surface) | 285 if (empty_surface) |
284 return; | 286 return; |
285 | 287 |
286 #if !defined(USE_AURA) | 288 #if !defined(USE_AURA) |
287 if (RenderWidgetHostViewAndroid* view_android = | 289 if (RenderWidgetHostViewAndroid* view_android = |
288 static_cast<RenderWidgetHostViewAndroid*>( | 290 static_cast<RenderWidgetHostViewAndroid*>( |
289 web_contents_->GetRenderWidgetHostView())) { | 291 web_contents_->GetRenderWidgetHostView())) { |
290 view_android->SetOverlayVideoMode(true); | 292 view_android->SetOverlayVideoMode(true); |
291 } | 293 } |
292 #endif | 294 #endif |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
764 if (!player) | 766 if (!player) |
765 return; | 767 return; |
766 player->Start(); | 768 player->Start(); |
767 if (fullscreen_player_id_ == player_id && fullscreen_player_is_released_) { | 769 if (fullscreen_player_id_ == player_id && fullscreen_player_is_released_) { |
768 video_view_->OpenVideo(); | 770 video_view_->OpenVideo(); |
769 fullscreen_player_is_released_ = false; | 771 fullscreen_player_is_released_ = false; |
770 } | 772 } |
771 } | 773 } |
772 | 774 |
773 } // namespace content | 775 } // namespace content |
OLD | NEW |