summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authortzik@chromium.org <tzik@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-07 04:44:05 +0000
committertzik@chromium.org <tzik@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-07 04:44:05 +0000
commitd5861b0ad3fa20f5984fb623ebea7091db0aaac8 (patch)
treefcb48dadc5bdacc2052c60b0eefeec67c70f4e63 /media
parent2a22fe7726d3bda473324f7df9841701dd69e746 (diff)
downloadchromium_src-d5861b0ad3fa20f5984fb623ebea7091db0aaac8.zip
chromium_src-d5861b0ad3fa20f5984fb623ebea7091db0aaac8.tar.gz
chromium_src-d5861b0ad3fa20f5984fb623ebea7091db0aaac8.tar.bz2
Revert 171681
> Delay delivery of audio input data. > > The AudioQueue API may use a large internal buffer and repeatedly call us > back to back once that internal buffer is filled. When this happens the > renderer client does not have enough time to read data back from the > shared memory before the next write comes along. If HandleInputBuffer() > is called too frequently, Sleep() to simulate realtime input and ensure > the shared memory doesn't get trampled. > > BUG=157613 > TEST=Playback works on older style Mac units. > > Review URL: https://codereview.chromium.org/11482002 TBR=dalecurtis@google.com Review URL: https://codereview.chromium.org/11478019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@171692 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r--media/audio/mac/audio_input_mac.cc21
-rw-r--r--media/audio/mac/audio_input_mac.h5
2 files changed, 2 insertions, 24 deletions
diff --git a/media/audio/mac/audio_input_mac.cc b/media/audio/mac/audio_input_mac.cc
index 69791cf..fd2d9be 100644
--- a/media/audio/mac/audio_input_mac.cc
+++ b/media/audio/mac/audio_input_mac.cc
@@ -192,31 +192,12 @@ void PCMQueueInAudioInputStream::HandleInputBuffer(
return;
}
- if (audio_buffer->mAudioDataByteSize) {
- // The AudioQueue API may use a large internal buffer and repeatedly call us
- // back to back once that internal buffer is filled. When this happens the
- // renderer client does not have enough time to read data back from the
- // shared memory before the next write comes along. If HandleInputBuffer()
- // is called too frequently, Sleep() to simulate realtime input and ensure
- // the shared memory doesn't get trampled.
- // TODO(dalecurtis): This is a HACK. Long term the AudioQueue path is going
- // away in favor of the AudioUnit based AUAudioInputStream(). Tracked by
- // http://crbug.com/161383
- base::TimeDelta elapsed = base::Time::Now() - last_fill_;
- base::TimeDelta buffer_length = base::TimeDelta::FromMilliseconds(
- audio_buffer->mAudioDataByteSize * base::Time::kMillisecondsPerSecond /
- static_cast<float>(format_.mBytesPerFrame * format_.mSampleRate));
- if (elapsed < buffer_length)
- base::PlatformThread::Sleep(buffer_length - elapsed);
-
+ if (audio_buffer->mAudioDataByteSize)
callback_->OnData(this,
reinterpret_cast<const uint8*>(audio_buffer->mAudioData),
audio_buffer->mAudioDataByteSize,
audio_buffer->mAudioDataByteSize,
0.0);
-
- last_fill_ = base::Time::Now();
- }
// Recycle the buffer.
OSStatus err = QueueNextBuffer(audio_buffer);
if (err != noErr) {
diff --git a/media/audio/mac/audio_input_mac.h b/media/audio/mac/audio_input_mac.h
index 1f9856f1..ddef40f 100644
--- a/media/audio/mac/audio_input_mac.h
+++ b/media/audio/mac/audio_input_mac.h
@@ -9,7 +9,6 @@
#include <AudioToolbox/AudioFormat.h>
#include "base/compiler_specific.h"
-#include "base/time.h"
#include "media/audio/audio_io.h"
#include "media/audio/audio_parameters.h"
@@ -63,7 +62,7 @@ class PCMQueueInAudioInputStream : public AudioInputStream {
UInt32 num_packets,
const AudioStreamPacketDescription* packet_desc);
- static const int kNumberBuffers = 3;
+ static const int kNumberBuffers = 1;
// Manager that owns this stream, used for closing down.
AudioManagerBase* manager_;
@@ -77,8 +76,6 @@ class PCMQueueInAudioInputStream : public AudioInputStream {
uint32 buffer_size_bytes_;
// True iff Start() has been called successfully.
bool started_;
- // Used to determine if we need to slow down |callback_| calls.
- base::Time last_fill_;
DISALLOW_COPY_AND_ASSIGN(PCMQueueInAudioInputStream);
};