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" | |
10 #include "base/bind.h" | 9 #include "base/bind.h" |
11 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
12 #include "base/logging.h" | 11 #include "base/logging.h" |
13 #include "base/mac/mac_logging.h" | 12 #include "base/mac/mac_logging.h" |
14 #include "base/metrics/histogram_macros.h" | 13 #include "base/metrics/histogram_macros.h" |
15 #include "base/time/time.h" | 14 #include "base/time/time.h" |
16 #include "base/trace_event/trace_event.h" | 15 #include "base/trace_event/trace_event.h" |
17 #include "media/audio/mac/audio_manager_mac.h" | 16 #include "media/audio/mac/audio_manager_mac.h" |
18 #include "media/base/audio_pull_fifo.h" | 17 #include "media/base/audio_pull_fifo.h" |
19 | 18 |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 number_of_frames_, | 232 number_of_frames_, |
234 base::Bind(&AUHALStream::ProvideInput, base::Unretained(this)))); | 233 base::Bind(&AUHALStream::ProvideInput, base::Unretained(this)))); |
235 } | 234 } |
236 } | 235 } |
237 | 236 |
238 // Make |output_bus_| wrap the output AudioBufferList. | 237 // Make |output_bus_| wrap the output AudioBufferList. |
239 WrapBufferList(data, output_bus_.get(), number_of_frames); | 238 WrapBufferList(data, output_bus_.get(), number_of_frames); |
240 | 239 |
241 // Update the playout latency. | 240 // Update the playout latency. |
242 const double playout_latency_frames = GetPlayoutLatency(output_time_stamp); | 241 const double playout_latency_frames = GetPlayoutLatency(output_time_stamp); |
243 current_hardware_pending_bytes_ = static_cast<uint32>( | 242 current_hardware_pending_bytes_ = static_cast<uint32_t>( |
244 (playout_latency_frames + 0.5) * params_.GetBytesPerFrame()); | 243 (playout_latency_frames + 0.5) * params_.GetBytesPerFrame()); |
245 | 244 |
246 if (audio_fifo_) | 245 if (audio_fifo_) |
247 audio_fifo_->Consume(output_bus_.get(), output_bus_->frames()); | 246 audio_fifo_->Consume(output_bus_.get(), output_bus_->frames()); |
248 else | 247 else |
249 ProvideInput(0, output_bus_.get()); | 248 ProvideInput(0, output_bus_.get()); |
250 | 249 |
251 last_number_of_frames_ = number_of_frames; | 250 last_number_of_frames_ = number_of_frames; |
252 | 251 |
253 return noErr; | 252 return noErr; |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 OSStatus result = AudioUnitUninitialize(audio_unit_); | 544 OSStatus result = AudioUnitUninitialize(audio_unit_); |
546 OSSTATUS_DLOG_IF(ERROR, result != noErr, result) | 545 OSSTATUS_DLOG_IF(ERROR, result != noErr, result) |
547 << "AudioUnitUninitialize() failed."; | 546 << "AudioUnitUninitialize() failed."; |
548 result = AudioComponentInstanceDispose(audio_unit_); | 547 result = AudioComponentInstanceDispose(audio_unit_); |
549 OSSTATUS_DLOG_IF(ERROR, result != noErr, result) | 548 OSSTATUS_DLOG_IF(ERROR, result != noErr, result) |
550 << "AudioComponentInstanceDispose() failed."; | 549 << "AudioComponentInstanceDispose() failed."; |
551 audio_unit_ = 0; | 550 audio_unit_ = 0; |
552 } | 551 } |
553 | 552 |
554 } // namespace media | 553 } // namespace media |
OLD | NEW |