Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/base/audio_renderer_mixer_input.h" | 5 #include "media/base/audio_renderer_mixer_input.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 116 } | 116 } |
| 117 | 117 |
| 118 OutputDeviceInfo AudioRendererMixerInput::GetOutputDeviceInfo() { | 118 OutputDeviceInfo AudioRendererMixerInput::GetOutputDeviceInfo() { |
| 119 return mixer_ | 119 return mixer_ |
| 120 ? mixer_->GetOutputDeviceInfo() | 120 ? mixer_->GetOutputDeviceInfo() |
| 121 : mixer_pool_->GetOutputDeviceInfo(owner_id_, 0 /* session_id */, | 121 : mixer_pool_->GetOutputDeviceInfo(owner_id_, 0 /* session_id */, |
| 122 device_id_, security_origin_); | 122 device_id_, security_origin_); |
| 123 } | 123 } |
| 124 | 124 |
| 125 bool AudioRendererMixerInput::CurrentThreadIsRenderingThread() { | 125 bool AudioRendererMixerInput::CurrentThreadIsRenderingThread() { |
| 126 NOTIMPLEMENTED(); | 126 // The users of this class are required to handle thread safety. In |
| 127 return false; | 127 // particular, the AudioConverter uses a lock when calling Stop(), where |
| 128 // |mixer_| is cleared, and also in its render call, where this function is | |
| 129 // called. | |
| 130 return mixer_ && mixer_->CurrentThreadIsRenderingThread(); | |
|
o1ka
2016/06/21 12:43:09
I would say something like:
This method is expecte
DaleCurtis
2016/06/21 19:50:03
Can we just DCHECK(mixer_)?
Henrik Grunell
2016/06/23 06:19:55
No need to DCHECK since it'll crash when dereferen
Henrik Grunell
2016/06/23 06:19:55
I'd prefer a more general and shorter comment. :)
| |
| 128 } | 131 } |
| 129 | 132 |
| 130 void AudioRendererMixerInput::SwitchOutputDevice( | 133 void AudioRendererMixerInput::SwitchOutputDevice( |
| 131 const std::string& device_id, | 134 const std::string& device_id, |
| 132 const url::Origin& security_origin, | 135 const url::Origin& security_origin, |
| 133 const OutputDeviceStatusCB& callback) { | 136 const OutputDeviceStatusCB& callback) { |
| 134 if (!mixer_) { | 137 if (!mixer_) { |
| 135 if (pending_switch_callback_.is_null()) { | 138 if (pending_switch_callback_.is_null()) { |
| 136 pending_switch_callback_ = callback; | 139 pending_switch_callback_ = callback; |
| 137 pending_switch_device_id_ = device_id; | 140 pending_switch_device_id_ = device_id; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 188 base::AutoLock auto_lock(volume_lock_); | 191 base::AutoLock auto_lock(volume_lock_); |
| 189 return frames_filled > 0 ? volume_ : 0; | 192 return frames_filled > 0 ? volume_ : 0; |
| 190 } | 193 } |
| 191 } | 194 } |
| 192 | 195 |
| 193 void AudioRendererMixerInput::OnRenderError() { | 196 void AudioRendererMixerInput::OnRenderError() { |
| 194 callback_->OnRenderError(); | 197 callback_->OnRenderError(); |
| 195 } | 198 } |
| 196 | 199 |
| 197 } // namespace media | 200 } // namespace media |
| OLD | NEW |