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

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

Issue 22886005: Switch audio synchronization from sleep() based to select() based. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 months 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
Index: content/browser/renderer_host/media/audio_sync_reader.h
diff --git a/content/browser/renderer_host/media/audio_sync_reader.h b/content/browser/renderer_host/media/audio_sync_reader.h
index fdfbf81a6013ff132a5d142b8356b9dcfd7fabb4..3842f49b6ee57d8fc56f1f2e6790fe9dbdae9d9b 100644
--- a/content/browser/renderer_host/media/audio_sync_reader.h
+++ b/content/browser/renderer_host/media/audio_sync_reader.h
@@ -33,6 +33,7 @@ class AudioSyncReader : public media::AudioOutputController::SyncReader {
// media::AudioOutputController::SyncReader implementations.
virtual void UpdatePendingBytes(uint32 bytes) OVERRIDE;
+ // TODO(dalecurtis): Remove block.
virtual int Read(bool block,
const media::AudioBus* source,
media::AudioBus* dest) OVERRIDE;
@@ -50,8 +51,9 @@ class AudioSyncReader : public media::AudioOutputController::SyncReader {
// Indicates whether the renderer has data available for reading.
bool DataReady();
- // Blocks until DataReady() is true or a timeout expires.
- void WaitTillDataReady();
+ // Blocks until DataReady() is true or a timeout expires. Returns false if a
+ // timeout occurs.
+ bool WaitTillDataReady();
base::SharedMemory* shared_memory_;
@@ -83,6 +85,14 @@ class AudioSyncReader : public media::AudioOutputController::SyncReader {
size_t renderer_callback_count_;
size_t renderer_missed_callback_count_;
+ // The maximum amount of time to wait for data from the renderer. Calculated
+ // from the parameters given at construction.
+ const base::TimeDelta maximum_wait_time_;
+
+ // The index of the audio buffer we're expecting to be sent from the renderer;
+ // used to block with timeout for audio data.
+ uint32_t buffer_index_;
+
DISALLOW_COPY_AND_ASSIGN(AudioSyncReader);
};

Powered by Google App Engine
This is Rietveld 408576698