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

Side by Side Diff: media/blink/webaudiosourceprovider_impl.cc

Issue 2836293002: Introduce AudioRendererSink::IsOptimizedForHardwareParameters (Closed)
Patch Set: Revise comment 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "media/blink/webaudiosourceprovider_impl.h" 5 #include "media/blink/webaudiosourceprovider_impl.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 } 245 }
246 246
247 bool WebAudioSourceProviderImpl::SetVolume(double volume) { 247 bool WebAudioSourceProviderImpl::SetVolume(double volume) {
248 base::AutoLock auto_lock(sink_lock_); 248 base::AutoLock auto_lock(sink_lock_);
249 volume_ = volume; 249 volume_ = volume;
250 if (!client_ && sink_) 250 if (!client_ && sink_)
251 sink_->SetVolume(volume); 251 sink_->SetVolume(volume);
252 return true; 252 return true;
253 } 253 }
254 254
255 OutputDeviceInfo WebAudioSourceProviderImpl::GetOutputDeviceInfo() { 255 OutputDeviceInfo WebAudioSourceProviderImpl::GetOutputDeviceInfo(
256 const AudioParameters& preferred_params) {
256 base::AutoLock auto_lock(sink_lock_); 257 base::AutoLock auto_lock(sink_lock_);
257 return sink_ ? sink_->GetOutputDeviceInfo() 258
258 : OutputDeviceInfo(OUTPUT_DEVICE_STATUS_ERROR_NOT_FOUND); 259 if (!sink_) {
260 return OutputDeviceInfo(OUTPUT_DEVICE_STATUS_ERROR_NOT_FOUND);
261 }
262
263 OutputDeviceInfo sink_info = sink_->GetOutputDeviceInfo();
264 if (client_) {
265 return OutputDeviceInfo(sink_info.device_id(), sink_info.device_status(),
266 preferred_params);
o1ka 2017/04/28 09:57:18 What if preferred_params are empty/invalid?
267 }
268 return sink_info;
259 } 269 }
260 270
261 bool WebAudioSourceProviderImpl::CurrentThreadIsRenderingThread() { 271 bool WebAudioSourceProviderImpl::CurrentThreadIsRenderingThread() {
262 NOTIMPLEMENTED(); 272 NOTIMPLEMENTED();
263 return false; 273 return false;
264 } 274 }
265 275
266 void WebAudioSourceProviderImpl::SwitchOutputDevice( 276 void WebAudioSourceProviderImpl::SwitchOutputDevice(
267 const std::string& device_id, 277 const std::string& device_id,
268 const url::Origin& security_origin, 278 const url::Origin& security_origin,
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 342
333 return num_rendered_frames; 343 return num_rendered_frames;
334 } 344 }
335 345
336 void WebAudioSourceProviderImpl::TeeFilter::OnRenderError() { 346 void WebAudioSourceProviderImpl::TeeFilter::OnRenderError() {
337 DCHECK(IsInitialized()); 347 DCHECK(IsInitialized());
338 renderer_->OnRenderError(); 348 renderer_->OnRenderError();
339 } 349 }
340 350
341 } // namespace media 351 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698