| 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_output_mac.h" | 5 #include "media/audio/mac/audio_output_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 "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "media/audio/audio_util.h" | 10 #include "media/audio/audio_util.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 // frame fields identify the set of n |channels|. In uncompressed audio, a | 60 // frame fields identify the set of n |channels|. In uncompressed audio, a |
| 61 // packet is always one frame. | 61 // packet is always one frame. |
| 62 format_.mSampleRate = params.sample_rate; | 62 format_.mSampleRate = params.sample_rate; |
| 63 format_.mFormatID = kAudioFormatLinearPCM; | 63 format_.mFormatID = kAudioFormatLinearPCM; |
| 64 format_.mFormatFlags = kLinearPCMFormatFlagIsPacked; | 64 format_.mFormatFlags = kLinearPCMFormatFlagIsPacked; |
| 65 format_.mBitsPerChannel = params.bits_per_sample; | 65 format_.mBitsPerChannel = params.bits_per_sample; |
| 66 format_.mChannelsPerFrame = params.channels; | 66 format_.mChannelsPerFrame = params.channels; |
| 67 format_.mFramesPerPacket = 1; | 67 format_.mFramesPerPacket = 1; |
| 68 format_.mBytesPerPacket = (format_.mBitsPerChannel * params.channels) / 8; | 68 format_.mBytesPerPacket = (format_.mBitsPerChannel * params.channels) / 8; |
| 69 format_.mBytesPerFrame = format_.mBytesPerPacket; | 69 format_.mBytesPerFrame = format_.mBytesPerPacket; |
| 70 format_.mReserved = 0; |
| 70 | 71 |
| 72 memset(buffer_, 0, sizeof(buffer_)); |
| 71 memset(core_channel_orderings_, 0, sizeof(core_channel_orderings_)); | 73 memset(core_channel_orderings_, 0, sizeof(core_channel_orderings_)); |
| 72 memset(channel_remap_, 0, sizeof(channel_remap_)); | 74 memset(channel_remap_, 0, sizeof(channel_remap_)); |
| 73 | 75 |
| 74 if (params.bits_per_sample > 8) { | 76 if (params.bits_per_sample > 8) { |
| 75 format_.mFormatFlags |= kLinearPCMFormatFlagIsSignedInteger; | 77 format_.mFormatFlags |= kLinearPCMFormatFlagIsSignedInteger; |
| 76 } | 78 } |
| 77 | 79 |
| 78 // Silence buffer has a duration of 6ms to simulate the behavior of Windows. | 80 // Silence buffer has a duration of 6ms to simulate the behavior of Windows. |
| 79 // This value is choosen by experiments and macs cannot keep up with | 81 // This value is choosen by experiments and macs cannot keep up with |
| 80 // anything less than 6ms. | 82 // anything less than 6ms. |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 HandleError(err); | 490 HandleError(err); |
| 489 return; | 491 return; |
| 490 } | 492 } |
| 491 } | 493 } |
| 492 err = AudioQueueStart(audio_queue_, NULL); | 494 err = AudioQueueStart(audio_queue_, NULL); |
| 493 if (err != noErr) { | 495 if (err != noErr) { |
| 494 HandleError(err); | 496 HandleError(err); |
| 495 return; | 497 return; |
| 496 } | 498 } |
| 497 } | 499 } |
| OLD | NEW |