diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-05 06:39:06 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-05 06:39:06 +0000 |
commit | f6eeded10a75632e1bc5ecaad9be46553c4ab908 (patch) | |
tree | 8a400e987cd72f1a4b799ce086f3d4169d87b0e9 /media | |
parent | 29a984ff619eb0bdd27bc612bed55f6146cce4fe (diff) | |
download | chromium_src-f6eeded10a75632e1bc5ecaad9be46553c4ab908.zip chromium_src-f6eeded10a75632e1bc5ecaad9be46553c4ab908.tar.gz chromium_src-f6eeded10a75632e1bc5ecaad9be46553c4ab908.tar.bz2 |
Remove size_t from audio IPC code.
The change got to this size because I had to modify the surrounding code (I didn't want to just cast at the last minute).
Review URL: http://codereview.chromium.org/577006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38192 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
26 files changed, 244 insertions, 242 deletions
diff --git a/media/audio/audio_output.h b/media/audio/audio_output.h index 2d249d7..6b87a68 100644 --- a/media/audio/audio_output.h +++ b/media/audio/audio_output.h @@ -1,4 +1,4 @@ -// Copyright (c) 2008-2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -55,8 +55,8 @@ class AudioOutputStream { // |dest| is platform and format specific. // |pending_bytes| is the number of bytes will be played before the // requested data is played. - virtual size_t OnMoreData(AudioOutputStream* stream, void* dest, - size_t max_size, int pending_bytes) = 0; + virtual uint32 OnMoreData(AudioOutputStream* stream, void* dest, + uint32 max_size, uint32 pending_bytes) = 0; // The stream is done with this callback. After this call the audio source // can go away or be destroyed. @@ -80,7 +80,7 @@ class AudioOutputStream { // // TODO(ajwong): Streams are not reusable, so try to move packet_size into the // constructor. - virtual bool Open(size_t packet_size) = 0; + virtual bool Open(uint32 packet_size) = 0; // Starts playing audio and generating AudioSourceCallback::OnMoreData(). // Since implementor of AudioOutputStream may have internal buffers, right @@ -120,11 +120,11 @@ class AudioManager { }; // Telephone quality sample rate, mostly for speech-only audio. - static const int kTelephoneSampleRate = 8000; + static const uint32 kTelephoneSampleRate = 8000; // CD sampling rate is 44.1 KHz or conveniently 2x2x3x3x5x5x7x7. - static const int kAudioCDSampleRate = 44100; + static const uint32 kAudioCDSampleRate = 44100; // Digital Audio Tape sample rate. - static const int kAudioDATSampleRate = 48000; + static const uint32 kAudioDATSampleRate = 48000; // Returns true if the OS reports existence of audio devices. This does not // guarantee that the existing devices support all formats and sample rates. diff --git a/media/audio/fake_audio_output_stream.cc b/media/audio/fake_audio_output_stream.cc index cd57719..8bfa28e 100644 --- a/media/audio/fake_audio_output_stream.cc +++ b/media/audio/fake_audio_output_stream.cc @@ -1,10 +1,11 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/at_exit.h" #include "media/audio/fake_audio_output_stream.h" +#include "base/at_exit.h" + bool FakeAudioOutputStream::has_created_fake_stream_ = false; FakeAudioOutputStream* FakeAudioOutputStream::last_fake_stream_ = NULL; @@ -22,7 +23,7 @@ FakeAudioOutputStream* FakeAudioOutputStream::GetLastFakeStream() { return last_fake_stream_; } -bool FakeAudioOutputStream::Open(size_t packet_size) { +bool FakeAudioOutputStream::Open(uint32 packet_size) { if (packet_size < sizeof(int16)) return false; packet_size_ = packet_size; diff --git a/media/audio/fake_audio_output_stream.h b/media/audio/fake_audio_output_stream.h index 5c7da82..59afec7 100644 --- a/media/audio/fake_audio_output_stream.h +++ b/media/audio/fake_audio_output_stream.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // @@ -19,7 +19,7 @@ class FakeAudioOutputStream : public AudioOutputStream { static AudioOutputStream* MakeFakeStream(); static FakeAudioOutputStream* GetLastFakeStream(); - virtual bool Open(size_t packet_size); + virtual bool Open(uint32 packet_size); virtual void Start(AudioSourceCallback* callback); virtual void Stop(); virtual void SetVolume(double volume); @@ -40,7 +40,7 @@ class FakeAudioOutputStream : public AudioOutputStream { double volume_; AudioSourceCallback* callback_; scoped_array<char> buffer_; - size_t packet_size_; + uint32 packet_size_; DISALLOW_COPY_AND_ASSIGN(FakeAudioOutputStream); }; diff --git a/media/audio/linux/alsa_output.cc b/media/audio/linux/alsa_output.cc index d878a74..8971ca6 100644 --- a/media/audio/linux/alsa_output.cc +++ b/media/audio/linux/alsa_output.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // @@ -86,12 +86,12 @@ // Amount of time to wait if we've exhausted the data source. This is to avoid // busy looping. -static const int kNoDataSleepMilliseconds = 10; +static const uint32 kNoDataSleepMilliseconds = 10; // According to the linux nanosleep manpage, nanosleep on linux can miss the // deadline by up to 10ms because the kernel timeslice is 10ms. Give a 2x // buffer to compensate for the timeslice, and any additional slowdowns. -static const int kSleepErrorMilliseconds = 20; +static const uint32 kSleepErrorMilliseconds = 20; // Set to 0 during debugging if you want error messages due to underrun // events or other recoverable errors. @@ -107,14 +107,14 @@ const char AlsaPcmOutputStream::kPlugPrefix[] = "plug:"; // Since we expect to only be able to wake up with a resolution of // kSleepErrorMilliseconds, double that for our minimum required latency. -const int AlsaPcmOutputStream::kMinLatencyMicros = +const uint32 AlsaPcmOutputStream::kMinLatencyMicros = kSleepErrorMilliseconds * 2 * 1000; namespace { // ALSA is currently limited to 48Khz. // TODO(fbarchard): Resample audio from higher frequency to 48000. -const int kMaxSampleRate = 48000; +const uint32 kMaxSampleRate = 48000; snd_pcm_format_t BitsToFormat(char bits_per_sample) { switch (bits_per_sample) { @@ -152,7 +152,7 @@ snd_pcm_format_t BitsToFormat(char bits_per_sample) { // TODO(ajwong): The source data should have enough info to tell us if we want // surround41 versus surround51, etc., instead of needing us to guess base don // channel number. Fix API to pass that data down. -const char* GuessSpecificDeviceName(int channels) { +const char* GuessSpecificDeviceName(uint32 channels) { switch (channels) { case 8: return "surround71"; @@ -177,10 +177,10 @@ const char* GuessSpecificDeviceName(int channels) { // Reorder PCM from AAC layout to Alsa layout. // TODO(fbarchard): Switch layout when ffmpeg is updated. template<class Format> -static void Swizzle50Layout(Format* b, size_t filled) { - static const int kNumSurroundChannels = 5; +static void Swizzle50Layout(Format* b, uint32 filled) { + static const uint32 kNumSurroundChannels = 5; Format aac[kNumSurroundChannels]; - for (size_t i = 0; i < filled; i += sizeof(aac), b += kNumSurroundChannels) { + for (uint32 i = 0; i < filled; i += sizeof(aac), b += kNumSurroundChannels) { memcpy(aac, b, sizeof(aac)); b[0] = aac[1]; // L b[1] = aac[2]; // R @@ -191,10 +191,10 @@ static void Swizzle50Layout(Format* b, size_t filled) { } template<class Format> -static void Swizzle51Layout(Format* b, size_t filled) { - static const int kNumSurroundChannels = 6; +static void Swizzle51Layout(Format* b, uint32 filled) { + static const uint32 kNumSurroundChannels = 6; Format aac[kNumSurroundChannels]; - for (size_t i = 0; i < filled; i += sizeof(aac), b += kNumSurroundChannels) { + for (uint32 i = 0; i < filled; i += sizeof(aac), b += kNumSurroundChannels) { memcpy(aac, b, sizeof(aac)); b[0] = aac[1]; // L b[1] = aac[2]; // R @@ -235,9 +235,9 @@ std::ostream& operator<<(std::ostream& os, AlsaPcmOutputStream::AlsaPcmOutputStream(const std::string& device_name, AudioManager::Format format, - int channels, - int sample_rate, - int bits_per_sample, + uint32 channels, + uint32 sample_rate, + uint32 bits_per_sample, AlsaWrapper* wrapper, AudioManagerLinux* manager, MessageLoop* message_loop) @@ -287,7 +287,7 @@ AlsaPcmOutputStream::~AlsaPcmOutputStream() { // where the stream is not always stopped and closed, causing this to fail. } -bool AlsaPcmOutputStream::Open(size_t packet_size) { +bool AlsaPcmOutputStream::Open(uint32 packet_size) { DCHECK_EQ(MessageLoop::current(), client_thread_loop_); DCHECK_EQ(0U, packet_size % bytes_per_frame_) @@ -371,7 +371,7 @@ void AlsaPcmOutputStream::GetVolume(double* volume) { *volume = shared_data_.volume(); } -void AlsaPcmOutputStream::OpenTask(size_t packet_size) { +void AlsaPcmOutputStream::OpenTask(uint32 packet_size) { DCHECK_EQ(MessageLoop::current(), message_loop_); // Initialize the configuration variables. @@ -434,8 +434,8 @@ void AlsaPcmOutputStream::StartTask() { // the maximum number of full packets that can fit into the buffer. // // TODO(ajwong): Handle EAGAIN. - const int num_preroll = latency_micros_ / micros_per_packet_; - for (int i = 0; i < num_preroll; ++i) { + const uint32 num_preroll = latency_micros_ / micros_per_packet_; + for (uint32 i = 0; i < num_preroll; ++i) { BufferPacket(packet_.get()); WritePacket(packet_.get()); } @@ -621,12 +621,12 @@ void AlsaPcmOutputStream::ScheduleNextWrite(Packet* current_packet) { // Calculate when we should have enough buffer for another packet of data. // Make sure to take into consideration down-mixing. - int frames_leftover = + uint32 frames_leftover = FramesInPacket(*current_packet, bytes_per_output_frame_); - int frames_avail_wanted = + uint32 frames_avail_wanted = (frames_leftover > 0) ? frames_leftover : frames_per_packet_; - int frames_until_empty_enough = frames_avail_wanted - GetAvailableFrames(); - int next_fill_time_ms = + uint32 frames_until_empty_enough = frames_avail_wanted - GetAvailableFrames(); + uint32 next_fill_time_ms = FramesToMillis(frames_until_empty_enough, sample_rate_); // Adjust for timer resolution issues. @@ -659,20 +659,20 @@ void AlsaPcmOutputStream::ScheduleNextWrite(Packet* current_packet) { } } -snd_pcm_sframes_t AlsaPcmOutputStream::FramesInPacket(const Packet& packet, - int bytes_per_frame) { +uint32 AlsaPcmOutputStream::FramesInPacket(const Packet& packet, + uint32 bytes_per_frame) { return (packet.size - packet.used) / bytes_per_frame; } -int64 AlsaPcmOutputStream::FramesToMicros(int frames, int sample_rate) { +uint32 AlsaPcmOutputStream::FramesToMicros(uint32 frames, uint32 sample_rate) { return frames * base::Time::kMicrosecondsPerSecond / sample_rate; } -int64 AlsaPcmOutputStream::FramesToMillis(int frames, int sample_rate) { +uint32 AlsaPcmOutputStream::FramesToMillis(uint32 frames, uint32 sample_rate) { return frames * base::Time::kMillisecondsPerSecond / sample_rate; } -std::string AlsaPcmOutputStream::FindDeviceForChannels(int channels) { +std::string AlsaPcmOutputStream::FindDeviceForChannels(uint32 channels) { // Constants specified by the ALSA API for device hints. static const int kGetAllDevices = -1; static const char kPcmInterfaceName[] = "pcm"; @@ -721,7 +721,7 @@ std::string AlsaPcmOutputStream::FindDeviceForChannels(int channels) { } snd_pcm_t* AlsaPcmOutputStream::OpenDevice(const std::string& device_name, - int channels, + uint32 channels, unsigned int latency) { snd_pcm_t* handle = NULL; int error = wrapper_->PcmOpen(&handle, device_name.c_str(), @@ -822,7 +822,7 @@ snd_pcm_t* AlsaPcmOutputStream::AutoSelectDevice(unsigned int latency) { // downmixing. // // TODO(ajwong): We need a SupportsFolding() function. - int default_channels = channels_; + uint32 default_channels = channels_; if (default_channels >= 5 && default_channels <= 6) { should_downmix_ = true; default_channels = 2; @@ -921,10 +921,10 @@ void AlsaPcmOutputStream::SharedData::set_volume(float v) { volume_ = v; } -size_t AlsaPcmOutputStream::SharedData::OnMoreData(AudioOutputStream* stream, +uint32 AlsaPcmOutputStream::SharedData::OnMoreData(AudioOutputStream* stream, void* dest, - size_t max_size, - int pending_bytes) { + uint32 max_size, + uint32 pending_bytes) { AutoLock l(lock_); if (source_callback_) { return source_callback_->OnMoreData(stream, dest, max_size, pending_bytes); diff --git a/media/audio/linux/alsa_output.h b/media/audio/linux/alsa_output.h index 8aa0af3..240076a 100644 --- a/media/audio/linux/alsa_output.h +++ b/media/audio/linux/alsa_output.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // @@ -58,7 +58,7 @@ class AlsaPcmOutputStream : static const char kPlugPrefix[]; // The minimum latency that is accepted by the device. - static const int kMinLatencyMicros; + static const uint32 kMinLatencyMicros; // Create a PCM Output stream for the ALSA device identified by // |device_name|. The AlsaPcmOutputStream uses |wrapper| to communicate with @@ -69,15 +69,15 @@ class AlsaPcmOutputStream : // If unsure of what to use for |device_name|, use |kAutoSelectDevice|. AlsaPcmOutputStream(const std::string& device_name, AudioManager::Format format, - int channels, - int sample_rate, - int bits_per_sample, + uint32 channels, + uint32 sample_rate, + uint32 bits_per_sample, AlsaWrapper* wrapper, AudioManagerLinux* manager, MessageLoop* message_loop); // Implementation of AudioOutputStream. - virtual bool Open(size_t packet_size); + virtual bool Open(uint32 packet_size); virtual void Close(); virtual void Start(AudioSourceCallback* callback); virtual void Stop(); @@ -112,15 +112,15 @@ class AlsaPcmOutputStream : // TODO(ajwong): There are now about 3 buffer/packet implementations. Factor // them out. struct Packet { - explicit Packet(int new_capacity) + explicit Packet(uint32 new_capacity) : capacity(new_capacity), size(0), used(0), buffer(new char[capacity]) { } - size_t capacity; - size_t size; - size_t used; + uint32 capacity; + uint32 size; + uint32 used; scoped_array<char> buffer; }; @@ -136,7 +136,7 @@ class AlsaPcmOutputStream : friend std::ostream& ::operator<<(std::ostream& os, InternalState); // Various tasks that complete actions started in the public API. - void OpenTask(size_t packet_size); + void OpenTask(uint32 packet_size); void StartTask(); void CloseTask(); @@ -148,20 +148,19 @@ class AlsaPcmOutputStream : void ScheduleNextWrite(Packet* current_packet); // Utility functions for talking with the ALSA API. - static snd_pcm_sframes_t FramesInPacket(const Packet& packet, - int bytes_per_frame); - static int64 FramesToMicros(int frames, int sample_rate); - static int64 FramesToMillis(int frames, int sample_rate); - std::string FindDeviceForChannels(int channels); + static uint32 FramesInPacket(const Packet& packet, uint32 bytes_per_frame); + static uint32 FramesToMicros(uint32 frames, uint32 sample_rate); + static uint32 FramesToMillis(uint32 frames, uint32 sample_rate); + std::string FindDeviceForChannels(uint32 channels); snd_pcm_t* OpenDevice(const std::string& device_name, - int channels, - unsigned int latency); + uint32 channels, + uint32 latency); bool CloseDevice(snd_pcm_t* handle); snd_pcm_sframes_t GetAvailableFrames(); // Attempts to find the best matching linux audio device for the given number // of channels. This function will set |device_name_| and |should_downmix_|. - snd_pcm_t* AutoSelectDevice(unsigned int latency); + snd_pcm_t* AutoSelectDevice(uint32 latency); // Thread-asserting accessors for member variables. AudioManagerLinux* manager(); @@ -191,8 +190,8 @@ class AlsaPcmOutputStream : // is passed into the output stream, but ownership is not transfered which // requires a synchronization on access of the |source_callback_| to avoid // using a deleted callback. - size_t OnMoreData(AudioOutputStream* stream, void* dest, - size_t max_size, int pending_bytes); + uint32 OnMoreData(AudioOutputStream* stream, void* dest, + uint32 max_size, uint32 pending_bytes); void OnClose(AudioOutputStream* stream); void OnError(AudioOutputStream* stream, int code); @@ -217,17 +216,17 @@ class AlsaPcmOutputStream : // since they are constants. const std::string requested_device_name_; const snd_pcm_format_t pcm_format_; - const int channels_; - const int sample_rate_; - const int bytes_per_sample_; - const int bytes_per_frame_; + const uint32 channels_; + const uint32 sample_rate_; + const uint32 bytes_per_sample_; + const uint32 bytes_per_frame_; // Device configuration data. Populated after OpenTask() completes. std::string device_name_; bool should_downmix_; - int latency_micros_; - int micros_per_packet_; - int bytes_per_output_frame_; + uint32 latency_micros_; + uint32 micros_per_packet_; + uint32 bytes_per_output_frame_; // Flag indicating the code should stop reading from the data source or // writing to the ALSA device. This is set because the device has entered @@ -246,7 +245,7 @@ class AlsaPcmOutputStream : snd_pcm_t* playback_handle_; scoped_ptr<Packet> packet_; - int frames_per_packet_; + uint32 frames_per_packet_; // Used to check which message loop is allowed to call the public APIs. MessageLoop* client_thread_loop_; diff --git a/media/audio/linux/alsa_output_unittest.cc b/media/audio/linux/alsa_output_unittest.cc index b426301..3dcc610 100644 --- a/media/audio/linux/alsa_output_unittest.cc +++ b/media/audio/linux/alsa_output_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -53,8 +53,8 @@ class MockAlsaWrapper : public AlsaWrapper { class MockAudioSourceCallback : public AudioOutputStream::AudioSourceCallback { public: - MOCK_METHOD4(OnMoreData, size_t(AudioOutputStream* stream, void* dest, - size_t max_size, int pending_bytes)); + MOCK_METHOD4(OnMoreData, uint32(AudioOutputStream* stream, void* dest, + uint32 max_size, uint32 pending_bytes)); MOCK_METHOD1(OnClose, void(AudioOutputStream* stream)); MOCK_METHOD2(OnError, void(AudioOutputStream* stream, int code)); }; @@ -112,8 +112,8 @@ class AlsaPcmOutputStreamTest : public testing::Test { static const AudioManager::Format kTestFormat; static const char kTestDeviceName[]; static const char kDummyMessage[]; - static const int kTestFramesPerPacket; - static const size_t kTestPacketSize; + static const uint32 kTestFramesPerPacket; + static const uint32 kTestPacketSize; static const int kTestFailedErrno; static snd_pcm_t* const kFakeHandle; @@ -147,8 +147,8 @@ const AudioManager::Format AlsaPcmOutputStreamTest::kTestFormat = AudioManager::AUDIO_PCM_LINEAR; const char AlsaPcmOutputStreamTest::kTestDeviceName[] = "TestDevice"; const char AlsaPcmOutputStreamTest::kDummyMessage[] = "dummy"; -const int AlsaPcmOutputStreamTest::kTestFramesPerPacket = 1000; -const size_t AlsaPcmOutputStreamTest::kTestPacketSize = +const uint32 AlsaPcmOutputStreamTest::kTestFramesPerPacket = 1000; +const uint32 AlsaPcmOutputStreamTest::kTestPacketSize = AlsaPcmOutputStreamTest::kTestFramesPerPacket * AlsaPcmOutputStreamTest::kTestBytesPerFrame; const int AlsaPcmOutputStreamTest::kTestFailedErrno = -EACCES; diff --git a/media/audio/mac/audio_output_mac.cc b/media/audio/mac/audio_output_mac.cc index 24dc86b..77c34df 100644 --- a/media/audio/mac/audio_output_mac.cc +++ b/media/audio/mac/audio_output_mac.cc @@ -1,13 +1,13 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "media/audio/mac/audio_manager_mac.h" #include "media/audio/mac/audio_output_mac.h" #include "base/basictypes.h" #include "base/logging.h" #include "media/audio/audio_util.h" +#include "media/audio/mac/audio_manager_mac.h" // Overview of operation: // 1) An object of PCMQueueOutAudioOutputStream is created by the AudioManager @@ -78,7 +78,7 @@ void PCMQueueOutAudioOutputStream::HandleError(OSStatus err) { NOTREACHED() << "error code " << err; } -bool PCMQueueOutAudioOutputStream::Open(size_t packet_size) { +bool PCMQueueOutAudioOutputStream::Open(uint32 packet_size) { if (0 == packet_size) { // TODO(cpu) : Impelement default buffer computation. return false; @@ -92,7 +92,7 @@ bool PCMQueueOutAudioOutputStream::Open(size_t packet_size) { return false; } // Allocate the hardware-managed buffers. - for (size_t ix = 0; ix != kNumBuffers; ++ix) { + for (uint32 ix = 0; ix != kNumBuffers; ++ix) { err = AudioQueueAllocateBuffer(audio_queue_, packet_size, &buffer_[ix]); if (err != noErr) { HandleError(err); @@ -113,7 +113,7 @@ void PCMQueueOutAudioOutputStream::Close() { // might be NULL. if (audio_queue_) { OSStatus err = 0; - for (size_t ix = 0; ix != kNumBuffers; ++ix) { + for (uint32 ix = 0; ix != kNumBuffers; ++ix) { if (buffer_[ix]) { err = AudioQueueFreeBuffer(audio_queue_, buffer_[ix]); if (err != noErr) { @@ -168,10 +168,10 @@ void PCMQueueOutAudioOutputStream::GetVolume(double* volume) { // TODO(fbarchard): Switch layout when ffmpeg is updated. namespace { template<class Format> -static void SwizzleLayout(Format* b, size_t filled) { +static void SwizzleLayout(Format* b, uint32 filled) { static const int kNumSurroundChannels = 6; Format aac[kNumSurroundChannels]; - for (size_t i = 0; i < filled; i += sizeof(aac), b += kNumSurroundChannels) { + for (uint32 i = 0; i < filled; i += sizeof(aac), b += kNumSurroundChannels) { memcpy(aac, b, sizeof(aac)); b[0] = aac[1]; // L b[1] = aac[2]; // R @@ -200,8 +200,8 @@ void PCMQueueOutAudioOutputStream::RenderCallback(void* p_this, // Adjust the number of pending bytes by subtracting the amount played. audio_stream->pending_bytes_ -= buffer->mAudioDataByteSize; - size_t capacity = buffer->mAudioDataBytesCapacity; - size_t filled = source->OnMoreData(audio_stream, buffer->mAudioData, + uint32 capacity = buffer->mAudioDataBytesCapacity; + uint32 filled = source->OnMoreData(audio_stream, buffer->mAudioData, capacity, audio_stream->pending_bytes_); // In order to keep the callback running, we need to provide a positive amount @@ -253,12 +253,12 @@ void PCMQueueOutAudioOutputStream::Start(AudioSourceCallback* callback) { source_ = callback; pending_bytes_ = 0; // Ask the source to pre-fill all our buffers before playing. - for (size_t ix = 0; ix != kNumBuffers; ++ix) { + for (uint32 ix = 0; ix != kNumBuffers; ++ix) { buffer_[ix]->mAudioDataByteSize = 0; RenderCallback(this, NULL, buffer_[ix]); } // Queue the buffers to the audio driver, sounds starts now. - for (size_t ix = 0; ix != kNumBuffers; ++ix) { + for (uint32 ix = 0; ix != kNumBuffers; ++ix) { err = AudioQueueEnqueueBuffer(audio_queue_, buffer_[ix], 0, NULL); if (err != noErr) { HandleError(err); diff --git a/media/audio/mac/audio_output_mac.h b/media/audio/mac/audio_output_mac.h index 10fc229..0f58cae 100644 --- a/media/audio/mac/audio_output_mac.h +++ b/media/audio/mac/audio_output_mac.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -29,7 +29,7 @@ class PCMQueueOutAudioOutputStream : public AudioOutputStream { virtual ~PCMQueueOutAudioOutputStream(); // Implementation of AudioOutputStream. - virtual bool Open(size_t packet_size); + virtual bool Open(uint32 packet_size); virtual void Close(); virtual void Start(AudioSourceCallback* callback); virtual void Stop(); @@ -38,7 +38,7 @@ class PCMQueueOutAudioOutputStream : public AudioOutputStream { private: // The audio is double buffered. - static const size_t kNumBuffers = 2; + static const uint32 kNumBuffers = 2; // The OS calls back here when an audio buffer has been processed. static void RenderCallback(void* p_this, AudioQueueRef queue, @@ -61,7 +61,7 @@ class PCMQueueOutAudioOutputStream : public AudioOutputStream { // Volume level from 0 to 1. float volume_; // Number of bytes yet to be played in audio buffer. - int pending_bytes_; + uint32 pending_bytes_; DISALLOW_COPY_AND_ASSIGN(PCMQueueOutAudioOutputStream); }; diff --git a/media/audio/mac/audio_output_mac_unittest.cc b/media/audio/mac/audio_output_mac_unittest.cc index 06d7f96..ee589f5 100644 --- a/media/audio/mac/audio_output_mac_unittest.cc +++ b/media/audio/mac/audio_output_mac_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -19,8 +19,8 @@ using ::testing::Return; class MockAudioSource : public AudioOutputStream::AudioSourceCallback { public: - MOCK_METHOD4(OnMoreData, size_t(AudioOutputStream* stream, void* dest, - size_t max_size, int pending_bytes)); + MOCK_METHOD4(OnMoreData, uint32(AudioOutputStream* stream, void* dest, + uint32 max_size, uint32 pending_bytes)); MOCK_METHOD1(OnClose, void(AudioOutputStream* stream)); MOCK_METHOD2(OnError, void(AudioOutputStream* stream, int code)); }; @@ -28,7 +28,7 @@ class MockAudioSource : public AudioOutputStream::AudioSourceCallback { // Validate that the SineWaveAudioSource writes the expected values for // the FORMAT_16BIT_MONO. TEST(MacAudioTest, SineWaveAudio16MonoTest) { - const size_t samples = 1024; + const uint32 samples = 1024; const int freq = 200; SineWaveAudioSource source(SineWaveAudioSource::FORMAT_16BIT_LINEAR_PCM, 1, @@ -88,7 +88,7 @@ TEST(MacAudioTest, PCMWaveStreamPlay200HzTone44KssMono) { SineWaveAudioSource source(SineWaveAudioSource::FORMAT_16BIT_LINEAR_PCM, 1, 200.0, AudioManager::kAudioCDSampleRate); - size_t bytes_100_ms = (AudioManager::kAudioCDSampleRate / 10) * 2; + uint32 bytes_100_ms = (AudioManager::kAudioCDSampleRate / 10) * 2; EXPECT_TRUE(oas->Open(bytes_100_ms)); @@ -121,7 +121,7 @@ TEST(MacAudioTest, PCMWaveStreamPlay200HzTone22KssMono) { SineWaveAudioSource source(SineWaveAudioSource::FORMAT_16BIT_LINEAR_PCM, 1, 200.0, AudioManager::kAudioCDSampleRate/2); - size_t bytes_100_ms = (AudioManager::kAudioCDSampleRate / 20) * 2; + uint32 bytes_100_ms = (AudioManager::kAudioCDSampleRate / 20) * 2; EXPECT_TRUE(oas->Open(bytes_100_ms)); oas->Start(&source); @@ -132,7 +132,7 @@ TEST(MacAudioTest, PCMWaveStreamPlay200HzTone22KssMono) { // Custom action to clear a memory buffer. static void ClearBuffer(AudioOutputStream* strea, void* dest, - size_t max_size, size_t pending_bytes) { + uint32 max_size, uint32 pending_bytes) { memset(dest, 0, max_size); } @@ -147,7 +147,7 @@ TEST(MacAudioTest, PCMWaveStreamPendingBytes) { ASSERT_TRUE(NULL != oas); NiceMock<MockAudioSource> source; - size_t bytes_100_ms = (AudioManager::kAudioCDSampleRate / 10) * 2; + uint32 bytes_100_ms = (AudioManager::kAudioCDSampleRate / 10) * 2; EXPECT_TRUE(oas->Open(bytes_100_ms)); // We expect the amount of pending bytes will reaching |bytes_100_ms| diff --git a/media/audio/simple_sources.cc b/media/audio/simple_sources.cc index d9b30c7..228057b 100644 --- a/media/audio/simple_sources.cc +++ b/media/audio/simple_sources.cc @@ -1,14 +1,15 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "media/audio/simple_sources.h" + #include <algorithm> #include <math.h> #include "base/basictypes.h" #include "base/logging.h" #include "media/audio/audio_output.h" -#include "media/audio/simple_sources.h" ////////////////////////////////////////////////////////////////////////////// // SineWaveAudioSource implementation. @@ -25,14 +26,14 @@ SineWaveAudioSource::SineWaveAudioSource(Format format, int channels, // The implementation could be more efficient if a lookup table is constructed // but it is efficient enough for our simple needs. -size_t SineWaveAudioSource::OnMoreData(AudioOutputStream* stream, void* dest, - size_t max_size, int pending_bytes) { +uint32 SineWaveAudioSource::OnMoreData(AudioOutputStream* stream, void* dest, + uint32 max_size, uint32 pending_bytes) { const double kTwoPi = 2.0 * 3.141592653589; double f = freq_ / sample_freq_; int16* sin_tbl = reinterpret_cast<int16*>(dest); - size_t len = max_size / sizeof(int16); + uint32 len = max_size / sizeof(int16); // The table is filled with s(t) = 32768*sin(2PI*f*t). - for (size_t ix = 0; ix != len; ++ix) { + for (uint32 ix = 0; ix != len; ++ix) { double th = kTwoPi * ix * f; sin_tbl[ix] = static_cast<int16>((1 << 15) * sin(th)); } @@ -49,7 +50,7 @@ void SineWaveAudioSource::OnError(AudioOutputStream* stream, int code) { ////////////////////////////////////////////////////////////////////////////// // PushSource implementation. -PushSource::PushSource(size_t packet_size) +PushSource::PushSource(uint32 packet_size) : packet_size_(packet_size), buffered_bytes_(0), front_buffer_consumed_(0) { @@ -59,9 +60,9 @@ PushSource::~PushSource() { CleanUp(); } -size_t PushSource::OnMoreData(AudioOutputStream* stream, void* dest, - size_t max_size, int pending_bytes) { - size_t copied = 0; +uint32 PushSource::OnMoreData(AudioOutputStream* stream, void* dest, + uint32 max_size, uint32 pending_bytes) { + uint32 copied = 0; while (copied < max_size) { AutoLock auto_lock(lock_); @@ -69,7 +70,7 @@ size_t PushSource::OnMoreData(AudioOutputStream* stream, void* dest, if (!packets_.size()) break; Packet packet = packets_.front(); - size_t size = std::min(max_size - copied, + uint32 size = std::min(max_size - copied, packet.size - front_buffer_consumed_); memcpy(static_cast<char*>(dest) + copied, packet.buffer + front_buffer_consumed_, @@ -95,7 +96,7 @@ void PushSource::OnError(AudioOutputStream* stream, int code) { } // TODO(cpu): Manage arbitrary large sizes. -bool PushSource::Write(const void *data, size_t len) { +bool PushSource::Write(const void *data, uint32 len) { if (len == 0) { NOTREACHED(); return false; @@ -109,7 +110,7 @@ bool PushSource::Write(const void *data, size_t len) { return true; } -size_t PushSource::UnProcessedBytes() { +uint32 PushSource::UnProcessedBytes() { AutoLock auto_lock(lock_); return buffered_bytes_; } diff --git a/media/audio/simple_sources.h b/media/audio/simple_sources.h index d43fcdf..9d0619f 100644 --- a/media/audio/simple_sources.h +++ b/media/audio/simple_sources.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -25,8 +25,8 @@ class SineWaveAudioSource : public AudioOutputStream::AudioSourceCallback { virtual ~SineWaveAudioSource() {} // Implementation of AudioSourceCallback. - virtual size_t OnMoreData(AudioOutputStream* stream, - void* dest, size_t max_size, int pending_bytes); + virtual uint32 OnMoreData(AudioOutputStream* stream, + void* dest, uint32 max_size, uint32 pending_bytes); virtual void OnClose(AudioOutputStream* stream); virtual void OnError(AudioOutputStream* stream, int code); @@ -45,11 +45,11 @@ class PushAudioOutput { // Write audio data to the audio device. It will be played eventually. // Returns false on failure. - virtual bool Write(const void* data, size_t len) = 0; + virtual bool Write(const void* data, uint32 len) = 0; // Returns the number of bytes that have been buffered but not yet given // to the audio device. - virtual size_t UnProcessedBytes() = 0; + virtual uint32 UnProcessedBytes() = 0; }; // A fairly basic class to connect a push model provider PushAudioOutput to @@ -61,19 +61,19 @@ class PushSource : public AudioOutputStream::AudioSourceCallback, // Construct the audio source. Pass the same |packet_size| specified in the // AudioOutputStream::Open() here. // TODO(hclam): |packet_size| is not used anymore, remove it. - explicit PushSource(size_t packet_size); + explicit PushSource(uint32 packet_size); virtual ~PushSource(); // Write one buffer. The ideal size is |packet_size| but smaller sizes are // accepted. - virtual bool Write(const void* data, size_t len); + virtual bool Write(const void* data, uint32 len); // Return the total number of bytes not given to the audio device yet. - virtual size_t UnProcessedBytes(); + virtual uint32 UnProcessedBytes(); // Implementation of AudioSourceCallback. - virtual size_t OnMoreData(AudioOutputStream* stream, - void* dest, size_t max_size, int pending_bytes); + virtual uint32 OnMoreData(AudioOutputStream* stream, + void* dest, uint32 max_size, uint32 pending_bytes); virtual void OnClose(AudioOutputStream* stream); virtual void OnError(AudioOutputStream* stream, int code); @@ -81,17 +81,17 @@ class PushSource : public AudioOutputStream::AudioSourceCallback, // Defines the unit of playback. We own the memory pointed by |buffer|. struct Packet { char* buffer; - size_t size; + uint32 size; }; // Free acquired resources. void CleanUp(); - const size_t packet_size_; + const uint32 packet_size_; typedef std::list<Packet> PacketList; PacketList packets_; - size_t buffered_bytes_; - size_t front_buffer_consumed_; + uint32 buffered_bytes_; + uint32 front_buffer_consumed_; // Serialize access to packets_ and buffered_bytes_ using this lock. Lock lock_; }; diff --git a/media/audio/simple_sources_unittest.cc b/media/audio/simple_sources_unittest.cc index 51eb8db..6436170 100644 --- a/media/audio/simple_sources_unittest.cc +++ b/media/audio/simple_sources_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -12,7 +12,7 @@ namespace { -void GenerateRandomData(char* buffer, size_t len) { +void GenerateRandomData(char* buffer, uint32 len) { static bool called = false; if (!called) { called = true; @@ -21,7 +21,7 @@ void GenerateRandomData(char* buffer, size_t len) { LOG(INFO) << "Random seed: " << seed; } - for (size_t i = 0; i < len; i++) { + for (uint32 i = 0; i < len; i++) { buffer[i] = static_cast<char>(rand()); } } @@ -30,13 +30,13 @@ void GenerateRandomData(char* buffer, size_t len) { // To test write size smaller than read size. TEST(SimpleSourcesTest, PushSourceSmallerWrite) { - const size_t kDataSize = 40960; + const uint32 kDataSize = 40960; scoped_array<char> data(new char[kDataSize]); GenerateRandomData(data.get(), kDataSize); // Choose two prime numbers for read and write sizes. - const size_t kWriteSize = 283; - const size_t kReadSize = 293; + const uint32 kWriteSize = 283; + const uint32 kReadSize = 293; scoped_array<char> read_data(new char[kReadSize]); // Create a PushSource that assumes the hardware audio buffer size is always @@ -45,15 +45,15 @@ TEST(SimpleSourcesTest, PushSourceSmallerWrite) { EXPECT_EQ(0u, push_source.UnProcessedBytes()); // Write everything into this push source. - for (size_t i = 0; i < kDataSize; i += kWriteSize) { - size_t size = std::min(kDataSize - i, kWriteSize); + for (uint32 i = 0; i < kDataSize; i += kWriteSize) { + uint32 size = std::min(kDataSize - i, kWriteSize); EXPECT_TRUE(push_source.Write(data.get() + i, size)); } EXPECT_EQ(kDataSize, push_source.UnProcessedBytes()); // Read everything from the push source. - for (size_t i = 0; i < kDataSize; i += kReadSize) { - size_t size = std::min(kDataSize - i , kReadSize); + for (uint32 i = 0; i < kDataSize; i += kReadSize) { + uint32 size = std::min(kDataSize - i , kReadSize); EXPECT_EQ(size, push_source.OnMoreData(NULL, read_data.get(), size, 0)); EXPECT_EQ(0, memcmp(data.get() + i, read_data.get(), size)); } @@ -67,8 +67,8 @@ TEST(SimpleSourcesTest, PushSourceSmallerWrite) { // do not affect the result. We also test that AudioManager::GetLastMockBuffer // works. TEST(SimpleSources, SineWaveAudio16MonoTest) { - const size_t samples = 1024; - const size_t bytes_per_sample = 2; + const uint32 samples = 1024; + const uint32 bytes_per_sample = 2; const int freq = 200; SineWaveAudioSource source(SineWaveAudioSource::FORMAT_16BIT_LINEAR_PCM, 1, @@ -93,7 +93,7 @@ TEST(SimpleSources, SineWaveAudio16MonoTest) { FakeAudioOutputStream::GetLastFakeStream()->buffer()); ASSERT_TRUE(NULL != last_buffer); - size_t half_period = AudioManager::kTelephoneSampleRate / (freq * 2); + uint32 half_period = AudioManager::kTelephoneSampleRate / (freq * 2); // Spot test positive incursion of sine wave. EXPECT_EQ(0, last_buffer[0]); diff --git a/media/audio/win/audio_output_win_unittest.cc b/media/audio/win/audio_output_win_unittest.cc index 70e9329..0bb18a2 100644 --- a/media/audio/win/audio_output_win_unittest.cc +++ b/media/audio/win/audio_output_win_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -38,8 +38,8 @@ class TestSourceBasic : public AudioOutputStream::AudioSourceCallback { was_closed_(0) { } // AudioSourceCallback::OnMoreData implementation: - virtual size_t OnMoreData(AudioOutputStream* stream, - void* dest, size_t max_size, int pending_bytes) { + virtual uint32 OnMoreData(AudioOutputStream* stream, + void* dest, uint32 max_size, uint32 pending_bytes) { ++callback_count_; // Touch the first byte to make sure memory is good. if (max_size) @@ -94,8 +94,8 @@ class TestSourceTripleBuffer : public TestSourceBasic { buffer_address_[2] = NULL; } // Override of TestSourceBasic::OnMoreData. - virtual size_t OnMoreData(AudioOutputStream* stream, - void* dest, size_t max_size, int pending_bytes) { + virtual uint32 OnMoreData(AudioOutputStream* stream, + void* dest, uint32 max_size, uint32 pending_bytes) { // Call the base, which increments the callback_count_. TestSourceBasic::OnMoreData(stream, dest, max_size, 0); if (callback_count() % kNumBuffers == 2) { @@ -113,7 +113,7 @@ class TestSourceTripleBuffer : public TestSourceBasic { } private: - bool CompareExistingIfNotNULL(size_t index, void* address) { + bool CompareExistingIfNotNULL(uint32 index, void* address) { void*& entry = buffer_address_[index]; if (!entry) entry = address; @@ -130,8 +130,8 @@ class TestSourceLaggy : public TestSourceBasic { TestSourceLaggy(int laggy_after_buffer, int lag_in_ms) : laggy_after_buffer_(laggy_after_buffer), lag_in_ms_(lag_in_ms) { } - virtual size_t OnMoreData(AudioOutputStream* stream, - void* dest, size_t max_size, int pending_bytes) { + virtual uint32 OnMoreData(AudioOutputStream* stream, + void* dest, uint32 max_size, uint32 pending_bytes) { // Call the base, which increments the callback_count_. TestSourceBasic::OnMoreData(stream, dest, max_size, 0); if (callback_count() > kNumBuffers) { @@ -146,8 +146,8 @@ class TestSourceLaggy : public TestSourceBasic { class MockAudioSource : public AudioOutputStream::AudioSourceCallback { public: - MOCK_METHOD4(OnMoreData, size_t(AudioOutputStream* stream, void* dest, - size_t max_size, int pending_bytes)); + MOCK_METHOD4(OnMoreData, uint32(AudioOutputStream* stream, void* dest, + uint32 max_size, uint32 pending_bytes)); MOCK_METHOD1(OnClose, void(AudioOutputStream* stream)); MOCK_METHOD2(OnError, void(AudioOutputStream* stream, int code)); }; @@ -186,18 +186,18 @@ class ReadOnlyMappedFile { return ((start_ > 0) && (size_ > 0)); } // Returns the size in bytes of the mapped memory. - size_t size() const { + uint32 size() const { return size_; } // Returns the memory backing the file. - const void* GetChunkAt(size_t offset) { + const void* GetChunkAt(uint32 offset) { return &start_[offset]; } private: HANDLE fmap_; char* start_; - size_t size_; + uint32 size_; }; // ============================================================================ @@ -353,7 +353,7 @@ TEST(WinAudioTest, PCMWaveStreamPlaySlowLoop) { SineWaveAudioSource source(SineWaveAudioSource::FORMAT_16BIT_LINEAR_PCM, 1, 200.0, AudioManager::kAudioCDSampleRate); - size_t bytes_100_ms = (AudioManager::kAudioCDSampleRate / 10) * 2; + uint32 bytes_100_ms = (AudioManager::kAudioCDSampleRate / 10) * 2; EXPECT_TRUE(oas->Open(bytes_100_ms)); oas->SetVolume(1.0); @@ -384,7 +384,7 @@ TEST(WinAudioTest, PCMWaveStreamPlay200HzTone44Kss) { SineWaveAudioSource source(SineWaveAudioSource::FORMAT_16BIT_LINEAR_PCM, 1, 200.0, AudioManager::kAudioCDSampleRate); - size_t bytes_100_ms = (AudioManager::kAudioCDSampleRate / 10) * 2; + uint32 bytes_100_ms = (AudioManager::kAudioCDSampleRate / 10) * 2; EXPECT_TRUE(oas->Open(bytes_100_ms)); oas->SetVolume(1.0); @@ -412,7 +412,7 @@ TEST(WinAudioTest, PCMWaveStreamPlay200HzTone22Kss) { SineWaveAudioSource source(SineWaveAudioSource::FORMAT_16BIT_LINEAR_PCM, 1, 200.0, AudioManager::kAudioCDSampleRate/2); - size_t bytes_100_ms = (AudioManager::kAudioCDSampleRate / 20) * 2; + uint32 bytes_100_ms = (AudioManager::kAudioCDSampleRate / 20) * 2; EXPECT_TRUE(oas->Open(bytes_100_ms)); @@ -456,17 +456,17 @@ TEST(WinAudioTest, PushSourceFile16KHz) { ASSERT_TRUE(NULL != oas); // compute buffer size for 100ms of audio. Which is 3200 bytes. - const size_t kSize50ms = 2 * (16000 / 1000) * 100; + const uint32 kSize50ms = 2 * (16000 / 1000) * 100; EXPECT_TRUE(oas->Open(kSize50ms)); - size_t offset = 0; - const size_t kMaxStartOffset = file_reader.size() - kSize50ms; + uint32 offset = 0; + const uint32 kMaxStartOffset = file_reader.size() - kSize50ms; // We buffer and play at the same time, buffering happens every ~10ms and the // consuming of the buffer happens every ~50ms. We do 100 buffers which // effectively wrap around the file more than once. PushSource push_source(kSize50ms); - for (size_t ix = 0; ix != 100; ++ix) { + for (uint32 ix = 0; ix != 100; ++ix) { push_source.Write(file_reader.GetChunkAt(offset), kSize50ms); if (ix == 2) { // For glitch free, start playing after some buffers are in. @@ -502,7 +502,7 @@ TEST(WinAudioTest, PCMWaveStreamPlayTwice200HzTone44Kss) { SineWaveAudioSource source(SineWaveAudioSource::FORMAT_16BIT_LINEAR_PCM, 1, 200.0, AudioManager::kAudioCDSampleRate); - size_t bytes_100_ms = (AudioManager::kAudioCDSampleRate / 10) * 2; + uint32 bytes_100_ms = (AudioManager::kAudioCDSampleRate / 10) * 2; EXPECT_TRUE(oas->Open(bytes_100_ms)); oas->SetVolume(1.0); @@ -541,7 +541,7 @@ TEST(WinAudioTest, PCMWaveStreamPlay200HzTone44KssLowLatency) { SineWaveAudioSource source(SineWaveAudioSource::FORMAT_16BIT_LINEAR_PCM, 1, 200.0, AudioManager::kAudioCDSampleRate); - size_t bytes_50_ms = (AudioManager::kAudioCDSampleRate / 20) * sizeof(uint16); + uint32 bytes_50_ms = (AudioManager::kAudioCDSampleRate / 20) * sizeof(uint16); EXPECT_TRUE(oas->Open(bytes_50_ms)); oas->SetVolume(1.0); @@ -567,7 +567,7 @@ TEST(WinAudioTest, PCMWaveStreamPendingBytes) { ASSERT_TRUE(NULL != oas); NiceMock<MockAudioSource> source; - size_t bytes_100_ms = (AudioManager::kAudioCDSampleRate / 10) * 2; + uint32 bytes_100_ms = (AudioManager::kAudioCDSampleRate / 10) * 2; EXPECT_TRUE(oas->Open(bytes_100_ms)); // We expect the amount of pending bytes will reaching 2 times of @@ -610,10 +610,10 @@ class SyncSocketSource : public AudioOutputStream::AudioSourceCallback { } // AudioSourceCallback::OnMoreData implementation: - virtual size_t OnMoreData(AudioOutputStream* stream, - void* dest, size_t max_size, int pending_bytes) { + virtual uint32 OnMoreData(AudioOutputStream* stream, + void* dest, uint32 max_size, uint32 pending_bytes) { socket_->Send(&pending_bytes, sizeof(pending_bytes)); - size_t got = socket_->Receive(dest, max_size); + uint32 got = socket_->Receive(dest, max_size); return got; } // AudioSourceCallback::OnClose implementation: @@ -631,7 +631,7 @@ struct SyncThreadContext { base::SyncSocket* socket; int sample_rate; double sine_freq; - size_t packet_size; + uint32 packet_size; }; // This thread provides the data that the SyncSocketSource above needs @@ -688,7 +688,7 @@ TEST(WinAudioTest, SyncSocketBasic) { ASSERT_TRUE(NULL != oas); // compute buffer size for 20ms of audio, 882 samples (mono). - const size_t kSamples20ms = sample_rate / 50 * sizeof(uint16); + const uint32 kSamples20ms = sample_rate / 50 * sizeof(uint16); ASSERT_TRUE(oas->Open(kSamples20ms)); base::SyncSocket* sockets[2]; diff --git a/media/audio/win/waveout_output_win.cc b/media/audio/win/waveout_output_win.cc index e0fdd1e..59f4c1c 100644 --- a/media/audio/win/waveout_output_win.cc +++ b/media/audio/win/waveout_output_win.cc @@ -1,13 +1,13 @@ -// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "media/audio/win/waveout_output_win.h" + #include <windows.h> #include <mmsystem.h> #pragma comment(lib, "winmm.lib") -#include "media/audio/win/waveout_output_win.h" - #include "base/basictypes.h" #include "base/logging.h" #include "media/audio/audio_output.h" @@ -31,7 +31,7 @@ namespace { // Sixty four MB is the maximum buffer size per AudioOutputStream. -const size_t kMaxOpenBufferSize = 1024 * 1024 * 64; +const uint32 kMaxOpenBufferSize = 1024 * 1024 * 64; // Our sound buffers are allocated once and kept in a linked list using the // the WAVEHDR::dwUser variable. The last buffer points to the first buffer. @@ -71,7 +71,7 @@ PCMWaveOutAudioOutputStream::~PCMWaveOutAudioOutputStream() { DCHECK(NULL == waveout_); } -bool PCMWaveOutAudioOutputStream::Open(size_t buffer_size) { +bool PCMWaveOutAudioOutputStream::Open(uint32 buffer_size) { if (state_ != PCMA_BRAND_NEW) return false; if (buffer_size > kMaxOpenBufferSize) @@ -96,11 +96,11 @@ bool PCMWaveOutAudioOutputStream::Open(size_t buffer_size) { return true; } -void PCMWaveOutAudioOutputStream::SetupBuffers(size_t rq_size) { +void PCMWaveOutAudioOutputStream::SetupBuffers(uint32 rq_size) { WAVEHDR* last = NULL; WAVEHDR* first = NULL; for (int ix = 0; ix != num_buffers_; ++ix) { - size_t sz = sizeof(WAVEHDR) + rq_size; + uint32 sz = sizeof(WAVEHDR) + rq_size; buffer_ = reinterpret_cast<WAVEHDR*>(new char[sz]); buffer_->lpData = reinterpret_cast<char*>(buffer_) + sizeof(WAVEHDR); buffer_->dwBufferLength = rq_size; @@ -235,8 +235,8 @@ void PCMWaveOutAudioOutputStream::QueueNextPacket(WAVEHDR *buffer) { // If we are down sampling to a smaller number of channels, we need to // scale up the amount of pending bytes. // TODO(fbarchard): Handle used 0 by queueing more. - int scaled_pending_bytes = pending_bytes_ * channels_ / format_.nChannels; - size_t used = callback_->OnMoreData(this, buffer->lpData, buffer_size_, + uint32 scaled_pending_bytes = pending_bytes_ * channels_ / format_.nChannels; + uint32 used = callback_->OnMoreData(this, buffer->lpData, buffer_size_, scaled_pending_bytes); if (used <= buffer_size_) { buffer->dwBufferLength = used * format_.nChannels / channels_; diff --git a/media/audio/win/waveout_output_win.h b/media/audio/win/waveout_output_win.h index d587c8c..df35542 100644 --- a/media/audio/win/waveout_output_win.h +++ b/media/audio/win/waveout_output_win.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -34,7 +34,7 @@ class PCMWaveOutAudioOutputStream : public AudioOutputStream { virtual ~PCMWaveOutAudioOutputStream(); // Implementation of AudioOutputStream. - virtual bool Open(size_t packet_size); + virtual bool Open(uint32 packet_size); virtual void Close(); virtual void Start(AudioSourceCallback* callback); virtual void Stop(); @@ -64,7 +64,7 @@ class PCMWaveOutAudioOutputStream : public AudioOutputStream { void HandleError(MMRESULT error); // Allocates and prepares the memory that will be used for playback. Only // two buffers are created. - void SetupBuffers(size_t rq_size); + void SetupBuffers(uint32 rq_size); // Deallocates the memory allocated in SetupBuffers. void FreeBuffers(); @@ -84,7 +84,7 @@ class PCMWaveOutAudioOutputStream : public AudioOutputStream { const int num_buffers_; // The size in bytes of each audio buffer, we usually have two of these. - size_t buffer_size_; + uint32 buffer_size_; // Volume level from 0 to 1. float volume_; @@ -93,7 +93,7 @@ class PCMWaveOutAudioOutputStream : public AudioOutputStream { const int channels_; // Number of bytes yet to be played in the hardware buffer. - int pending_bytes_; + uint32 pending_bytes_; // The id assigned by the operating system to the selected wave output // hardware device. Usually this is just -1 which means 'default device'. diff --git a/media/filters/audio_renderer_algorithm_base.cc b/media/filters/audio_renderer_algorithm_base.cc index be28537..fe6131c 100644 --- a/media/filters/audio_renderer_algorithm_base.cc +++ b/media/filters/audio_renderer_algorithm_base.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -11,7 +11,7 @@ namespace media { // The size in bytes we try to maintain for the |queue_|. Previous usage // maintained a deque of 16 Buffers, each of size 4Kb. This worked well, so we // maintain this number of bytes (16 * 4096). -const size_t kDefaultMinQueueSizeInBytes = 65536; +const uint32 kDefaultMinQueueSizeInBytes = 65536; AudioRendererAlgorithmBase::AudioRendererAlgorithmBase() : channels_(0), @@ -82,18 +82,18 @@ bool AudioRendererAlgorithmBase::IsQueueFull() { return (queue_.SizeInBytes() >= kDefaultMinQueueSizeInBytes); } -size_t AudioRendererAlgorithmBase::QueueSize() { +uint32 AudioRendererAlgorithmBase::QueueSize() { return queue_.SizeInBytes(); } -void AudioRendererAlgorithmBase::AdvanceInputPosition(size_t bytes) { +void AudioRendererAlgorithmBase::AdvanceInputPosition(uint32 bytes) { queue_.Consume(bytes); if (!IsQueueFull()) request_read_callback_->Run(); } -size_t AudioRendererAlgorithmBase::CopyFromInput(uint8* dest, size_t bytes) { +uint32 AudioRendererAlgorithmBase::CopyFromInput(uint8* dest, uint32 bytes) { return queue_.Copy(dest, bytes); } diff --git a/media/filters/audio_renderer_algorithm_base.h b/media/filters/audio_renderer_algorithm_base.h index 8822de5..6ad1c6d 100644 --- a/media/filters/audio_renderer_algorithm_base.h +++ b/media/filters/audio_renderer_algorithm_base.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -52,7 +52,7 @@ class AudioRendererAlgorithmBase { // Implement this strategy method in derived classes. Tries to fill |length| // bytes of |dest| with possibly scaled data from our |queue_|. Returns the // number of bytes copied into |dest|. - virtual size_t FillBuffer(uint8* dest, size_t length) = 0; + virtual uint32 FillBuffer(uint8* dest, uint32 length) = 0; // Clears |queue_|. virtual void FlushBuffers(); @@ -75,15 +75,15 @@ class AudioRendererAlgorithmBase { virtual bool IsQueueFull(); // Returns the number of bytes left in |queue_|. - virtual size_t QueueSize(); + virtual uint32 QueueSize(); protected: // Advances |queue_|'s internal pointer by |bytes|. - void AdvanceInputPosition(size_t bytes); + void AdvanceInputPosition(uint32 bytes); // Tries to copy |bytes| bytes from |queue_| to |dest|. Returns the number of // bytes successfully copied. - size_t CopyFromInput(uint8* dest, size_t bytes); + uint32 CopyFromInput(uint8* dest, uint32 bytes); // Number of audio channels. virtual int channels(); diff --git a/media/filters/audio_renderer_algorithm_default.cc b/media/filters/audio_renderer_algorithm_default.cc index b0ada26..7ebc10e 100644 --- a/media/filters/audio_renderer_algorithm_default.cc +++ b/media/filters/audio_renderer_algorithm_default.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -14,12 +14,12 @@ AudioRendererAlgorithmDefault::AudioRendererAlgorithmDefault() { AudioRendererAlgorithmDefault::~AudioRendererAlgorithmDefault() { } -size_t AudioRendererAlgorithmDefault::FillBuffer(uint8* dest, size_t length) { +uint32 AudioRendererAlgorithmDefault::FillBuffer(uint8* dest, uint32 length) { if (playback_rate() == 0.0f) { return 0; } - size_t dest_written = 0; + uint32 dest_written = 0; if (playback_rate() == 1.0f) { // If we don't have enough data, copy what we have. @@ -35,8 +35,8 @@ size_t AudioRendererAlgorithmDefault::FillBuffer(uint8* dest, size_t length) { memset(dest, 0, dest_written); // Calculate the number of bytes we "used". - size_t scaled_dest_length = - static_cast<size_t>(dest_written * playback_rate()); + uint32 scaled_dest_length = + static_cast<uint32>(dest_written * playback_rate()); // If this is more than we have, report the correct amount consumed. if (QueueSize() < scaled_dest_length) { diff --git a/media/filters/audio_renderer_algorithm_default.h b/media/filters/audio_renderer_algorithm_default.h index a796ba7..510df8b 100644 --- a/media/filters/audio_renderer_algorithm_default.h +++ b/media/filters/audio_renderer_algorithm_default.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -20,7 +20,7 @@ class AudioRendererAlgorithmDefault : public AudioRendererAlgorithmBase { virtual ~AudioRendererAlgorithmDefault(); // AudioRendererAlgorithmBase implementation - virtual size_t FillBuffer(uint8* dest, size_t length); + virtual uint32 FillBuffer(uint8* dest, uint32 length); private: DISALLOW_COPY_AND_ASSIGN(AudioRendererAlgorithmDefault); diff --git a/media/filters/audio_renderer_algorithm_ola.cc b/media/filters/audio_renderer_algorithm_ola.cc index 63c3868..d393c59 100644 --- a/media/filters/audio_renderer_algorithm_ola.cc +++ b/media/filters/audio_renderer_algorithm_ola.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -29,13 +29,13 @@ AudioRendererAlgorithmOLA::AudioRendererAlgorithmOLA() AudioRendererAlgorithmOLA::~AudioRendererAlgorithmOLA() { } -size_t AudioRendererAlgorithmOLA::FillBuffer(uint8* dest, size_t length) { +uint32 AudioRendererAlgorithmOLA::FillBuffer(uint8* dest, uint32 length) { if (IsQueueEmpty()) return 0; if (playback_rate() == 0.0f) return 0; - size_t dest_written = 0; + uint32 dest_written = 0; // Handle the simple case of normal playback. if (playback_rate() == 1.0f) { @@ -61,15 +61,15 @@ size_t AudioRendererAlgorithmOLA::FillBuffer(uint8* dest, size_t length) { QueueSize() < window_size_) { // Calculate the ideal input/output steps based on the size of the // destination buffer. - size_t input_step = static_cast<size_t>(ceil( + uint32 input_step = static_cast<uint32>(ceil( static_cast<float>(length * playback_rate()))); - size_t output_step = length; + uint32 output_step = length; // If the ideal size is too big, recalculate based on how much is left in // the queue. if (input_step > QueueSize()) { input_step = QueueSize(); - output_step = static_cast<size_t>(ceil( + output_step = static_cast<uint32>(ceil( static_cast<float>(input_step / playback_rate()))); } @@ -98,7 +98,7 @@ size_t AudioRendererAlgorithmOLA::FillBuffer(uint8* dest, size_t length) { // Copy bulk of data to output (including some to crossfade to the next // copy), then add to our running sum of written data and subtract from // our tally of remaining requested. - size_t copied = CopyFromInput(dest, output_step_ + crossfade_size_); + uint32 copied = CopyFromInput(dest, output_step_ + crossfade_size_); dest_written += copied; length -= copied; @@ -107,7 +107,7 @@ size_t AudioRendererAlgorithmOLA::FillBuffer(uint8* dest, size_t length) { AdvanceInputPosition(input_step_); // Prepare intermediate buffer. - size_t crossfade_size; + uint32 crossfade_size; scoped_array<uint8> src(new uint8[crossfade_size_]); crossfade_size = CopyFromInput(src.get(), crossfade_size_); @@ -145,7 +145,7 @@ void AudioRendererAlgorithmOLA::set_playback_rate(float new_rate) { // Calculate the window size from our default length and our audio properties. // Precision is not an issue because we will round this to a sample boundary. // This will not overflow because each parameter is checked in Initialize(). - window_size_ = static_cast<size_t>(sample_rate() + window_size_ = static_cast<uint32>(sample_rate() * sample_bytes() * channels() * kDefaultWindowLength); @@ -153,10 +153,10 @@ void AudioRendererAlgorithmOLA::set_playback_rate(float new_rate) { // Adjusting step sizes to accommodate requested playback rate. if (playback_rate() > 1.0f) { input_step_ = window_size_; - output_step_ = static_cast<size_t>(ceil( + output_step_ = static_cast<uint32>(ceil( static_cast<float>(window_size_ / playback_rate()))); } else { - input_step_ = static_cast<size_t>(ceil( + input_step_ = static_cast<uint32>(ceil( static_cast<float>(window_size_ * playback_rate()))); output_step_ = window_size_; } @@ -164,7 +164,7 @@ void AudioRendererAlgorithmOLA::set_playback_rate(float new_rate) { AlignToSampleBoundary(&output_step_); // Calculate length for crossfading. - crossfade_size_ = static_cast<size_t>(sample_rate() + crossfade_size_ = static_cast<uint32>(sample_rate() * sample_bytes() * channels() * kDefaultCrossfadeLength); @@ -179,7 +179,7 @@ void AudioRendererAlgorithmOLA::set_playback_rate(float new_rate) { output_step_ -= crossfade_size_; } -void AudioRendererAlgorithmOLA::AlignToSampleBoundary(size_t* value) { +void AudioRendererAlgorithmOLA::AlignToSampleBoundary(uint32* value) { (*value) -= ((*value) % (channels() * sample_bytes())); } diff --git a/media/filters/audio_renderer_algorithm_ola.h b/media/filters/audio_renderer_algorithm_ola.h index 5987ce8..0dff39f 100644 --- a/media/filters/audio_renderer_algorithm_ola.h +++ b/media/filters/audio_renderer_algorithm_ola.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -25,7 +25,7 @@ class AudioRendererAlgorithmOLA : public AudioRendererAlgorithmBase { virtual ~AudioRendererAlgorithmOLA(); // AudioRendererAlgorithmBase implementation - virtual size_t FillBuffer(uint8* dest, size_t length); + virtual uint32 FillBuffer(uint8* dest, uint32 length); virtual void set_playback_rate(float new_rate); @@ -36,7 +36,7 @@ class AudioRendererAlgorithmOLA : public AudioRendererAlgorithmBase { FRIEND_TEST(AudioRendererAlgorithmOLATest, FillBuffer_QuarterRate); // Aligns |value| to a channel and sample boundary. - void AlignToSampleBoundary(size_t* value); + void AlignToSampleBoundary(uint32* value); // Crossfades |samples| samples of |dest| with the data in |src|. Assumes // there is room in |dest| and enough data in |src|. Type is the datatype @@ -48,14 +48,14 @@ class AudioRendererAlgorithmOLA : public AudioRendererAlgorithmBase { // Members for ease of calculation in FillBuffer(). These members are based // on |playback_rate_|, but are stored separately so they don't have to be // recalculated on every call to FillBuffer(). - size_t input_step_; - size_t output_step_; + uint32 input_step_; + uint32 output_step_; // Length for crossfade in bytes. - size_t crossfade_size_; + uint32 crossfade_size_; // Window size, in bytes (calculated from audio properties). - size_t window_size_; + uint32 window_size_; DISALLOW_COPY_AND_ASSIGN(AudioRendererAlgorithmOLA); }; diff --git a/media/filters/audio_renderer_base.cc b/media/filters/audio_renderer_base.cc index 4ec7403..c141803 100644 --- a/media/filters/audio_renderer_base.cc +++ b/media/filters/audio_renderer_base.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -165,8 +165,8 @@ void AudioRendererBase::OnReadComplete(Buffer* buffer_in) { } } -size_t AudioRendererBase::FillBuffer(uint8* dest, - size_t dest_len, +uint32 AudioRendererBase::FillBuffer(uint8* dest, + uint32 dest_len, const base::TimeDelta& playback_delay) { // The timestamp of the last buffer written during the last call to // FillBuffer(). @@ -181,7 +181,7 @@ size_t AudioRendererBase::FillBuffer(uint8* dest, // zeros. This gets around the tricky situation of pausing and resuming // the audio IPC layer in Chrome. Ideally, we should return zero and then // the subclass can restart the conversation. - const size_t kZeroLength = 8192; + const uint32 kZeroLength = 8192; dest_written = std::min(kZeroLength, dest_len); memset(dest, 0, dest_written); return dest_written; diff --git a/media/filters/audio_renderer_base.h b/media/filters/audio_renderer_base.h index 07b62e4..3b3b593 100644 --- a/media/filters/audio_renderer_base.h +++ b/media/filters/audio_renderer_base.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -76,8 +76,8 @@ class AudioRendererBase : public AudioRenderer { // hardware plays the buffer, then |playback_delay| should be zero. // // Safe to call on any thread. - size_t FillBuffer(uint8* dest, - size_t len, + uint32 FillBuffer(uint8* dest, + uint32 len, const base::TimeDelta& playback_delay); // Helper to parse a media format and return whether we were successful diff --git a/media/filters/audio_renderer_base_unittest.cc b/media/filters/audio_renderer_base_unittest.cc index df4c9f0..5aae2de 100644 --- a/media/filters/audio_renderer_base_unittest.cc +++ b/media/filters/audio_renderer_base_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -186,8 +186,8 @@ TEST_F(AudioRendererBaseTest, OneCompleteReadCycle) { // Now satisfy the read requests. Our callback should be executed after // exiting this loop. - const size_t kDataSize = 1024; - size_t bytes_buffered = 0; + const uint32 kDataSize = 1024; + uint32 bytes_buffered = 0; while (!read_queue_.empty()) { scoped_refptr<DataBuffer> buffer = new DataBuffer(kDataSize); buffer->SetDataSize(kDataSize); diff --git a/media/filters/audio_renderer_impl.cc b/media/filters/audio_renderer_impl.cc index 0f6c4a9..591b0b2 100644 --- a/media/filters/audio_renderer_impl.cc +++ b/media/filters/audio_renderer_impl.cc @@ -1,11 +1,12 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "media/filters/audio_renderer_impl.h" + #include <math.h> #include "media/base/filter_host.h" -#include "media/filters/audio_renderer_impl.h" namespace media { @@ -50,8 +51,8 @@ void AudioRendererImpl::SetVolume(float volume) { stream_->SetVolume(volume); } -size_t AudioRendererImpl::OnMoreData(AudioOutputStream* stream, void* dest_void, - size_t len, int pending_bytes) { +uint32 AudioRendererImpl::OnMoreData(AudioOutputStream* stream, void* dest_void, + uint32 len, uint32 pending_bytes) { // TODO(scherkus): handle end of stream. if (!stream_) return 0; @@ -59,7 +60,7 @@ size_t AudioRendererImpl::OnMoreData(AudioOutputStream* stream, void* dest_void, // TODO(scherkus): Maybe change OnMoreData to pass in char/uint8 or similar. // TODO(fbarchard): Waveout_output_win.h should handle zero length buffers // without clicking. - pending_bytes = static_cast<int>(ceil(pending_bytes * GetPlaybackRate())); + pending_bytes = static_cast<uint32>(ceil(pending_bytes * GetPlaybackRate())); base::TimeDelta delay = base::TimeDelta::FromMicroseconds( base::Time::kMicrosecondsPerSecond * pending_bytes / bytes_per_second_); return FillBuffer(static_cast<uint8*>(dest_void), len, delay); diff --git a/media/filters/audio_renderer_impl.h b/media/filters/audio_renderer_impl.h index b15c83d..ced7a9e 100644 --- a/media/filters/audio_renderer_impl.h +++ b/media/filters/audio_renderer_impl.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -43,8 +43,8 @@ class AudioRendererImpl : public AudioRendererBase, virtual void SetVolume(float volume); // AudioSourceCallback implementation. - virtual size_t OnMoreData(AudioOutputStream* stream, void* dest, - size_t len, int pending_bytes); + virtual uint32 OnMoreData(AudioOutputStream* stream, void* dest, + uint32 len, uint32 pending_bytes); virtual void OnClose(AudioOutputStream* stream); virtual void OnError(AudioOutputStream* stream, int code); |