Chromium Code Reviews| 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/02 23:37:11
Remove this function for now.
chcunningham
2017/03/07 02:27:56
Done.
| |
| 93 media::VideoCodecProfile profile, | 93 // TODO(hubbe): Wire this up. |
| 94 int level) { | 94 return false; |
| 95 } | |
| 96 | |
| 97 bool IsSdrTransferFunction(gfx::ColorSpace::TransferID eotf) { | |
|
hubbe
2017/03/02 23:37:11
Make this IsTransferFunctionSupported().
chcunningham
2017/03/07 02:27:56
Done.
| |
| 98 switch (eotf) { | |
| 99 case gfx::ColorSpace::TransferID::GAMMA22: | |
| 100 case gfx::ColorSpace::TransferID::BT709: | |
| 101 case gfx::ColorSpace::TransferID::SMPTE170M: | |
| 102 case gfx::ColorSpace::TransferID::BT2020_10: | |
| 103 case gfx::ColorSpace::TransferID::BT2020_12: | |
| 104 case gfx::ColorSpace::TransferID::IEC61966_2_1: | |
| 105 return true; | |
| 106 default: | |
| 107 return false; | |
| 108 } | |
| 109 } | |
| 110 | |
| 111 bool RenderMediaClient::IsSupportedVideoConfig( | |
| 112 media::VideoCodec codec, | |
| 113 media::VideoCodecProfile profile, | |
| 114 int level, | |
| 115 gfx::ColorSpace::TransferID eotf) { | |
| 116 // TODO(chcunningham): Query decoders for codec profile support. | |
| 95 switch (codec) { | 117 switch (codec) { |
| 118 case media::kCodecVP9: | |
| 119 // Color management required for HDR to not look terrible. | |
| 120 return IsSdrTransferFunction(eotf) || IsHdrColorManagementEnabled(); | |
|
servolk
2017/03/02 18:56:36
VP9 profile 0 is SDR, profile 2 is HDR. I believe
chcunningham
2017/03/02 23:13:08
My understanding from hubbe is that profile 2 does
hubbe
2017/03/02 23:37:11
Just call IsTransferFunctionSupported() here.
hubbe
2017/03/02 23:37:11
Profile 2 is just more bits per channel, and has n
| |
| 121 | |
| 96 case media::kCodecH264: | 122 case media::kCodecH264: |
| 97 case media::kCodecVP8: | 123 case media::kCodecVP8: |
| 98 case media::kCodecVP9: | |
| 99 case media::kCodecTheora: | 124 case media::kCodecTheora: |
| 100 return true; | 125 return true; |
| 101 | 126 |
| 102 case media::kUnknownVideoCodec: | 127 case media::kUnknownVideoCodec: |
| 103 case media::kCodecVC1: | 128 case media::kCodecVC1: |
| 104 case media::kCodecMPEG2: | 129 case media::kCodecMPEG2: |
| 105 case media::kCodecMPEG4: | 130 case media::kCodecMPEG4: |
| 106 case media::kCodecHEVC: | 131 case media::kCodecHEVC: |
| 107 return false; | 132 return false; |
| 108 } | 133 } |
| 109 | 134 |
| 110 NOTREACHED(); | 135 NOTREACHED(); |
| 111 return false; | 136 return false; |
| 112 } | 137 } |
| 113 | 138 |
| 114 void RenderMediaClient::SetTickClockForTesting( | 139 void RenderMediaClient::SetTickClockForTesting( |
| 115 std::unique_ptr<base::TickClock> tick_clock) { | 140 std::unique_ptr<base::TickClock> tick_clock) { |
| 116 tick_clock_.swap(tick_clock); | 141 tick_clock_.swap(tick_clock); |
| 117 } | 142 } |
| 118 | 143 |
| 119 // static | 144 // static |
| 120 RenderMediaClient* RenderMediaClient::GetInstance() { | 145 RenderMediaClient* RenderMediaClient::GetInstance() { |
| 121 static RenderMediaClient* client = new RenderMediaClient(); | 146 static RenderMediaClient* client = new RenderMediaClient(); |
| 122 return client; | 147 return client; |
| 123 } | 148 } |
| 124 | 149 |
| 125 } // namespace content | 150 } // namespace content |
| OLD | NEW |