Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 OutputDeviceInfo sink_info = sink_->GetOutputDeviceInfo(); |
|
o1ka
2017/04/26 14:27:54
What if |sink_| is nullptr?
flim-chromium
2017/04/26 16:24:09
Fixed, thanks for spotting this!
| |
| 260 | |
| 261 if (client_) { | |
| 262 return OutputDeviceInfo(sink_info.device_id(), sink_info.device_status(), | |
| 263 preferred_params); | |
| 264 } | |
| 265 | |
| 266 if (sink_) { | |
| 267 return sink_info; | |
| 268 } | |
| 269 | |
| 270 return OutputDeviceInfo(OUTPUT_DEVICE_STATUS_ERROR_NOT_FOUND); | |
| 259 } | 271 } |
| 260 | 272 |
| 261 bool WebAudioSourceProviderImpl::CurrentThreadIsRenderingThread() { | 273 bool WebAudioSourceProviderImpl::CurrentThreadIsRenderingThread() { |
| 262 NOTIMPLEMENTED(); | 274 NOTIMPLEMENTED(); |
| 263 return false; | 275 return false; |
| 264 } | 276 } |
| 265 | 277 |
| 266 void WebAudioSourceProviderImpl::SwitchOutputDevice( | 278 void WebAudioSourceProviderImpl::SwitchOutputDevice( |
| 267 const std::string& device_id, | 279 const std::string& device_id, |
| 268 const url::Origin& security_origin, | 280 const url::Origin& security_origin, |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 332 | 344 |
| 333 return num_rendered_frames; | 345 return num_rendered_frames; |
| 334 } | 346 } |
| 335 | 347 |
| 336 void WebAudioSourceProviderImpl::TeeFilter::OnRenderError() { | 348 void WebAudioSourceProviderImpl::TeeFilter::OnRenderError() { |
| 337 DCHECK(IsInitialized()); | 349 DCHECK(IsInitialized()); |
| 338 renderer_->OnRenderError(); | 350 renderer_->OnRenderError(); |
| 339 } | 351 } |
| 340 | 352 |
| 341 } // namespace media | 353 } // namespace media |
| OLD | NEW |