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 "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "content/browser/android/content_view_core_impl.h" | 9 #include "content/browser/android/content_view_core_impl.h" |
10 #include "content/browser/android/media_players_observer.h" | 10 #include "content/browser/android/media_players_observer.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 // Threshold on the number of media players per renderer before we start | 40 // Threshold on the number of media players per renderer before we start |
41 // attempting to release inactive media players. | 41 // attempting to release inactive media players. |
42 const int kMediaPlayerThreshold = 1; | 42 const int kMediaPlayerThreshold = 1; |
43 const int kInvalidMediaPlayerId = -1; | 43 const int kInvalidMediaPlayerId = -1; |
44 | 44 |
45 static BrowserMediaPlayerManager::Factory g_factory = NULL; | 45 static BrowserMediaPlayerManager::Factory g_factory = NULL; |
46 static media::MediaUrlInterceptor* media_url_interceptor_ = NULL; | 46 static media::MediaUrlInterceptor* media_url_interceptor_ = NULL; |
47 | 47 |
48 // static | 48 // static |
49 void BrowserMediaPlayerManager::RegisterFactory(Factory factory) { | 49 void BrowserMediaPlayerManager::RegisterFactory(Factory factory) { |
50 g_factory = factory; | 50 // TODO(aberent) nullptr test is a temporary fix to simplify upstreaming Cast. |
| 51 // Until Cast is fully upstreamed we want the downstream factory to take |
| 52 // priority over the upstream factory. The downstream call happens first, |
| 53 // so this will ensure that it does. |
| 54 if (g_factory == nullptr) |
| 55 g_factory = factory; |
51 } | 56 } |
52 | 57 |
53 // static | 58 // static |
54 void BrowserMediaPlayerManager::RegisterMediaUrlInterceptor( | 59 void BrowserMediaPlayerManager::RegisterMediaUrlInterceptor( |
55 media::MediaUrlInterceptor* media_url_interceptor) { | 60 media::MediaUrlInterceptor* media_url_interceptor) { |
56 media_url_interceptor_ = media_url_interceptor; | 61 media_url_interceptor_ = media_url_interceptor; |
57 } | 62 } |
58 | 63 |
59 // static | 64 // static |
60 BrowserMediaPlayerManager* BrowserMediaPlayerManager::Create( | 65 BrowserMediaPlayerManager* BrowserMediaPlayerManager::Create( |
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
601 external_video_surface_container_->ReleaseExternalVideoSurface(player_id); | 606 external_video_surface_container_->ReleaseExternalVideoSurface(player_id); |
602 #endif // defined(VIDEO_HOLE) | 607 #endif // defined(VIDEO_HOLE) |
603 } | 608 } |
604 | 609 |
605 void BrowserMediaPlayerManager::ReleasePlayer(MediaPlayerAndroid* player) { | 610 void BrowserMediaPlayerManager::ReleasePlayer(MediaPlayerAndroid* player) { |
606 player->Release(); | 611 player->Release(); |
607 ReleaseMediaResources(player->player_id()); | 612 ReleaseMediaResources(player->player_id()); |
608 } | 613 } |
609 | 614 |
610 } // namespace content | 615 } // namespace content |
OLD | NEW |