| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_low_latency_output_mac.h" | 5 #include "media/audio/mac/audio_low_latency_output_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/logging.h" | 10 #include "base/logging.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 // packet is always one frame. | 40 // packet is always one frame. |
| 41 format_.mSampleRate = params.sample_rate; | 41 format_.mSampleRate = params.sample_rate; |
| 42 format_.mFormatID = kAudioFormatLinearPCM; | 42 format_.mFormatID = kAudioFormatLinearPCM; |
| 43 format_.mFormatFlags = kLinearPCMFormatFlagIsPacked | | 43 format_.mFormatFlags = kLinearPCMFormatFlagIsPacked | |
| 44 kLinearPCMFormatFlagIsSignedInteger; | 44 kLinearPCMFormatFlagIsSignedInteger; |
| 45 format_.mBitsPerChannel = params.bits_per_sample; | 45 format_.mBitsPerChannel = params.bits_per_sample; |
| 46 format_.mChannelsPerFrame = params.channels; | 46 format_.mChannelsPerFrame = params.channels; |
| 47 format_.mFramesPerPacket = 1; | 47 format_.mFramesPerPacket = 1; |
| 48 format_.mBytesPerPacket = (format_.mBitsPerChannel * params.channels) / 8; | 48 format_.mBytesPerPacket = (format_.mBitsPerChannel * params.channels) / 8; |
| 49 format_.mBytesPerFrame = format_.mBytesPerPacket; | 49 format_.mBytesPerFrame = format_.mBytesPerPacket; |
| 50 format_.mReserved = 0; |
| 50 | 51 |
| 51 // Calculate the number of sample frames per callback. | 52 // Calculate the number of sample frames per callback. |
| 52 number_of_frames_ = params.GetPacketSize() / format_.mBytesPerPacket; | 53 number_of_frames_ = params.GetPacketSize() / format_.mBytesPerPacket; |
| 53 } | 54 } |
| 54 | 55 |
| 55 AUAudioOutputStream::~AUAudioOutputStream() { | 56 AUAudioOutputStream::~AUAudioOutputStream() { |
| 56 } | 57 } |
| 57 | 58 |
| 58 bool AUAudioOutputStream::Open() { | 59 bool AUAudioOutputStream::Open() { |
| 59 // Open and initialize the DefaultOutputUnit. | 60 // Open and initialize the DefaultOutputUnit. |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 0, | 239 0, |
| 239 0, | 240 0, |
| 240 &info_size, | 241 &info_size, |
| 241 &nominal_sample_rate); | 242 &nominal_sample_rate); |
| 242 DCHECK_EQ(result, 0); | 243 DCHECK_EQ(result, 0); |
| 243 if (result) | 244 if (result) |
| 244 return 0.0; // error | 245 return 0.0; // error |
| 245 | 246 |
| 246 return nominal_sample_rate; | 247 return nominal_sample_rate; |
| 247 } | 248 } |
| OLD | NEW |