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

Side by Side Diff: content/renderer/media/render_media_client.cc

Issue 2758873003: New media/base/decode_capabilities.h|cc (Closed)
Patch Set: Created 3 years, 9 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/renderer/media/render_media_client.h" 5 #include "content/renderer/media/render_media_client.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/time/default_tick_clock.h" 9 #include "base/time/default_tick_clock.h"
10 #include "content/public/common/content_client.h" 10 #include "content/public/common/content_client.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 #else 86 #else
87 is_update_needed_ = false; 87 is_update_needed_ = false;
88 #endif 88 #endif
89 } 89 }
90 90
91 void RenderMediaClient::RecordRapporURL(const std::string& metric, 91 void RenderMediaClient::RecordRapporURL(const std::string& metric,
92 const GURL& url) { 92 const GURL& url) {
93 GetContentClient()->renderer()->RecordRapporURL(metric, url); 93 GetContentClient()->renderer()->RecordRapporURL(metric, url);
94 } 94 }
95 95
96 bool IsColorSpaceSupported(const media::VideoColorSpace& color_space) {
hubbe 2017/03/23 18:14:30 I'm confused, where did this code go?
chcunningham 2017/03/23 19:20:53 Its now in media/base/decode_capabiliites.cc. The
hubbe 2017/03/23 19:33:00 I don't see that in this CL though. I expected a L
chcunningham 2017/03/23 19:37:47 Unless I've messed it up, you should find all of t
hubbe 2017/03/23 19:42:42 Ah, super confusing.
97 bool color_management =
98 base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableHDR) ||
99 base::FeatureList::IsEnabled(media::kVideoColorManagement);
100 switch (color_space.primaries) {
101 case media::VideoColorSpace::PrimaryID::EBU_3213_E:
102 case media::VideoColorSpace::PrimaryID::INVALID:
103 return false;
104
105 // Transfers supported without color management.
106 case media::VideoColorSpace::PrimaryID::BT709:
107 case media::VideoColorSpace::PrimaryID::UNSPECIFIED:
108 case media::VideoColorSpace::PrimaryID::BT470M:
109 case media::VideoColorSpace::PrimaryID::BT470BG:
110 case media::VideoColorSpace::PrimaryID::SMPTE170M:
111 break;
112
113 // Supported with color management.
114 case media::VideoColorSpace::PrimaryID::SMPTE240M:
115 case media::VideoColorSpace::PrimaryID::FILM:
116 case media::VideoColorSpace::PrimaryID::BT2020:
117 case media::VideoColorSpace::PrimaryID::SMPTEST428_1:
118 case media::VideoColorSpace::PrimaryID::SMPTEST431_2:
119 case media::VideoColorSpace::PrimaryID::SMPTEST432_1:
120 if (!color_management)
121 return false;
122 break;
123 }
124
125 switch (color_space.transfer) {
126 // Transfers supported without color management.
127 case media::VideoColorSpace::TransferID::UNSPECIFIED:
128 case media::VideoColorSpace::TransferID::GAMMA22:
129 case media::VideoColorSpace::TransferID::BT709:
130 case media::VideoColorSpace::TransferID::SMPTE170M:
131 case media::VideoColorSpace::TransferID::BT2020_10:
132 case media::VideoColorSpace::TransferID::BT2020_12:
133 case media::VideoColorSpace::TransferID::IEC61966_2_1:
134 break;
135
136 // Supported with color management.
137 case media::VideoColorSpace::TransferID::GAMMA28:
138 case media::VideoColorSpace::TransferID::SMPTE240M:
139 case media::VideoColorSpace::TransferID::LINEAR:
140 case media::VideoColorSpace::TransferID::LOG:
141 case media::VideoColorSpace::TransferID::LOG_SQRT:
142 case media::VideoColorSpace::TransferID::BT1361_ECG:
143 case media::VideoColorSpace::TransferID::SMPTEST2084:
144 case media::VideoColorSpace::TransferID::IEC61966_2_4:
145 case media::VideoColorSpace::TransferID::SMPTEST428_1:
146 case media::VideoColorSpace::TransferID::ARIB_STD_B67:
147 if (!color_management)
148 return false;
149 break;
150
151 // Never supported.
152 case media::VideoColorSpace::TransferID::INVALID:
153 return false;
154 }
155
156 switch (color_space.matrix) {
157 // Supported without color management.
158 case media::VideoColorSpace::MatrixID::BT709:
159 case media::VideoColorSpace::MatrixID::UNSPECIFIED:
160 case media::VideoColorSpace::MatrixID::BT470BG:
161 case media::VideoColorSpace::MatrixID::SMPTE170M:
162 case media::VideoColorSpace::MatrixID::BT2020_NCL:
163 break;
164
165 // Supported with color management.
166 case media::VideoColorSpace::MatrixID::RGB:
167 case media::VideoColorSpace::MatrixID::FCC:
168 case media::VideoColorSpace::MatrixID::SMPTE240M:
169 case media::VideoColorSpace::MatrixID::YCOCG:
170 case media::VideoColorSpace::MatrixID::YDZDX:
171 case media::VideoColorSpace::MatrixID::BT2020_CL:
172 if (!color_management)
173 return false;
174 break;
175
176 // Never supported.
177 case media::VideoColorSpace::MatrixID::INVALID:
178 return false;
179 }
180
181 if (color_space.range == gfx::ColorSpace::RangeID::INVALID)
182 return false;
183
184 return true;
185 }
186
187 bool RenderMediaClient::IsSupportedVideoConfig( 96 bool RenderMediaClient::IsSupportedVideoConfig(
188 const media::VideoConfig& config) { 97 const media::VideoConfig& config) {
189 // TODO(chcunningham): Query decoders for codec profile support. 98 // Render media client does not customize decoder support. Defer to media/.
190 switch (config.codec) { 99 return ::media::IsSupportedVideoConfig(config);
191 case media::kCodecVP9:
192 // Color management required for HDR to not look terrible.
193 return IsColorSpaceSupported(config.color_space);
194
195 case media::kCodecH264:
196 case media::kCodecVP8:
197 case media::kCodecTheora:
198 return true;
199
200 case media::kUnknownVideoCodec:
201 case media::kCodecVC1:
202 case media::kCodecMPEG2:
203 case media::kCodecMPEG4:
204 case media::kCodecHEVC:
205 case media::kCodecDolbyVision:
206 return false;
207 }
208
209 NOTREACHED();
210 return false;
211 } 100 }
212 101
213 void RenderMediaClient::SetTickClockForTesting( 102 void RenderMediaClient::SetTickClockForTesting(
214 std::unique_ptr<base::TickClock> tick_clock) { 103 std::unique_ptr<base::TickClock> tick_clock) {
215 tick_clock_.swap(tick_clock); 104 tick_clock_.swap(tick_clock);
216 } 105 }
217 106
218 // static 107 // static
219 RenderMediaClient* RenderMediaClient::GetInstance() { 108 RenderMediaClient* RenderMediaClient::GetInstance() {
220 static RenderMediaClient* client = new RenderMediaClient(); 109 static RenderMediaClient* client = new RenderMediaClient();
221 return client; 110 return client;
222 } 111 }
223 112
224 } // namespace content 113 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/renderer/media/render_media_client_unittest.cc » ('j') | media/base/decode_capabilities.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698