| 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/android/scoped_java_ref.h" | 7 #include "base/android/scoped_java_ref.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 11 matching lines...) Expand all Loading... |
| 22 #include "content/public/browser/render_process_host.h" | 22 #include "content/public/browser/render_process_host.h" |
| 23 #include "content/public/browser/render_view_host.h" | 23 #include "content/public/browser/render_view_host.h" |
| 24 #include "content/public/browser/storage_partition.h" | 24 #include "content/public/browser/storage_partition.h" |
| 25 #include "content/public/browser/web_contents.h" | 25 #include "content/public/browser/web_contents.h" |
| 26 #include "content/public/browser/web_contents_delegate.h" | 26 #include "content/public/browser/web_contents_delegate.h" |
| 27 #include "content/public/common/content_client.h" | 27 #include "content/public/common/content_client.h" |
| 28 #include "content/public/common/content_switches.h" | 28 #include "content/public/common/content_switches.h" |
| 29 #include "media/base/android/media_codec_player.h" | 29 #include "media/base/android/media_codec_player.h" |
| 30 #include "media/base/android/media_player_bridge.h" | 30 #include "media/base/android/media_player_bridge.h" |
| 31 #include "media/base/android/media_source_player.h" | 31 #include "media/base/android/media_source_player.h" |
| 32 #include "media/base/android/media_task_runner.h" |
| 32 #include "media/base/android/media_url_interceptor.h" | 33 #include "media/base/android/media_url_interceptor.h" |
| 33 | 34 |
| 34 using media::MediaCodecPlayer; | 35 using media::MediaCodecPlayer; |
| 35 using media::MediaPlayerAndroid; | 36 using media::MediaPlayerAndroid; |
| 36 using media::MediaPlayerBridge; | 37 using media::MediaPlayerBridge; |
| 37 using media::MediaPlayerManager; | 38 using media::MediaPlayerManager; |
| 38 using media::MediaSourcePlayer; | 39 using media::MediaSourcePlayer; |
| 39 | 40 |
| 40 namespace content { | 41 namespace content { |
| 41 | 42 |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 OnMediaMetadataChanged( | 158 OnMediaMetadataChanged( |
| 158 media_player_params.player_id, base::TimeDelta(), 0, 0, false); | 159 media_player_params.player_id, base::TimeDelta(), 0, 0, false); |
| 159 } else if (!content_view_core_impl->ShouldBlockMediaRequest( | 160 } else if (!content_view_core_impl->ShouldBlockMediaRequest( |
| 160 media_player_params.url)) { | 161 media_player_params.url)) { |
| 161 media_player_bridge->Initialize(); | 162 media_player_bridge->Initialize(); |
| 162 } | 163 } |
| 163 return media_player_bridge; | 164 return media_player_bridge; |
| 164 } | 165 } |
| 165 | 166 |
| 166 case MEDIA_PLAYER_TYPE_MEDIA_SOURCE: { | 167 case MEDIA_PLAYER_TYPE_MEDIA_SOURCE: { |
| 167 if (MediaPlayerAndroid::UseMediaThread()) { | 168 if (media::UseMediaThreadForMediaPlayback()) { |
| 168 return new MediaCodecPlayer( | 169 return new MediaCodecPlayer( |
| 169 media_player_params.player_id, | 170 media_player_params.player_id, |
| 170 weak_ptr_factory_.GetWeakPtr(), | 171 weak_ptr_factory_.GetWeakPtr(), |
| 171 base::Bind(&BrowserMediaPlayerManager::OnMediaResourcesRequested, | 172 base::Bind(&BrowserMediaPlayerManager::OnMediaResourcesRequested, |
| 172 weak_ptr_factory_.GetWeakPtr()), | 173 weak_ptr_factory_.GetWeakPtr()), |
| 173 demuxer->CreateDemuxer(media_player_params.demuxer_client_id), | 174 demuxer->CreateDemuxer(media_player_params.demuxer_client_id), |
| 174 media_player_params.frame_url); | 175 media_player_params.frame_url); |
| 175 } else { | 176 } else { |
| 176 return new MediaSourcePlayer( | 177 return new MediaSourcePlayer( |
| 177 media_player_params.player_id, | 178 media_player_params.player_id, |
| (...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 external_video_surface_container_->ReleaseExternalVideoSurface(player_id); | 679 external_video_surface_container_->ReleaseExternalVideoSurface(player_id); |
| 679 #endif // defined(VIDEO_HOLE) | 680 #endif // defined(VIDEO_HOLE) |
| 680 } | 681 } |
| 681 | 682 |
| 682 void BrowserMediaPlayerManager::ReleasePlayer(MediaPlayerAndroid* player) { | 683 void BrowserMediaPlayerManager::ReleasePlayer(MediaPlayerAndroid* player) { |
| 683 player->Release(); | 684 player->Release(); |
| 684 ReleaseMediaResources(player->player_id()); | 685 ReleaseMediaResources(player->player_id()); |
| 685 } | 686 } |
| 686 | 687 |
| 687 } // namespace content | 688 } // namespace content |
| OLD | NEW |