Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Side by Side Diff: content/renderer/media_recorder/video_track_recorder.cc

Issue 2855503002: RELAND: MediaRecorder: enable encode acceleration for VP8 in Android (Closed)
Patch Set: Disable MAYBE_PeerConnection test on Android Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/renderer/media_recorder/video_track_recorder.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
117 content::RenderThreadImpl* const render_thread_impl = 112 content::RenderThreadImpl* const render_thread_impl =
118 content::RenderThreadImpl::current(); 113 content::RenderThreadImpl::current();
119 if (!render_thread_impl) { 114 if (!render_thread_impl) {
120 DVLOG(2) << "Couldn't access the render thread"; 115 DVLOG(2) << "Couldn't access the render thread";
121 return; 116 return;
122 } 117 }
123 118
124 media::GpuVideoAcceleratorFactories* const gpu_factories = 119 media::GpuVideoAcceleratorFactories* const gpu_factories =
125 render_thread_impl->GetGpuFactories(); 120 render_thread_impl->GetGpuFactories();
126 if (!gpu_factories || !gpu_factories->IsGpuVideoAcceleratorEnabled()) { 121 if (!gpu_factories || !gpu_factories->IsGpuVideoAcceleratorEnabled()) {
127 DVLOG(2) << "Couldn't initialize GpuVideoAcceleratorFactories"; 122 DVLOG(2) << "Couldn't initialize GpuVideoAcceleratorFactories";
128 return; 123 return;
129 } 124 }
130 125
131 const auto vea_supported_profiles = 126 const auto vea_supported_profiles =
132 gpu_factories->GetVideoEncodeAcceleratorSupportedProfiles(); 127 gpu_factories->GetVideoEncodeAcceleratorSupportedProfiles();
133 for (const auto& supported_profile : vea_supported_profiles) { 128 for (const auto& supported_profile : vea_supported_profiles) {
129 const media::VideoCodecProfile codec = supported_profile.profile;
130 #if defined(OS_ANDROID)
131 // TODO(mcasas): enable other codecs, https://crbug.com/638664.
132 if (codec < media::VP8PROFILE_MIN || codec > media::VP8PROFILE_MAX)
133 continue;
134 #endif
134 for (auto& codec_id_and_profile : kPreferredCodecIdAndVEAProfiles) { 135 for (auto& codec_id_and_profile : kPreferredCodecIdAndVEAProfiles) {
135 if (supported_profile.profile >= codec_id_and_profile.min_profile && 136 if (codec >= codec_id_and_profile.min_profile &&
136 supported_profile.profile <= codec_id_and_profile.max_profile) { 137 codec <= codec_id_and_profile.max_profile) {
137 DVLOG(2) << "Accelerated codec found: " 138 DVLOG(2) << "Accelerated codec found: " << media::GetProfileName(codec);
138 << media::GetProfileName(supported_profile.profile); 139 codec_id_to_profile_.insert(
139 codec_id_to_profile_.insert(std::make_pair( 140 std::make_pair(codec_id_and_profile.codec_id, codec));
140 codec_id_and_profile.codec_id, supported_profile.profile));
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
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
OLDNEW
« no previous file with comments | « content/renderer/media_recorder/video_track_recorder.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698