OLD | NEW |
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 <string> | 5 #include <string> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/test/simple_test_tick_clock.h" | 8 #include "base/test/simple_test_tick_clock.h" |
9 #include "content/public/renderer/content_renderer_client.h" | 9 #include "content/public/renderer/content_renderer_client.h" |
10 #include "content/renderer/media/render_media_client.h" | 10 #include "content/renderer/media/render_media_client.h" |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 EXPECT_TRUE(ContainsWidevine(key_systems_properties)); | 174 EXPECT_TRUE(ContainsWidevine(key_systems_properties)); |
175 | 175 |
176 EXPECT_FALSE(render_media_client_->IsKeySystemsUpdateNeeded()); | 176 EXPECT_FALSE(render_media_client_->IsKeySystemsUpdateNeeded()); |
177 tick_clock->Advance(base::TimeDelta::FromMilliseconds(1000)); | 177 tick_clock->Advance(base::TimeDelta::FromMilliseconds(1000)); |
178 EXPECT_FALSE(render_media_client_->IsKeySystemsUpdateNeeded()); | 178 EXPECT_FALSE(render_media_client_->IsKeySystemsUpdateNeeded()); |
179 tick_clock->Advance(base::TimeDelta::FromMilliseconds(1000)); | 179 tick_clock->Advance(base::TimeDelta::FromMilliseconds(1000)); |
180 EXPECT_FALSE(render_media_client_->IsKeySystemsUpdateNeeded()); | 180 EXPECT_FALSE(render_media_client_->IsKeySystemsUpdateNeeded()); |
181 #endif | 181 #endif |
182 } | 182 } |
183 | 183 |
| 184 TEST_F(RenderMediaClientTest, IsSupportedVideoConfigBasics) { |
| 185 // Default to common 709. |
| 186 const gfx::ColorSpace::TransferID kTransferId = |
| 187 gfx::ColorSpace::TransferID::BT709; |
| 188 |
| 189 // Some codecs do not have a notion of level. |
| 190 const int kUnspecifiedLevel = 0; |
| 191 |
| 192 // Expect support for baseline configuration of known codecs. |
| 193 EXPECT_TRUE(render_media_client_->IsSupportedVideoConfig( |
| 194 {media::kCodecH264, media::H264PROFILE_BASELINE, 1, kTransferId})); |
| 195 EXPECT_TRUE(render_media_client_->IsSupportedVideoConfig( |
| 196 {media::kCodecVP8, media::VP8PROFILE_ANY, kUnspecifiedLevel, |
| 197 kTransferId})); |
| 198 EXPECT_TRUE(render_media_client_->IsSupportedVideoConfig( |
| 199 {media::kCodecVP9, media::VP9PROFILE_PROFILE0, kUnspecifiedLevel, |
| 200 kTransferId})); |
| 201 EXPECT_TRUE(render_media_client_->IsSupportedVideoConfig( |
| 202 {media::kCodecTheora, media::VIDEO_CODEC_PROFILE_UNKNOWN, |
| 203 kUnspecifiedLevel, kTransferId})); |
| 204 |
| 205 // Expect non-support for the following. |
| 206 EXPECT_FALSE(render_media_client_->IsSupportedVideoConfig( |
| 207 {media::kUnknownVideoCodec, media::VIDEO_CODEC_PROFILE_UNKNOWN, |
| 208 kUnspecifiedLevel, kTransferId})); |
| 209 EXPECT_FALSE(render_media_client_->IsSupportedVideoConfig( |
| 210 {media::kCodecVC1, media::VIDEO_CODEC_PROFILE_UNKNOWN, kUnspecifiedLevel, |
| 211 kTransferId})); |
| 212 EXPECT_FALSE(render_media_client_->IsSupportedVideoConfig( |
| 213 {media::kCodecMPEG2, media::VIDEO_CODEC_PROFILE_UNKNOWN, |
| 214 kUnspecifiedLevel, kTransferId})); |
| 215 EXPECT_FALSE(render_media_client_->IsSupportedVideoConfig( |
| 216 {media::kCodecMPEG4, media::VIDEO_CODEC_PROFILE_UNKNOWN, |
| 217 kUnspecifiedLevel, kTransferId})); |
| 218 EXPECT_FALSE(render_media_client_->IsSupportedVideoConfig( |
| 219 {media::kCodecHEVC, media::VIDEO_CODEC_PROFILE_UNKNOWN, kUnspecifiedLevel, |
| 220 kTransferId})); |
| 221 } |
| 222 |
| 223 TEST_F(RenderMediaClientTest, IsSupportedVideoConfig_VP9TransferFunctions) { |
| 224 const gfx::ColorSpace::TransferID kKnownTransfers[] = { |
| 225 gfx::ColorSpace::TransferID::INVALID, |
| 226 gfx::ColorSpace::TransferID::BT709, |
| 227 gfx::ColorSpace::TransferID::GAMMA22, |
| 228 gfx::ColorSpace::TransferID::GAMMA24, |
| 229 gfx::ColorSpace::TransferID::GAMMA28, |
| 230 gfx::ColorSpace::TransferID::SMPTE170M, |
| 231 gfx::ColorSpace::TransferID::SMPTE240M, |
| 232 gfx::ColorSpace::TransferID::LINEAR, |
| 233 gfx::ColorSpace::TransferID::LOG, |
| 234 gfx::ColorSpace::TransferID::LOG_SQRT, |
| 235 gfx::ColorSpace::TransferID::IEC61966_2_4, |
| 236 gfx::ColorSpace::TransferID::BT1361_ECG, |
| 237 gfx::ColorSpace::TransferID::IEC61966_2_1, |
| 238 gfx::ColorSpace::TransferID::BT2020_10, |
| 239 gfx::ColorSpace::TransferID::BT2020_12, |
| 240 gfx::ColorSpace::TransferID::SMPTEST2084, |
| 241 gfx::ColorSpace::TransferID::SMPTEST428_1, |
| 242 gfx::ColorSpace::TransferID::ARIB_STD_B67, |
| 243 gfx::ColorSpace::TransferID::SMPTEST2084_NON_HDR, |
| 244 gfx::ColorSpace::TransferID::LINEAR_HDR, |
| 245 gfx::ColorSpace::TransferID::CUSTOM, |
| 246 }; |
| 247 static_assert(arraysize(kKnownTransfers) - 1 == |
| 248 static_cast<size_t>(gfx::ColorSpace::TransferID::LAST), |
| 249 "List known transfers is out of sync"); |
| 250 |
| 251 // TODO(hubbe): Verify support for HDR codecs when color management enabled. |
| 252 const std::set<gfx::ColorSpace::TransferID> kSupportedTransfers = { |
| 253 gfx::ColorSpace::TransferID::GAMMA22, |
| 254 gfx::ColorSpace::TransferID::BT709, |
| 255 gfx::ColorSpace::TransferID::SMPTE170M, |
| 256 gfx::ColorSpace::TransferID::BT2020_10, |
| 257 gfx::ColorSpace::TransferID::BT2020_12, |
| 258 gfx::ColorSpace::TransferID::IEC61966_2_1, |
| 259 }; |
| 260 |
| 261 // Verify supported transfers. |
| 262 for (const auto transfer : kKnownTransfers) { |
| 263 EXPECT_EQ(kSupportedTransfers.find(transfer) != kSupportedTransfers.end(), |
| 264 render_media_client_->IsSupportedVideoConfig( |
| 265 {media::kCodecVP9, media::VP9PROFILE_PROFILE0, 1, transfer})); |
| 266 } |
| 267 } |
| 268 |
184 } // namespace content | 269 } // namespace content |
OLD | NEW |