| 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/audio/mac/audio_auhal_mac.h" | 5 #include "media/audio/mac/audio_auhal_mac.h" |
| 6 | 6 |
| 7 #include <CoreServices/CoreServices.h> | 7 #include <CoreServices/CoreServices.h> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 | 171 |
| 172 AudioOutputUnitStop(audio_unit_); | 172 AudioOutputUnitStop(audio_unit_); |
| 173 | 173 |
| 174 base::AutoLock auto_lock(source_lock_); | 174 base::AutoLock auto_lock(source_lock_); |
| 175 source_ = NULL; | 175 source_ = NULL; |
| 176 stopped_ = true; | 176 stopped_ = true; |
| 177 } | 177 } |
| 178 | 178 |
| 179 void AUHALStream::SetVolume(double volume) { | 179 void AUHALStream::SetVolume(double volume) { |
| 180 volume_ = static_cast<float>(volume); | 180 volume_ = static_cast<float>(volume); |
| 181 | |
| 182 // TODO(crogers): set volume property | |
| 183 } | 181 } |
| 184 | 182 |
| 185 void AUHALStream::GetVolume(double* volume) { | 183 void AUHALStream::GetVolume(double* volume) { |
| 186 *volume = volume_; | 184 *volume = volume_; |
| 187 } | 185 } |
| 188 | 186 |
| 189 // Pulls on our provider to get rendered audio stream. | 187 // Pulls on our provider to get rendered audio stream. |
| 190 // Note to future hackers of this function: Do not add locks which can | 188 // Note to future hackers of this function: Do not add locks which can |
| 191 // be contended in the middle of stream processing here (starting and stopping | 189 // be contended in the middle of stream processing here (starting and stopping |
| 192 // the stream are ok) because this is running on a real-time thread. | 190 // the stream are ok) because this is running on a real-time thread. |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 if (!source_) { | 242 if (!source_) { |
| 245 ZeroBufferList(io_data); | 243 ZeroBufferList(io_data); |
| 246 return noErr; | 244 return noErr; |
| 247 } | 245 } |
| 248 | 246 |
| 249 // Supply the input data and render the output data. | 247 // Supply the input data and render the output data. |
| 250 source_->OnMoreIOData( | 248 source_->OnMoreIOData( |
| 251 input_bus_.get(), | 249 input_bus_.get(), |
| 252 output_bus_.get(), | 250 output_bus_.get(), |
| 253 AudioBuffersState(0, hardware_pending_bytes)); | 251 AudioBuffersState(0, hardware_pending_bytes)); |
| 252 output_bus_->Scale(volume_); |
| 254 } | 253 } |
| 255 | 254 |
| 256 return noErr; | 255 return noErr; |
| 257 } | 256 } |
| 258 | 257 |
| 259 // AUHAL callback. | 258 // AUHAL callback. |
| 260 OSStatus AUHALStream::InputProc( | 259 OSStatus AUHALStream::InputProc( |
| 261 void* user_data, | 260 void* user_data, |
| 262 AudioUnitRenderActionFlags* flags, | 261 AudioUnitRenderActionFlags* flags, |
| 263 const AudioTimeStamp* output_time_stamp, | 262 const AudioTimeStamp* output_time_stamp, |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 0, | 519 0, |
| 521 &callback, | 520 &callback, |
| 522 sizeof(callback)); | 521 sizeof(callback)); |
| 523 if (result != noErr) | 522 if (result != noErr) |
| 524 return false; | 523 return false; |
| 525 | 524 |
| 526 return true; | 525 return true; |
| 527 } | 526 } |
| 528 | 527 |
| 529 } // namespace media | 528 } // namespace media |
| OLD | NEW |