diff options
author | michaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-01 22:28:32 +0000 |
---|---|---|
committer | michaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-01 22:28:32 +0000 |
commit | aa98f50abfe6245f8beceabc1730d54c89f2c6e7 (patch) | |
tree | f94efa392593b1ef847314d998e5341ffc68dba6 /media | |
parent | b101d00f810da212f7cb84eacc98b3d488d62596 (diff) | |
download | chromium_src-aa98f50abfe6245f8beceabc1730d54c89f2c6e7.zip chromium_src-aa98f50abfe6245f8beceabc1730d54c89f2c6e7.tar.gz chromium_src-aa98f50abfe6245f8beceabc1730d54c89f2c6e7.tar.bz2 |
Revert 87535 - Better memory management for audio channel swizzle code.
This patch fixes some of the errors created by: http://codereview.chromium.org/7047020/
To see memory issue suppressions, see http://codereview.chromium.org/7077020/ and http://codereview.chromium.org/7085020/
BUG=84142
TEST=tools/valgrind/chrome_tests.sh -t media --gtest_filter=MacAudioTest.*
Review URL: http://codereview.chromium.org/7094007
TBR=annacc@chromium.org
Review URL: http://codereview.chromium.org/7074037
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@87540 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r-- | media/audio/mac/audio_output_mac.cc | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/media/audio/mac/audio_output_mac.cc b/media/audio/mac/audio_output_mac.cc index cbc4f9e..b8e2938 100644 --- a/media/audio/mac/audio_output_mac.cc +++ b/media/audio/mac/audio_output_mac.cc @@ -42,18 +42,14 @@ enum { PCMQueueOutAudioOutputStream::PCMQueueOutAudioOutputStream( AudioManagerMac* manager, AudioParameters params) - : audio_queue_(NULL), + : format_(), + audio_queue_(NULL), + buffer_(), source_(NULL), manager_(manager), - packet_size_(params.GetPacketSize()), silence_bytes_(0), volume_(1), - pending_bytes_(0), - num_source_channels_(params.channels), - source_layout_(params.channel_layout), - num_core_channels_(0), - should_swizzle_(false), - should_down_mix_(false) { + pending_bytes_(0) { // We must have a manager. DCHECK(manager_); // A frame is one sample across all channels. In interleaved audio the per @@ -68,8 +64,9 @@ PCMQueueOutAudioOutputStream::PCMQueueOutAudioOutputStream( format_.mBytesPerPacket = (format_.mBitsPerChannel * params.channels) / 8; format_.mBytesPerFrame = format_.mBytesPerPacket; - memset(core_channel_orderings_, 0, sizeof(core_channel_orderings_)); - memset(channel_remap_, 0, sizeof(channel_remap_)); + packet_size_ = params.GetPacketSize(); + num_source_channels_ = params.channels; + source_layout_ = params.channel_layout; if (params.bits_per_sample > 8) { format_.mFormatFlags |= kLinearPCMFormatFlagIsSignedInteger; @@ -119,12 +116,10 @@ bool PCMQueueOutAudioOutputStream::Open() { HandleError(err); return false; } - // Get the device's channel layout. This layout may vary in sized based on - // the number of channels. Use |core_layout_size| to allocate memory. - scoped_ptr_malloc<AudioChannelLayout> core_channel_layout; + // Get the device's channel layout. + scoped_ptr<AudioChannelLayout> core_channel_layout; core_channel_layout.reset( - reinterpret_cast<AudioChannelLayout*>(malloc(core_layout_size))); - memset(core_channel_layout.get(), 0, core_layout_size); + reinterpret_cast<AudioChannelLayout*>(new char[core_layout_size])); err = AudioDeviceGetProperty(device_id, 0, false, kAudioDevicePropertyPreferredChannelLayout, &core_layout_size, core_channel_layout.get()); @@ -222,7 +217,6 @@ bool PCMQueueOutAudioOutputStream::Open() { break; default: DLOG(WARNING) << "Channel label not supported"; - channel_remap_[i] = kEmptyChannel; break; } } |