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 "content/renderer/media/render_media_client.h" | 5 #include "content/renderer/media/render_media_client.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/time/default_tick_clock.h" | 8 #include "base/time/default_tick_clock.h" |
9 #include "content/public/common/content_client.h" | 9 #include "content/public/common/content_client.h" |
10 #include "content/public/renderer/content_renderer_client.h" | 10 #include "content/public/renderer/content_renderer_client.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 #else | 82 #else |
83 is_update_needed_ = false; | 83 is_update_needed_ = false; |
84 #endif | 84 #endif |
85 } | 85 } |
86 | 86 |
87 void RenderMediaClient::RecordRapporURL(const std::string& metric, | 87 void RenderMediaClient::RecordRapporURL(const std::string& metric, |
88 const GURL& url) { | 88 const GURL& url) { |
89 GetContentClient()->renderer()->RecordRapporURL(metric, url); | 89 GetContentClient()->renderer()->RecordRapporURL(metric, url); |
90 } | 90 } |
91 | 91 |
92 bool RenderMediaClient::IsSupportedVideoConfig(media::VideoCodec codec, | 92 bool IsTransferFunctionSupported(gfx::ColorSpace::TransferID eotf) { |
93 media::VideoCodecProfile profile, | 93 switch (eotf) { |
94 int level) { | 94 // Transfers supported without color management. |
95 switch (codec) { | 95 case gfx::ColorSpace::TransferID::GAMMA22: |
| 96 case gfx::ColorSpace::TransferID::BT709: |
| 97 case gfx::ColorSpace::TransferID::SMPTE170M: |
| 98 case gfx::ColorSpace::TransferID::BT2020_10: |
| 99 case gfx::ColorSpace::TransferID::BT2020_12: |
| 100 case gfx::ColorSpace::TransferID::IEC61966_2_1: |
| 101 return true; |
| 102 default: |
| 103 // TODO(hubbe): wire up support for HDR transfers. |
| 104 return false; |
| 105 } |
| 106 } |
| 107 |
| 108 bool RenderMediaClient::IsSupportedVideoConfig( |
| 109 const media::VideoConfig& config) { |
| 110 // TODO(chcunningham): Query decoders for codec profile support. |
| 111 switch (config.codec) { |
| 112 case media::kCodecVP9: |
| 113 // Color management required for HDR to not look terrible. |
| 114 return IsTransferFunctionSupported(config.eotf); |
| 115 |
96 case media::kCodecH264: | 116 case media::kCodecH264: |
97 case media::kCodecVP8: | 117 case media::kCodecVP8: |
98 case media::kCodecVP9: | |
99 case media::kCodecTheora: | 118 case media::kCodecTheora: |
100 return true; | 119 return true; |
101 | 120 |
102 case media::kUnknownVideoCodec: | 121 case media::kUnknownVideoCodec: |
103 case media::kCodecVC1: | 122 case media::kCodecVC1: |
104 case media::kCodecMPEG2: | 123 case media::kCodecMPEG2: |
105 case media::kCodecMPEG4: | 124 case media::kCodecMPEG4: |
106 case media::kCodecHEVC: | 125 case media::kCodecHEVC: |
107 case media::kCodecDolbyVision: | 126 case media::kCodecDolbyVision: |
108 return false; | 127 return false; |
109 } | 128 } |
110 | 129 |
111 NOTREACHED(); | 130 NOTREACHED(); |
112 return false; | 131 return false; |
113 } | 132 } |
114 | 133 |
115 void RenderMediaClient::SetTickClockForTesting( | 134 void RenderMediaClient::SetTickClockForTesting( |
116 std::unique_ptr<base::TickClock> tick_clock) { | 135 std::unique_ptr<base::TickClock> tick_clock) { |
117 tick_clock_.swap(tick_clock); | 136 tick_clock_.swap(tick_clock); |
118 } | 137 } |
119 | 138 |
120 // static | 139 // static |
121 RenderMediaClient* RenderMediaClient::GetInstance() { | 140 RenderMediaClient* RenderMediaClient::GetInstance() { |
122 static RenderMediaClient* client = new RenderMediaClient(); | 141 static RenderMediaClient* client = new RenderMediaClient(); |
123 return client; | 142 return client; |
124 } | 143 } |
125 | 144 |
126 } // namespace content | 145 } // namespace content |
OLD | NEW |