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 IsHdrColorManagementEnabled() { |
hubbe
2017/03/07 19:22:16
Remove?
chcunningham
2017/03/07 23:59:17
Done.
| |
93 media::VideoCodecProfile profile, | 93 // TODO(hubbe): Wire this up. |
94 int level) { | 94 return false; |
95 switch (codec) { | 95 } |
96 | |
97 bool IsTransferFunctionSupported(gfx::ColorSpace::TransferID eotf) { | |
98 switch (eotf) { | |
99 // Transfers supported without color management. | |
100 case gfx::ColorSpace::TransferID::GAMMA22: | |
101 case gfx::ColorSpace::TransferID::BT709: | |
102 case gfx::ColorSpace::TransferID::SMPTE170M: | |
103 case gfx::ColorSpace::TransferID::BT2020_10: | |
104 case gfx::ColorSpace::TransferID::BT2020_12: | |
105 case gfx::ColorSpace::TransferID::IEC61966_2_1: | |
106 return true; | |
107 default: | |
108 // TODO(hubbe): wire up support for HDR transfers. | |
109 return false; | |
110 } | |
111 } | |
112 | |
113 bool RenderMediaClient::IsSupportedVideoConfig( | |
114 const media::VideoConfig& config) { | |
115 // TODO(chcunningham): Query decoders for codec profile support. | |
116 switch (config.codec) { | |
117 case media::kCodecVP9: | |
118 // Color management required for HDR to not look terrible. | |
119 return IsTransferFunctionSupported(config.eotf); | |
120 | |
96 case media::kCodecH264: | 121 case media::kCodecH264: |
97 case media::kCodecVP8: | 122 case media::kCodecVP8: |
98 case media::kCodecVP9: | |
99 case media::kCodecTheora: | 123 case media::kCodecTheora: |
100 return true; | 124 return true; |
101 | 125 |
102 case media::kUnknownVideoCodec: | 126 case media::kUnknownVideoCodec: |
103 case media::kCodecVC1: | 127 case media::kCodecVC1: |
104 case media::kCodecMPEG2: | 128 case media::kCodecMPEG2: |
105 case media::kCodecMPEG4: | 129 case media::kCodecMPEG4: |
106 case media::kCodecHEVC: | 130 case media::kCodecHEVC: |
107 case media::kCodecDolbyVision: | 131 case media::kCodecDolbyVision: |
108 return false; | 132 return false; |
109 } | 133 } |
110 | 134 |
111 NOTREACHED(); | 135 NOTREACHED(); |
112 return false; | 136 return false; |
113 } | 137 } |
114 | 138 |
115 void RenderMediaClient::SetTickClockForTesting( | 139 void RenderMediaClient::SetTickClockForTesting( |
116 std::unique_ptr<base::TickClock> tick_clock) { | 140 std::unique_ptr<base::TickClock> tick_clock) { |
117 tick_clock_.swap(tick_clock); | 141 tick_clock_.swap(tick_clock); |
118 } | 142 } |
119 | 143 |
120 // static | 144 // static |
121 RenderMediaClient* RenderMediaClient::GetInstance() { | 145 RenderMediaClient* RenderMediaClient::GetInstance() { |
122 static RenderMediaClient* client = new RenderMediaClient(); | 146 static RenderMediaClient* client = new RenderMediaClient(); |
123 return client; | 147 return client; |
124 } | 148 } |
125 | 149 |
126 } // namespace content | 150 } // namespace content |
OLD | NEW |