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/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 // Pulls on our provider to get rendered audio stream. | 204 // Pulls on our provider to get rendered audio stream. |
205 // Note to future hackers of this function: Do not add locks which can | 205 // Note to future hackers of this function: Do not add locks which can |
206 // be contended in the middle of stream processing here (starting and stopping | 206 // be contended in the middle of stream processing here (starting and stopping |
207 // the stream are ok) because this is running on a real-time thread. | 207 // the stream are ok) because this is running on a real-time thread. |
208 OSStatus AUHALStream::Render( | 208 OSStatus AUHALStream::Render( |
209 AudioUnitRenderActionFlags* flags, | 209 AudioUnitRenderActionFlags* flags, |
210 const AudioTimeStamp* output_time_stamp, | 210 const AudioTimeStamp* output_time_stamp, |
211 UInt32 bus_number, | 211 UInt32 bus_number, |
212 UInt32 number_of_frames, | 212 UInt32 number_of_frames, |
213 AudioBufferList* data) { | 213 AudioBufferList* data) { |
214 TRACE_EVENT0("audio", "AUHALStream::Render"); | 214 TRACE_EVENT2("audio", "AUHALStream::Render", "input buffer size", |
| 215 number_of_frames_, "output buffer size", number_of_frames); |
215 | 216 |
216 UpdatePlayoutTimestamp(output_time_stamp); | 217 UpdatePlayoutTimestamp(output_time_stamp); |
217 | 218 |
218 // If the stream parameters change for any reason, we need to insert a FIFO | 219 // If the stream parameters change for any reason, we need to insert a FIFO |
219 // since the OnMoreData() pipeline can't handle frame size changes. | 220 // since the OnMoreData() pipeline can't handle frame size changes. |
220 if (number_of_frames != number_of_frames_) { | 221 if (number_of_frames != number_of_frames_) { |
221 // Create a FIFO on the fly to handle any discrepancies in callback rates. | 222 // Create a FIFO on the fly to handle any discrepancies in callback rates. |
222 if (!audio_fifo_) { | 223 if (!audio_fifo_) { |
223 // TODO(grunell): We'll only care about the first buffer size change, | 224 // TODO(grunell): We'll only care about the first buffer size change, |
224 // any further changes will be ignored. It would be nice to have all | 225 // any further changes will be ignored. It would be nice to have all |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 OSStatus result = AudioUnitUninitialize(audio_unit_); | 556 OSStatus result = AudioUnitUninitialize(audio_unit_); |
556 OSSTATUS_DLOG_IF(ERROR, result != noErr, result) | 557 OSSTATUS_DLOG_IF(ERROR, result != noErr, result) |
557 << "AudioUnitUninitialize() failed."; | 558 << "AudioUnitUninitialize() failed."; |
558 result = AudioComponentInstanceDispose(audio_unit_); | 559 result = AudioComponentInstanceDispose(audio_unit_); |
559 OSSTATUS_DLOG_IF(ERROR, result != noErr, result) | 560 OSSTATUS_DLOG_IF(ERROR, result != noErr, result) |
560 << "AudioComponentInstanceDispose() failed."; | 561 << "AudioComponentInstanceDispose() failed."; |
561 audio_unit_ = 0; | 562 audio_unit_ = 0; |
562 } | 563 } |
563 | 564 |
564 } // namespace media | 565 } // namespace media |
OLD | NEW |