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

Unified Diff: media/audio/audio_output_proxy.h

Issue 9691001: Audio software mixer. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 8 years, 9 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: media/audio/audio_output_proxy.h
===================================================================
--- media/audio/audio_output_proxy.h (revision 130123)
+++ media/audio/audio_output_proxy.h (working copy)
@@ -8,6 +8,7 @@
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/memory/ref_counted.h"
+#include "base/synchronization/lock.h"
#include "base/threading/non_thread_safe.h"
#include "media/audio/audio_io.h"
#include "media/audio/audio_parameters.h"
@@ -24,6 +25,7 @@
// physical output streams.
class MEDIA_EXPORT AudioOutputProxy
: public AudioOutputStream,
+ public AudioOutputStream::AudioSourceCallback,
public NON_EXPORTED_BASE(base::NonThreadSafe) {
public:
// Caller keeps ownership of |dispatcher|.
@@ -37,6 +39,13 @@
virtual void GetVolume(double* volume) OVERRIDE;
virtual void Close() OVERRIDE;
+ // AudioSourceCallback interface.
+ virtual uint32 OnMoreData(
+ AudioOutputStream* stream, uint8* dest, uint32 max_size,
+ AudioBuffersState buffers_state) OVERRIDE;
+ virtual void OnError(AudioOutputStream* stream, int code) OVERRIDE;
+ virtual void WaitTillDataReady() OVERRIDE;
+
private:
enum State {
kCreated,
@@ -51,14 +60,16 @@
scoped_refptr<AudioOutputDispatcher> dispatcher_;
State state_;
- // The actual audio stream. Must be set to NULL in any state other
- // than kPlaying.
- AudioOutputStream* physical_stream_;
-
// Need to save volume here, so that we can restore it in case the stream
// is stopped, and then started again.
double volume_;
+ // Callback.
+ AudioSourceCallback* audio_source_callback_;
+
+ // Lock protecting |volume_| -- we can read it in the hardware audio thread.
+ base::Lock lock_;
+
DISALLOW_COPY_AND_ASSIGN(AudioOutputProxy);
};

Powered by Google App Engine
This is Rietveld 408576698