Index: content/browser/renderer_host/media/audio_sync_reader.cc |
diff --git a/content/browser/renderer_host/media/audio_sync_reader.cc b/content/browser/renderer_host/media/audio_sync_reader.cc |
index 037f56809ef7adf0d2a09055c49f8a0e80c60465..63ae28ab9476b671861c048172ec7d9713c3899e 100644 |
--- a/content/browser/renderer_host/media/audio_sync_reader.cc |
+++ b/content/browser/renderer_host/media/audio_sync_reader.cc |
@@ -13,10 +13,6 @@ |
#include "media/audio/audio_parameters.h" |
#include "media/audio/shared_memory_util.h" |
-#if defined(OS_WIN) |
-const int kMinIntervalBetweenReadCallsInMs = 10; |
-#endif |
- |
using media::AudioBus; |
namespace content { |
@@ -63,19 +59,14 @@ void AudioSyncReader::UpdatePendingBytes(uint32 bytes) { |
int AudioSyncReader::Read(AudioBus* source, AudioBus* dest) { |
#if defined(OS_WIN) |
- // HACK: yield if reader is called too often. |
- // Problem is lack of synchronization between host and renderer. We cannot be |
- // sure if renderer already filled the buffer, and due to all the plugins we |
- // cannot change the API, so we yield if previous call was too recent. |
- // Optimization: if renderer is "new" one that writes length of data we can |
- // stop yielding the moment length is written -- not ideal solution, |
- // but better than nothing. |
- while (!DataReady() && |
- ((base::Time::Now() - previous_call_time_).InMilliseconds() < |
- kMinIntervalBetweenReadCallsInMs)) { |
+ // HACK: Yield if Read() is called too often. On older platforms which are |
+ // still using the WaveOut back end, we run into synchronization issues where |
+ // the renderer has not finished filling the shared memory when Read() is |
+ // called. Reading too early will lead to clicks and pops. See issues: |
+ // http://crbug.com/161307 and http://crbug.com/61022 |
scherkus (not reviewing)
2012/11/20 21:08:46
does it make sense to add a run-time check for XP?
DaleCurtis
2012/11/20 21:33:47
I thought about that, but there are cases where we
|
+ while (!DataReady()) { |
base::PlatformThread::YieldCurrentThread(); |
} |
- previous_call_time_ = base::Time::Now(); |
#endif |
// Copy optional synchronized live audio input for consumption by renderer |