| 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 16 matching lines...) Expand all Loading... |
| 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_codec_player.h" | 32 #include "media/base/android/media_codec_player.h" |
| 33 #include "media/base/android/media_player_bridge.h" | 33 #include "media/base/android/media_player_bridge.h" |
| 34 #include "media/base/android/media_source_player.h" | 34 #include "media/base/android/media_source_player.h" |
| 35 #include "media/base/android/media_task_runner.h" | 35 #include "media/base/android/media_task_runner.h" |
| 36 #include "media/base/android/media_url_interceptor.h" | 36 #include "media/base/android/media_url_interceptor.h" |
| 37 #include "media/base/media_content_type.h" |
| 37 | 38 |
| 38 #if !defined(USE_AURA) | 39 #if !defined(USE_AURA) |
| 39 #include "content/browser/android/content_view_core_impl.h" | 40 #include "content/browser/android/content_view_core_impl.h" |
| 40 #include "content/browser/renderer_host/render_widget_host_view_android.h" | 41 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
| 41 #endif | 42 #endif |
| 42 | 43 |
| 43 using media::MediaCodecPlayer; | 44 using media::MediaCodecPlayer; |
| 44 using media::MediaPlayerAndroid; | 45 using media::MediaPlayerAndroid; |
| 45 using media::MediaPlayerBridge; | 46 using media::MediaPlayerBridge; |
| 46 using media::MediaPlayerManager; | 47 using media::MediaPlayerManager; |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 } | 450 } |
| 450 | 451 |
| 451 bool BrowserMediaPlayerManager::RequestPlay(int player_id, | 452 bool BrowserMediaPlayerManager::RequestPlay(int player_id, |
| 452 base::TimeDelta duration, | 453 base::TimeDelta duration, |
| 453 bool has_audio) { | 454 bool has_audio) { |
| 454 DCHECK(player_id_to_delegate_id_map_.find(player_id) != | 455 DCHECK(player_id_to_delegate_id_map_.find(player_id) != |
| 455 player_id_to_delegate_id_map_.end()); | 456 player_id_to_delegate_id_map_.end()); |
| 456 return MediaWebContentsObserverAndroid::FromWebContents(web_contents_) | 457 return MediaWebContentsObserverAndroid::FromWebContents(web_contents_) |
| 457 ->RequestPlay(render_frame_host_, | 458 ->RequestPlay(render_frame_host_, |
| 458 player_id_to_delegate_id_map_[player_id], has_audio, | 459 player_id_to_delegate_id_map_[player_id], has_audio, |
| 459 IsPlayingRemotely(player_id), duration); | 460 IsPlayingRemotely(player_id), |
| 461 media::DurationToMediaContentType(duration)); |
| 460 } | 462 } |
| 461 | 463 |
| 462 #if defined(VIDEO_HOLE) | 464 #if defined(VIDEO_HOLE) |
| 463 void BrowserMediaPlayerManager::AttachExternalVideoSurface(int player_id, | 465 void BrowserMediaPlayerManager::AttachExternalVideoSurface(int player_id, |
| 464 jobject surface) { | 466 jobject surface) { |
| 465 MediaPlayerAndroid* player = GetPlayer(player_id); | 467 MediaPlayerAndroid* player = GetPlayer(player_id); |
| 466 if (player) { | 468 if (player) { |
| 467 player->SetVideoSurface( | 469 player->SetVideoSurface( |
| 468 gl::ScopedJavaSurface::AcquireExternalSurface(surface)); | 470 gl::ScopedJavaSurface::AcquireExternalSurface(surface)); |
| 469 } | 471 } |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 797 if (!player) | 799 if (!player) |
| 798 return; | 800 return; |
| 799 player->Start(); | 801 player->Start(); |
| 800 if (fullscreen_player_id_ == player_id && fullscreen_player_is_released_) { | 802 if (fullscreen_player_id_ == player_id && fullscreen_player_is_released_) { |
| 801 video_view_->OpenVideo(); | 803 video_view_->OpenVideo(); |
| 802 fullscreen_player_is_released_ = false; | 804 fullscreen_player_is_released_ = false; |
| 803 } | 805 } |
| 804 } | 806 } |
| 805 | 807 |
| 806 } // namespace content | 808 } // namespace content |
| OLD | NEW |