Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Side by Side Diff: chromecast/common/media/cast_media_client.cc

Issue 2156193003: [Chromecast] Add a custom CastMediaClient for Chromecast (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@codecs
Patch Set: rebase Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 #include "chromecast/common/media/cast_media_client.h"
6
7 #include "base/lazy_instance.h"
8 #include "chromecast/media/base/media_codec_support.h"
9 #include "chromecast/public/media/media_capabilities_shlib.h"
10
11 // TODO(servolk): Is there a better way to override just IsSupportedVideoConfig
12 // without duplicating content::RenderMediaClient implementation?
13 // For now use this to allow access to the ::media::GetMediaClient.
14 namespace media {
15 MEDIA_EXPORT MediaClient* GetMediaClient();
16 }
17
18 namespace chromecast {
19 namespace media {
20
21 static base::LazyInstance<CastMediaClient>::Leaky g_cast_media_client =
22 LAZY_INSTANCE_INITIALIZER;
23
24 void CastMediaClient::Initialize() {
25 g_cast_media_client.Get();
26 }
27
28 CastMediaClient::CastMediaClient() {
29 content_media_client_ = ::media::GetMediaClient();
30 // Ensure that CastMediaClient gets initialized after the
31 // content::RenderMediaClient.
32 DCHECK(content_media_client_);
33 ::media::SetMediaClient(this);
34 }
35
36 CastMediaClient::~CastMediaClient() {}
37
38 void CastMediaClient::AddKeySystemsInfoForUMA(
39 std::vector<::media::KeySystemInfoForUMA>* key_systems_info_for_uma) {
40 content_media_client_->AddKeySystemsInfoForUMA(key_systems_info_for_uma);
41 }
42
43 bool CastMediaClient::IsKeySystemsUpdateNeeded() {
44 return content_media_client_->IsKeySystemsUpdateNeeded();
45 }
46
47 void CastMediaClient::AddSupportedKeySystems(
48 std::vector<std::unique_ptr<::media::KeySystemProperties>>*
49 key_systems_properties) {
50 content_media_client_->AddSupportedKeySystems(key_systems_properties);
51 }
52
53 void CastMediaClient::RecordRapporURL(const std::string& metric,
54 const GURL& url) {
55 content_media_client_->RecordRapporURL(metric, url);
56 }
57
58 // static
59 bool CastMediaClient::IsSupportedVideoConfig(::media::VideoCodec codec,
60 ::media::VideoCodecProfile profile,
61 int level) {
62 if (MediaCapabilitiesShlib::IsSupportedVideoConfig) {
63 return MediaCapabilitiesShlib::IsSupportedVideoConfig(
64 ToCastVideoCodec(codec), ToCastVideoProfile(profile), level);
65 }
66 LOG(WARNING) << __FUNCTION__
67 << " using default MediaClient::IsSupportedVideoConfig impl";
68 if (codec == ::media::kCodecH264 || codec == ::media::kCodecVP8)
69 return true;
70 return false;
71 }
72
73 } // namespace media
74 } // namespace chromecast
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698