Index: content/renderer/media/audio_hardware.cc |
diff --git a/content/renderer/media/audio_hardware.cc b/content/renderer/media/audio_hardware.cc |
index 1f49fdb991103682a94fe09a49f9693b51dff643..b65085714d52ec8c93bb75496edd43e738f83f56 100644 |
--- a/content/renderer/media/audio_hardware.cc |
+++ b/content/renderer/media/audio_hardware.cc |
@@ -49,28 +49,17 @@ size_t GetOutputBufferSize() { |
} |
size_t GetHighLatencyOutputBufferSize(int sample_rate) { |
- // The minimum number of samples in a hardware packet. |
- // This value is selected so that we can handle down to 5khz sample rate. |
- static const size_t kMinSamplesPerHardwarePacket = 1024; |
- |
- // The maximum number of samples in a hardware packet. |
- // This value is selected so that we can handle up to 192khz sample rate. |
- static const size_t kMaxSamplesPerHardwarePacket = 64 * 1024; |
- |
- // This constant governs the hardware audio buffer size, this value should be |
- // chosen carefully. |
- // This value is selected so that we have 8192 samples for 48khz streams. |
- static const size_t kMillisecondsPerHardwarePacket = 170; |
- |
- // Select the number of samples that can provide at least |
- // |kMillisecondsPerHardwarePacket| worth of audio data. |
- size_t samples = kMinSamplesPerHardwarePacket; |
- while (samples <= kMaxSamplesPerHardwarePacket && |
- samples * base::Time::kMillisecondsPerSecond < |
- sample_rate * kMillisecondsPerHardwarePacket) { |
- samples *= 2; |
- } |
- return samples; |
+ // kNominalBufferSize has been tested on Windows, Mac OS X, and Linux |
+ // using the low-latency audio codepath (SyncSocket implementation |
Chris Rogers
2012/02/23 23:39:54
Sorry for causing all the confusion with the doubl
vrk (LEFT CHROMIUM)
2012/02/27 18:19:13
Oh good catch! I opted for 2. Thanks!
|
+ // with the AUDIO_PCM_LINEAR flag. |
+ const size_t kNominalBufferSize = 2048; |
+ |
+ if (sample_rate <= 48000) |
+ return kNominalBufferSize; |
+ else if (sample_rate <= 96000) |
+ return kNominalBufferSize * 2; |
+ |
+ return kNominalBufferSize * 4; |
} |
uint32 GetInputChannelCount() { |