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

Side by Side Diff: media/base/mime_util_internal.cc

Issue 2783963002: Add IsSupportedAudioConfig in MediaClient (Closed)
Patch Set: Update MediaCanPlayTypeTest Created 3 years, 8 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
« media/base/decode_capabilities.cc ('K') | « media/base/media_client.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 "media/base/mime_util_internal.h" 5 #include "media/base/mime_util_internal.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 platform_info_.has_platform_vp9_decoder = 129 platform_info_.has_platform_vp9_decoder =
130 MediaCodecUtil::IsVp9DecoderAvailable(); 130 MediaCodecUtil::IsVp9DecoderAvailable();
131 platform_info_.supports_opus = PlatformHasOpusSupport(); 131 platform_info_.supports_opus = PlatformHasOpusSupport();
132 #endif 132 #endif
133 133
134 InitializeMimeTypeMaps(); 134 InitializeMimeTypeMaps();
135 } 135 }
136 136
137 MimeUtil::~MimeUtil() {} 137 MimeUtil::~MimeUtil() {}
138 138
139 AudioCodec MimeUtilToAudioCodec(MimeUtil::Codec codec) {
140 switch (codec) {
141 case MimeUtil::PCM:
142 return kCodecPCM;
143 case MimeUtil::MP3:
144 return kCodecMP3;
145 case MimeUtil::AC3:
146 return kCodecAC3;
147 case MimeUtil::EAC3:
148 return kCodecEAC3;
149 case MimeUtil::MPEG2_AAC:
150 case MimeUtil::MPEG4_AAC:
151 return kCodecAAC;
152 case MimeUtil::VORBIS:
153 return kCodecVorbis;
154 case MimeUtil::OPUS:
155 return kCodecOpus;
156 case MimeUtil::FLAC:
157 return kCodecFLAC;
158 default:
159 break;
160 }
161 return kUnknownAudioCodec;
162 }
163
139 VideoCodec MimeUtilToVideoCodec(MimeUtil::Codec codec) { 164 VideoCodec MimeUtilToVideoCodec(MimeUtil::Codec codec) {
140 switch (codec) { 165 switch (codec) {
141 case MimeUtil::H264: 166 case MimeUtil::H264:
142 return kCodecH264; 167 return kCodecH264;
143 case MimeUtil::HEVC: 168 case MimeUtil::HEVC:
144 return kCodecHEVC; 169 return kCodecHEVC;
145 case MimeUtil::VP8: 170 case MimeUtil::VP8:
146 return kCodecVP8; 171 return kCodecVP8;
147 case MimeUtil::VP9: 172 case MimeUtil::VP9:
148 return kCodecVP9; 173 return kCodecVP9;
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 default: 728 default:
704 ambiguous_platform_support = true; 729 ambiguous_platform_support = true;
705 } 730 }
706 } else if (codec == MimeUtil::VP9 && video_profile != VP9PROFILE_PROFILE0) { 731 } else if (codec == MimeUtil::VP9 && video_profile != VP9PROFILE_PROFILE0) {
707 // We don't know if the underlying platform supports these profiles. Need 732 // We don't know if the underlying platform supports these profiles. Need
708 // to add platform level querying to get supported profiles. 733 // to add platform level querying to get supported profiles.
709 // https://crbug.com/604566 734 // https://crbug.com/604566
710 ambiguous_platform_support = true; 735 ambiguous_platform_support = true;
711 } 736 }
712 737
738 AudioCodec audio_codec = MimeUtilToAudioCodec(codec);
739 if (audio_codec != kUnknownAudioCodec) {
740 AudioConfig audio_config = {audio_codec};
741
742 // If MediaClient is provided use it to check for decoder support.
743 MediaClient* media_client = GetMediaClient();
744 if (media_client && !media_client->IsSupportedAudioConfig(audio_config))
745 return IsNotSupported;
746
747 // When no MediaClient is provided, assume default decoders are available
748 // as described by media::IsSupportedAudioConfig().
749 if (!media_client && !IsSupportedAudioConfig(audio_config))
750 return IsNotSupported;
751 }
752
713 if (video_codec != kUnknownVideoCodec) { 753 if (video_codec != kUnknownVideoCodec) {
714 VideoConfig video_config = {video_codec, video_profile, video_level, 754 VideoConfig video_config = {video_codec, video_profile, video_level,
715 color_space}; 755 color_space};
716 756
717 // If MediaClient is provided use it to check for decoder support. 757 // If MediaClient is provided use it to check for decoder support.
718 MediaClient* media_client = GetMediaClient(); 758 MediaClient* media_client = GetMediaClient();
719 if (media_client && !media_client->IsSupportedVideoConfig(video_config)) 759 if (media_client && !media_client->IsSupportedVideoConfig(video_config))
720 return IsNotSupported; 760 return IsNotSupported;
721 761
722 // When no MediaClient is provided, assume default decoders are available 762 // When no MediaClient is provided, assume default decoders are available
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 SupportsType MimeUtil::IsDefaultCodecSupported(const std::string& mime_type, 827 SupportsType MimeUtil::IsDefaultCodecSupported(const std::string& mime_type,
788 bool is_encrypted) const { 828 bool is_encrypted) const {
789 Codec default_codec = Codec::INVALID_CODEC; 829 Codec default_codec = Codec::INVALID_CODEC;
790 if (!GetDefaultCodec(mime_type, &default_codec)) 830 if (!GetDefaultCodec(mime_type, &default_codec))
791 return IsNotSupported; 831 return IsNotSupported;
792 return IsSimpleCodecSupported(mime_type, default_codec, is_encrypted); 832 return IsSimpleCodecSupported(mime_type, default_codec, is_encrypted);
793 } 833 }
794 834
795 } // namespace internal 835 } // namespace internal
796 } // namespace media 836 } // namespace media
OLDNEW
« media/base/decode_capabilities.cc ('K') | « media/base/media_client.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698