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

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

Issue 2926393002: Enable vp09 codec string in WebM by default (Closed)
Patch Set: Created 3 years, 6 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
« no previous file with comments | « content/renderer/render_thread_impl.cc ('k') | media/base/media.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/decode_capabilities.h" 5 #include "media/base/decode_capabilities.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/feature_list.h" 8 #include "base/feature_list.h"
9 #include "media/base/media_switches.h" 9 #include "media/base/media_switches.h"
10 #include "ui/display/display_switches.h" 10 #include "ui/display/display_switches.h"
11 11
12 #if !defined(MEDIA_DISABLE_LIBVPX)
13 // VPX_CODEC_DISABLE_COMPAT excludes parts of the libvpx API that provide
14 // backwards compatibility for legacy applications using the library.
15 #define VPX_CODEC_DISABLE_COMPAT 1
16 extern "C" {
17 #include "third_party/libvpx/source/libvpx/vpx/vp8dx.h"
18 #include "third_party/libvpx/source/libvpx/vpx/vpx_codec.h"
19 }
20 #endif
21
12 namespace media { 22 namespace media {
13 23
14 bool IsColorSpaceSupported(const media::VideoColorSpace& color_space) { 24 bool IsColorSpaceSupported(const media::VideoColorSpace& color_space) {
15 bool color_management = 25 bool color_management =
16 base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableHDR) || 26 base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableHDR) ||
17 base::FeatureList::IsEnabled(media::kVideoColorManagement); 27 base::FeatureList::IsEnabled(media::kVideoColorManagement);
18 switch (color_space.primaries) { 28 switch (color_space.primaries) {
19 case media::VideoColorSpace::PrimaryID::EBU_3213_E: 29 case media::VideoColorSpace::PrimaryID::EBU_3213_E:
20 case media::VideoColorSpace::PrimaryID::INVALID: 30 case media::VideoColorSpace::PrimaryID::INVALID:
21 return false; 31 return false;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 case media::VideoColorSpace::MatrixID::INVALID: 105 case media::VideoColorSpace::MatrixID::INVALID:
96 return false; 106 return false;
97 } 107 }
98 108
99 if (color_space.range == gfx::ColorSpace::RangeID::INVALID) 109 if (color_space.range == gfx::ColorSpace::RangeID::INVALID)
100 return false; 110 return false;
101 111
102 return true; 112 return true;
103 } 113 }
104 114
115 bool IsVp9ProfileSupported(VideoCodecProfile profile) {
116 #if !defined(MEDIA_DISABLE_LIBVPX)
117 // High bit depth capabilities may be toggled via LibVPX config flags.
118 static bool vpx_supports_high_bit_depth =
119 (vpx_codec_get_caps(vpx_codec_vp9_dx()) & VPX_CODEC_CAP_HIGHBITDEPTH) !=
120 0;
121
122 switch (profile) {
123 // LibVPX always supports Profiles 0 and 1.
124 case VP9PROFILE_PROFILE0:
125 case VP9PROFILE_PROFILE1:
126 return true;
127 case VP9PROFILE_PROFILE2:
128 case VP9PROFILE_PROFILE3:
129 return vpx_supports_high_bit_depth;
130 default:
131 NOTREACHED();
132 }
133 #endif
134 return false;
135 }
136
105 bool IsSupportedAudioConfig(const AudioConfig& config) { 137 bool IsSupportedAudioConfig(const AudioConfig& config) {
106 switch (config.codec) { 138 switch (config.codec) {
107 case media::kCodecAAC: 139 case media::kCodecAAC:
108 case media::kCodecFLAC: 140 case media::kCodecFLAC:
109 case media::kCodecMP3: 141 case media::kCodecMP3:
110 case media::kCodecOpus: 142 case media::kCodecOpus:
111 case media::kCodecPCM: 143 case media::kCodecPCM:
112 case media::kCodecPCM_MULAW: 144 case media::kCodecPCM_MULAW:
113 case media::kCodecPCM_S16BE: 145 case media::kCodecPCM_S16BE:
114 case media::kCodecPCM_S24BE: 146 case media::kCodecPCM_S24BE:
(...skipping 20 matching lines...) Expand all
135 NOTREACHED(); 167 NOTREACHED();
136 return false; 168 return false;
137 } 169 }
138 170
139 // TODO(chcunningham): Query decoders for codec profile support. Add platform 171 // TODO(chcunningham): Query decoders for codec profile support. Add platform
140 // specific logic for Android (move from MimeUtilIntenral). 172 // specific logic for Android (move from MimeUtilIntenral).
141 bool IsSupportedVideoConfig(const VideoConfig& config) { 173 bool IsSupportedVideoConfig(const VideoConfig& config) {
142 switch (config.codec) { 174 switch (config.codec) {
143 case media::kCodecVP9: 175 case media::kCodecVP9:
144 // Color management required for HDR to not look terrible. 176 // Color management required for HDR to not look terrible.
145 return IsColorSpaceSupported(config.color_space); 177 return IsColorSpaceSupported(config.color_space) &&
146 178 IsVp9ProfileSupported(config.profile);
147 case media::kCodecH264: 179 case media::kCodecH264:
148 case media::kCodecVP8: 180 case media::kCodecVP8:
149 case media::kCodecTheora: 181 case media::kCodecTheora:
150 return true; 182 return true;
151 183
152 case media::kUnknownVideoCodec: 184 case media::kUnknownVideoCodec:
153 case media::kCodecVC1: 185 case media::kCodecVC1:
154 case media::kCodecMPEG2: 186 case media::kCodecMPEG2:
155 case media::kCodecMPEG4: 187 case media::kCodecMPEG4:
156 case media::kCodecHEVC: 188 case media::kCodecHEVC:
157 case media::kCodecDolbyVision: 189 case media::kCodecDolbyVision:
158 return false; 190 return false;
159 } 191 }
160 192
161 NOTREACHED(); 193 NOTREACHED();
162 return false; 194 return false;
163 } 195 }
164 196
165 } // namespace media 197 } // namespace media
OLDNEW
« no previous file with comments | « content/renderer/render_thread_impl.cc ('k') | media/base/media.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698