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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 AudioBufferList* data) { | 206 AudioBufferList* data) { |
207 TRACE_EVENT0("audio", "AUHALStream::Render"); | 207 TRACE_EVENT0("audio", "AUHALStream::Render"); |
208 | 208 |
209 UpdatePlayoutTimestamp(output_time_stamp); | 209 UpdatePlayoutTimestamp(output_time_stamp); |
210 | 210 |
211 // If the stream parameters change for any reason, we need to insert a FIFO | 211 // If the stream parameters change for any reason, we need to insert a FIFO |
212 // since the OnMoreData() pipeline can't handle frame size changes. | 212 // since the OnMoreData() pipeline can't handle frame size changes. |
213 if (number_of_frames != number_of_frames_) { | 213 if (number_of_frames != number_of_frames_) { |
214 // Create a FIFO on the fly to handle any discrepancies in callback rates. | 214 // Create a FIFO on the fly to handle any discrepancies in callback rates. |
215 if (!audio_fifo_) { | 215 if (!audio_fifo_) { |
| 216 // TODO(grunell): We'll only care about the first buffer size change, |
| 217 // any further changes will be ignored. It would be nice to have all |
| 218 // changes reflected in UMA stats. |
216 number_of_frames_requested_ = number_of_frames; | 219 number_of_frames_requested_ = number_of_frames; |
217 DVLOG(1) << "Audio frame size changed from " << number_of_frames_ | 220 DVLOG(1) << "Audio frame size changed from " << number_of_frames_ |
218 << " to " << number_of_frames | 221 << " to " << number_of_frames |
219 << "; adding FIFO to compensate."; | 222 << "; adding FIFO to compensate."; |
220 audio_fifo_.reset(new AudioPullFifo( | 223 audio_fifo_.reset(new AudioPullFifo( |
221 output_channels_, | 224 output_channels_, |
222 number_of_frames_, | 225 number_of_frames_, |
223 base::Bind(&AUHALStream::ProvideInput, base::Unretained(this)))); | 226 base::Bind(&AUHALStream::ProvideInput, base::Unretained(this)))); |
224 } | 227 } |
225 } | 228 } |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 OSStatus result = AudioUnitUninitialize(audio_unit_); | 546 OSStatus result = AudioUnitUninitialize(audio_unit_); |
544 OSSTATUS_DLOG_IF(ERROR, result != noErr, result) | 547 OSSTATUS_DLOG_IF(ERROR, result != noErr, result) |
545 << "AudioUnitUninitialize() failed."; | 548 << "AudioUnitUninitialize() failed."; |
546 result = AudioComponentInstanceDispose(audio_unit_); | 549 result = AudioComponentInstanceDispose(audio_unit_); |
547 OSSTATUS_DLOG_IF(ERROR, result != noErr, result) | 550 OSSTATUS_DLOG_IF(ERROR, result != noErr, result) |
548 << "AudioComponentInstanceDispose() failed."; | 551 << "AudioComponentInstanceDispose() failed."; |
549 audio_unit_ = 0; | 552 audio_unit_ = 0; |
550 } | 553 } |
551 | 554 |
552 } // namespace media | 555 } // namespace media |
OLD | NEW |