| 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 <string> |
| 10 |
| 9 #include "base/bind.h" | 11 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
| 11 #include "base/logging.h" | 13 #include "base/logging.h" |
| 12 #include "base/mac/mac_logging.h" | 14 #include "base/mac/mac_logging.h" |
| 13 #include "base/metrics/histogram_macros.h" | 15 #include "base/metrics/histogram_macros.h" |
| 14 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
| 15 #include "base/time/time.h" | 17 #include "base/time/time.h" |
| 16 #include "base/trace_event/trace_event.h" | 18 #include "base/trace_event/trace_event.h" |
| 17 #include "media/audio/mac/audio_manager_mac.h" | 19 #include "media/audio/mac/audio_manager_mac.h" |
| 18 #include "media/base/audio_pull_fifo.h" | 20 #include "media/base/audio_pull_fifo.h" |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 void AUHALStream::ProvideInput(int frame_delay, AudioBus* dest) { | 256 void AUHALStream::ProvideInput(int frame_delay, AudioBus* dest) { |
| 255 base::AutoLock auto_lock(source_lock_); | 257 base::AutoLock auto_lock(source_lock_); |
| 256 if (!source_) { | 258 if (!source_) { |
| 257 dest->Zero(); | 259 dest->Zero(); |
| 258 return; | 260 return; |
| 259 } | 261 } |
| 260 | 262 |
| 261 // Supply the input data and render the output data. | 263 // Supply the input data and render the output data. |
| 262 source_->OnMoreData(dest, current_hardware_pending_bytes_ + | 264 source_->OnMoreData(dest, current_hardware_pending_bytes_ + |
| 263 frame_delay * params_.GetBytesPerFrame(), | 265 frame_delay * params_.GetBytesPerFrame(), |
| 264 current_lost_frames_); | 266 base::TimeDelta(), current_lost_frames_); |
| 265 dest->Scale(volume_); | 267 dest->Scale(volume_); |
| 266 current_lost_frames_ = 0; | 268 current_lost_frames_ = 0; |
| 267 } | 269 } |
| 268 | 270 |
| 269 // AUHAL callback. | 271 // AUHAL callback. |
| 270 OSStatus AUHALStream::InputProc( | 272 OSStatus AUHALStream::InputProc( |
| 271 void* user_data, | 273 void* user_data, |
| 272 AudioUnitRenderActionFlags* flags, | 274 AudioUnitRenderActionFlags* flags, |
| 273 const AudioTimeStamp* output_time_stamp, | 275 const AudioTimeStamp* output_time_stamp, |
| 274 UInt32 bus_number, | 276 UInt32 bus_number, |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 OSStatus result = AudioUnitUninitialize(audio_unit_); | 557 OSStatus result = AudioUnitUninitialize(audio_unit_); |
| 556 OSSTATUS_DLOG_IF(ERROR, result != noErr, result) | 558 OSSTATUS_DLOG_IF(ERROR, result != noErr, result) |
| 557 << "AudioUnitUninitialize() failed."; | 559 << "AudioUnitUninitialize() failed."; |
| 558 result = AudioComponentInstanceDispose(audio_unit_); | 560 result = AudioComponentInstanceDispose(audio_unit_); |
| 559 OSSTATUS_DLOG_IF(ERROR, result != noErr, result) | 561 OSSTATUS_DLOG_IF(ERROR, result != noErr, result) |
| 560 << "AudioComponentInstanceDispose() failed."; | 562 << "AudioComponentInstanceDispose() failed."; |
| 561 audio_unit_ = 0; | 563 audio_unit_ = 0; |
| 562 } | 564 } |
| 563 | 565 |
| 564 } // namespace media | 566 } // namespace media |
| OLD | NEW |