Chromium Code Reviews| Index: media/audio/mac/audio_output_mac.cc |
| diff --git a/media/audio/mac/audio_output_mac.cc b/media/audio/mac/audio_output_mac.cc |
| index 8d68b2755e4517e59896fc1975ca408d5580e9f2..86810c8115bc31ebd893091d262ee724fcd84114 100644 |
| --- a/media/audio/mac/audio_output_mac.cc |
| +++ b/media/audio/mac/audio_output_mac.cc |
| @@ -45,14 +45,14 @@ enum { |
| PCMQueueOutAudioOutputStream::PCMQueueOutAudioOutputStream( |
| AudioManagerMac* manager, AudioParameters params) |
| - : format_(), |
| - audio_queue_(NULL), |
| - buffer_(), |
| - source_(NULL), |
| - manager_(manager), |
| - silence_bytes_(0), |
| - volume_(1), |
| - pending_bytes_(0) { |
| + : format_(), |
| + audio_queue_(NULL), |
| + buffer_(), |
| + source_(NULL), |
| + manager_(manager), |
| + silence_bytes_(0), |
| + volume_(1), |
| + pending_bytes_(0) { |
| // We must have a manager. |
| DCHECK(manager_); |
| // A frame is one sample across all channels. In interleaved audio the per |
| @@ -68,6 +68,9 @@ PCMQueueOutAudioOutputStream::PCMQueueOutAudioOutputStream( |
| format_.mBytesPerPacket = (format_.mBitsPerChannel * params.channels) / 8; |
| format_.mBytesPerFrame = format_.mBytesPerPacket; |
| + packet_size_ = params.samples_per_packet * params.channels * |
|
scherkus (not reviewing)
2010/11/09 02:28:31
this seems to be duplicated a bit... can packet_si
Sergey Ulanov
2010/11/09 22:29:58
Done.
|
| + params.bits_per_sample / 8; |
| + |
| // Silence buffer has a duration of 6ms to simulate the behavior of Windows. |
| // This value is choosen by experiments and macs cannot keep up with |
| // anything less than 6ms. |
| @@ -87,11 +90,7 @@ void PCMQueueOutAudioOutputStream::HandleError(OSStatus err) { |
| NOTREACHED() << "error code " << err; |
| } |
| -bool PCMQueueOutAudioOutputStream::Open(uint32 packet_size) { |
| - if (0 == packet_size) { |
| - // TODO(cpu) : Impelement default buffer computation. |
| - return false; |
| - } |
| +bool PCMQueueOutAudioOutputStream::Open() { |
| // Create the actual queue object and let the OS use its own thread to |
| // run its CFRunLoop. |
| OSStatus err = AudioQueueNewOutput(&format_, RenderCallback, this, NULL, |
| @@ -102,7 +101,7 @@ bool PCMQueueOutAudioOutputStream::Open(uint32 packet_size) { |
| } |
| // Allocate the hardware-managed buffers. |
| for (uint32 ix = 0; ix != kNumBuffers; ++ix) { |
| - err = AudioQueueAllocateBuffer(audio_queue_, packet_size, &buffer_[ix]); |
| + err = AudioQueueAllocateBuffer(audio_queue_, packet_size_, &buffer_[ix]); |
| if (err != noErr) { |
| HandleError(err); |
| return false; |