| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // TODO(servolk): Is there a better way to override just IsSupportedVideoConfig |
| 6 // without duplicating content::RenderMediaClient implementation? |
| 7 // For now define MEDIA_IMPLEMENTATION to be able to access the default media |
| 8 // client via ::media::GetMediaClient. |
| 9 #define MEDIA_IMPLEMENTATION |
| 10 |
| 11 #include "chromecast/common/media/cast_media_client.h" |
| 12 |
| 13 #include "base/lazy_instance.h" |
| 14 #include "chromecast/media/base/media_codec_support.h" |
| 15 #include "chromecast/public/media_codec_support_shlib.h" |
| 16 |
| 17 namespace chromecast { |
| 18 namespace media { |
| 19 |
| 20 static base::LazyInstance<CastMediaClient>::Leaky g_cast_media_client = |
| 21 LAZY_INSTANCE_INITIALIZER; |
| 22 |
| 23 void CastMediaClient::Initialize() { |
| 24 g_cast_media_client.Get(); |
| 25 } |
| 26 |
| 27 CastMediaClient::CastMediaClient() { |
| 28 content_media_client_ = ::media::GetMediaClient(); |
| 29 // Ensure that CastMediaClient gets initialized after the |
| 30 // content::RenderMediaClient. |
| 31 DCHECK(content_media_client_); |
| 32 ::media::SetMediaClient(this); |
| 33 } |
| 34 |
| 35 CastMediaClient::~CastMediaClient() {} |
| 36 |
| 37 void CastMediaClient::AddKeySystemsInfoForUMA( |
| 38 std::vector<::media::KeySystemInfoForUMA>* key_systems_info_for_uma) { |
| 39 content_media_client_->AddKeySystemsInfoForUMA(key_systems_info_for_uma); |
| 40 } |
| 41 |
| 42 bool CastMediaClient::IsKeySystemsUpdateNeeded() { |
| 43 return content_media_client_->IsKeySystemsUpdateNeeded(); |
| 44 } |
| 45 |
| 46 void CastMediaClient::AddSupportedKeySystems( |
| 47 std::vector<std::unique_ptr<::media::KeySystemProperties>>* |
| 48 key_systems_properties) { |
| 49 content_media_client_->AddSupportedKeySystems(key_systems_properties); |
| 50 } |
| 51 |
| 52 void CastMediaClient::RecordRapporURL(const std::string& metric, |
| 53 const GURL& url) { |
| 54 content_media_client_->RecordRapporURL(metric, url); |
| 55 } |
| 56 |
| 57 // static |
| 58 bool CastMediaClient::IsSupportedVideoConfig(::media::VideoCodec codec, |
| 59 ::media::VideoCodecProfile profile, |
| 60 int level) { |
| 61 return MediaCapabilitiesShlib::IsSupportedVideoConfig( |
| 62 ToCastVideoCodec(codec), ToCastVideoProfile(profile), level); |
| 63 } |
| 64 |
| 65 } // namespace media |
| 66 } // namespace chromecast |
| OLD | NEW |