OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_recorder/video_track_recorder.h" | 5 #include "content/renderer/media_recorder/video_track_recorder.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 static CodecEnumerator* enumerator = new CodecEnumerator(); | 102 static CodecEnumerator* enumerator = new CodecEnumerator(); |
103 return enumerator; | 103 return enumerator; |
104 } | 104 } |
105 | 105 |
106 CodecEnumerator::CodecEnumerator() { | 106 CodecEnumerator::CodecEnumerator() { |
107 #if defined(OS_CHROMEOS) | 107 #if defined(OS_CHROMEOS) |
108 // See https://crbug.com/616659. | 108 // See https://crbug.com/616659. |
109 return; | 109 return; |
110 #endif | 110 #endif |
111 | 111 |
| 112 #if defined(OS_ANDROID) |
| 113 // See https://crbug.com/653864. |
| 114 return; |
| 115 #endif |
| 116 |
112 content::RenderThreadImpl* const render_thread_impl = | 117 content::RenderThreadImpl* const render_thread_impl = |
113 content::RenderThreadImpl::current(); | 118 content::RenderThreadImpl::current(); |
114 if (!render_thread_impl) { | 119 if (!render_thread_impl) { |
115 DVLOG(2) << "Couldn't access the render thread"; | 120 DVLOG(2) << "Couldn't access the render thread"; |
116 return; | 121 return; |
117 } | 122 } |
118 | 123 |
119 media::GpuVideoAcceleratorFactories* const gpu_factories = | 124 media::GpuVideoAcceleratorFactories* const gpu_factories = |
120 render_thread_impl->GetGpuFactories(); | 125 render_thread_impl->GetGpuFactories(); |
121 if (!gpu_factories || !gpu_factories->IsGpuVideoAcceleratorEnabled()) { | 126 if (!gpu_factories || !gpu_factories->IsGpuVideoAcceleratorEnabled()) { |
122 DVLOG(2) << "Couldn't initialize GpuVideoAcceleratorFactories"; | 127 DVLOG(2) << "Couldn't initialize GpuVideoAcceleratorFactories"; |
123 return; | 128 return; |
124 } | 129 } |
125 | 130 |
126 const auto vea_supported_profiles = | 131 const auto vea_supported_profiles = |
127 gpu_factories->GetVideoEncodeAcceleratorSupportedProfiles(); | 132 gpu_factories->GetVideoEncodeAcceleratorSupportedProfiles(); |
128 for (const auto& supported_profile : vea_supported_profiles) { | 133 for (const auto& supported_profile : vea_supported_profiles) { |
129 for (auto& codec_id_and_profile : kPreferredCodecIdAndVEAProfiles) { | 134 for (auto& codec_id_and_profile : kPreferredCodecIdAndVEAProfiles) { |
130 const media::VideoCodecProfile codec = supported_profile.profile; | 135 if (supported_profile.profile >= codec_id_and_profile.min_profile && |
131 #if defined(OS_ANDROID) | 136 supported_profile.profile <= codec_id_and_profile.max_profile) { |
132 // TODO(mcasas): enable other codecs, https://crbug.com/653864. | 137 DVLOG(2) << "Accelerated codec found: " |
133 if (codec < media::VP8PROFILE_MIN || codec > media::VP8PROFILE_MAX) | 138 << media::GetProfileName(supported_profile.profile); |
134 continue; | 139 codec_id_to_profile_.insert(std::make_pair( |
135 #endif | 140 codec_id_and_profile.codec_id, supported_profile.profile)); |
136 if (codec >= codec_id_and_profile.min_profile && | |
137 codec <= codec_id_and_profile.max_profile) { | |
138 DVLOG(2) << "Accelerated codec found: " << media::GetProfileName(codec); | |
139 codec_id_to_profile_.insert( | |
140 std::make_pair(codec_id_and_profile.codec_id, codec)); | |
141 } | 141 } |
142 } | 142 } |
143 } | 143 } |
144 } | 144 } |
145 | 145 |
146 CodecId CodecEnumerator::GetPreferredCodecId() { | 146 CodecId CodecEnumerator::GetPreferredCodecId() { |
147 if (codec_id_to_profile_.empty()) | 147 if (codec_id_to_profile_.empty()) |
148 return CodecId::VP8; | 148 return CodecId::VP8; |
149 return codec_id_to_profile_.begin()->first; | 149 return codec_id_to_profile_.begin()->first; |
150 } | 150 } |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 MediaStreamVideoSink::DisconnectFromTrack(); | 458 MediaStreamVideoSink::DisconnectFromTrack(); |
459 encoder_ = nullptr; | 459 encoder_ = nullptr; |
460 MediaStreamVideoSink::ConnectToTrack( | 460 MediaStreamVideoSink::ConnectToTrack( |
461 track_, | 461 track_, |
462 media::BindToCurrentLoop(base::Bind(initialize_encoder_callback_, | 462 media::BindToCurrentLoop(base::Bind(initialize_encoder_callback_, |
463 false /*allow_vea_encoder*/)), | 463 false /*allow_vea_encoder*/)), |
464 false); | 464 false); |
465 } | 465 } |
466 | 466 |
467 } // namespace content | 467 } // namespace content |
OLD | NEW |