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

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: Fix DCHECK. Created 7 years, 2 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..e9f57a0ce58860b5457513dd9d1450bc7b253c7f 100644
--- a/content/browser/renderer_host/media/audio_sync_reader.h
+++ b/content/browser/renderer_host/media/audio_sync_reader.h
@@ -33,9 +33,8 @@ class AudioSyncReader : public media::AudioOutputController::SyncReader {
// media::AudioOutputController::SyncReader implementations.
virtual void UpdatePendingBytes(uint32 bytes) OVERRIDE;
- virtual int Read(bool block,
- const media::AudioBus* source,
- media::AudioBus* dest) OVERRIDE;
+ virtual void Read(const media::AudioBus* source,
+ media::AudioBus* dest) OVERRIDE;
virtual void Close() OVERRIDE;
bool Init();
@@ -47,11 +46,9 @@ class AudioSyncReader : public media::AudioOutputController::SyncReader {
#endif
private:
- // Indicates whether the renderer has data available for reading.
- bool DataReady();
-
- // Blocks until DataReady() is true or a timeout expires.
- void WaitTillDataReady();
+ // Blocks until data is ready for reading or a timeout expires. Returns false
+ // if an error or timeout occurs.
+ bool WaitUntilDataIsReady();
base::SharedMemory* shared_memory_;
@@ -83,6 +80,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 buffer_index_;
+
DISALLOW_COPY_AND_ASSIGN(AudioSyncReader);
};
« no previous file with comments | « content/browser/renderer_host/media/audio_renderer_host.cc ('k') | content/browser/renderer_host/media/audio_sync_reader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698