OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_input_mac.h" | 5 #include "media/audio/mac/audio_input_mac.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "media/audio/audio_util.h" | 9 #include "media/audio/audio_util.h" |
10 #include "media/audio/mac/audio_manager_mac.h" | 10 #include "media/audio/mac/audio_manager_mac.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 // packet is always one frame. | 29 // packet is always one frame. |
30 format_.mSampleRate = params.sample_rate; | 30 format_.mSampleRate = params.sample_rate; |
31 format_.mFormatID = kAudioFormatLinearPCM; | 31 format_.mFormatID = kAudioFormatLinearPCM; |
32 format_.mFormatFlags = kLinearPCMFormatFlagIsPacked | | 32 format_.mFormatFlags = kLinearPCMFormatFlagIsPacked | |
33 kLinearPCMFormatFlagIsSignedInteger; | 33 kLinearPCMFormatFlagIsSignedInteger; |
34 format_.mBitsPerChannel = params.bits_per_sample; | 34 format_.mBitsPerChannel = params.bits_per_sample; |
35 format_.mChannelsPerFrame = params.channels; | 35 format_.mChannelsPerFrame = params.channels; |
36 format_.mFramesPerPacket = 1; | 36 format_.mFramesPerPacket = 1; |
37 format_.mBytesPerPacket = (params.bits_per_sample * params.channels) / 8; | 37 format_.mBytesPerPacket = (params.bits_per_sample * params.channels) / 8; |
38 format_.mBytesPerFrame = format_.mBytesPerPacket; | 38 format_.mBytesPerFrame = format_.mBytesPerPacket; |
| 39 format_.mReserved = 0; |
39 | 40 |
40 buffer_size_bytes_ = params.GetPacketSize(); | 41 buffer_size_bytes_ = params.GetPacketSize(); |
41 } | 42 } |
42 | 43 |
43 PCMQueueInAudioInputStream::~PCMQueueInAudioInputStream() { | 44 PCMQueueInAudioInputStream::~PCMQueueInAudioInputStream() { |
44 DCHECK(!callback_); | 45 DCHECK(!callback_); |
45 DCHECK(!audio_queue_); | 46 DCHECK(!audio_queue_); |
46 } | 47 } |
47 | 48 |
48 bool PCMQueueInAudioInputStream::Open() { | 49 bool PCMQueueInAudioInputStream::Open() { |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 // TODO(joth): PCMQueueOutAudioOutputStream uses callback_ to provide an | 170 // TODO(joth): PCMQueueOutAudioOutputStream uses callback_ to provide an |
170 // extra guard for this situation, but it seems to introduce more | 171 // extra guard for this situation, but it seems to introduce more |
171 // complications than it solves (memory barrier issues accessing it from | 172 // complications than it solves (memory barrier issues accessing it from |
172 // multiple threads, looses the means to indicate OnClosed to client). | 173 // multiple threads, looses the means to indicate OnClosed to client). |
173 // Should determine if we need to do something equivalent here. | 174 // Should determine if we need to do something equivalent here. |
174 return; | 175 return; |
175 } | 176 } |
176 HandleError(err); | 177 HandleError(err); |
177 } | 178 } |
178 } | 179 } |
OLD | NEW |