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

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

Issue 2466463005: Support (E)AC3 passthrough
Patch Set: Improve CastMediaClient::IsSupportedPassthroughAudio() Created 4 years, 1 month 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 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 "chromecast/common/media/cast_media_client.h" 5 #include "chromecast/common/media/cast_media_client.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "chromecast/media/base/media_caps.h"
8 #include "chromecast/media/base/media_codec_support.h" 9 #include "chromecast/media/base/media_codec_support.h"
9 #include "chromecast/public/media/media_capabilities_shlib.h" 10 #include "chromecast/public/media/media_capabilities_shlib.h"
10 11
11 // TODO(servolk): Is there a better way to override just IsSupportedVideoConfig 12 // TODO(servolk): Is there a better way to override just IsSupportedVideoConfig
12 // without duplicating content::RenderMediaClient implementation? 13 // without duplicating content::RenderMediaClient implementation?
13 // For now use this to allow access to the ::media::GetMediaClient. 14 // For now use this to allow access to the ::media::GetMediaClient.
14 namespace media { 15 namespace media {
15 MEDIA_EXPORT MediaClient* GetMediaClient(); 16 MEDIA_EXPORT MediaClient* GetMediaClient();
16 } 17 }
17 18
(...skipping 30 matching lines...) Expand all
48 std::vector<std::unique_ptr<::media::KeySystemProperties>>* 49 std::vector<std::unique_ptr<::media::KeySystemProperties>>*
49 key_systems_properties) { 50 key_systems_properties) {
50 content_media_client_->AddSupportedKeySystems(key_systems_properties); 51 content_media_client_->AddSupportedKeySystems(key_systems_properties);
51 } 52 }
52 53
53 void CastMediaClient::RecordRapporURL(const std::string& metric, 54 void CastMediaClient::RecordRapporURL(const std::string& metric,
54 const GURL& url) { 55 const GURL& url) {
55 content_media_client_->RecordRapporURL(metric, url); 56 content_media_client_->RecordRapporURL(metric, url);
56 } 57 }
57 58
58 // static
59 bool CastMediaClient::IsSupportedVideoConfig(::media::VideoCodec codec, 59 bool CastMediaClient::IsSupportedVideoConfig(::media::VideoCodec codec,
60 ::media::VideoCodecProfile profile, 60 ::media::VideoCodecProfile profile,
61 int level) { 61 int level) {
62 // TODO(servolk): For now, while the MediaCapabilitiesShlib is not mandatory 62 // TODO(servolk): For now, while the MediaCapabilitiesShlib is not mandatory
63 // and might not be present, we will call the custom IsSupportedVideoConfig 63 // and might not be present, we will call the custom IsSupportedVideoConfig
64 // implementation when it's present and will rely on the older approach 64 // implementation when it's present and will rely on the older approach
65 // (MediaCodecSupportShlib) to block codecs not supported on platforms that 65 // (MediaCodecSupportShlib) to block codecs not supported on platforms that
66 // don't have MediaCodecSupportShlib yet. During the next OEM API change we'll 66 // don't have MediaCodecSupportShlib yet. During the next OEM API change we'll
67 // make MediaCodecSupportShlib mandatory and will be always able to call it. 67 // make MediaCodecSupportShlib mandatory and will be always able to call it.
68 if (MediaCapabilitiesShlib::IsSupportedVideoConfig) { 68 if (MediaCapabilitiesShlib::IsSupportedVideoConfig) {
69 return MediaCapabilitiesShlib::IsSupportedVideoConfig( 69 return MediaCapabilitiesShlib::IsSupportedVideoConfig(
70 ToCastVideoCodec(codec), ToCastVideoProfile(profile), level); 70 ToCastVideoCodec(codec), ToCastVideoProfile(profile), level);
71 } 71 }
72 LOG(WARNING) << __FUNCTION__ 72 LOG(WARNING) << __FUNCTION__
73 << " MediaCapabilitiesShlib::IsSupportedVideoConfig not present" 73 << " MediaCapabilitiesShlib::IsSupportedVideoConfig not present"
74 << ", returning true"; 74 << ", returning true";
75 return true; 75 return true;
76 } 76 }
77 77
78 bool CastMediaClient::IsSupportedPassthroughAudio(::media::AudioCodec codec) {
79 return (codec == ::media::kCodecAC3 &&
80 MediaCapabilities::HdmiSinkSupportsAC3()) ||
81 (codec == ::media::kCodecEAC3 &&
82 MediaCapabilities::HdmiSinkSupportsEAC3());
83 }
84
78 } // namespace media 85 } // namespace media
79 } // namespace chromecast 86 } // namespace chromecast
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698