Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(653)

Unified Diff: content/browser/renderer_host/media/audio_sync_reader.cc

Issue 11348166: Always wait for DataReady() on Windows WaveOut. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Typo. Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/renderer_host/media/audio_sync_reader.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « content/browser/renderer_host/media/audio_sync_reader.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698