Index: media/audio/audio_output_controller.h |
diff --git a/media/audio/audio_output_controller.h b/media/audio/audio_output_controller.h |
index 762a9483d0fb51d1bdeed0cfa08a042508bab368..5ff8a2b236e8e435a6b0fbd7d40cda28e7896a2f 100644 |
--- a/media/audio/audio_output_controller.h |
+++ b/media/audio/audio_output_controller.h |
@@ -9,6 +9,7 @@ |
#include "base/memory/ref_counted.h" |
#include "base/memory/weak_ptr.h" |
#include "base/synchronization/lock.h" |
+#include "base/threading/thread_checker.h" |
#include "media/audio/audio_buffers_state.h" |
#include "media/audio/audio_io.h" |
#include "media/audio/audio_manager.h" |
@@ -154,6 +155,19 @@ class MEDIA_EXPORT AudioOutputController |
// to being called. |
virtual void OnDeviceChange() OVERRIDE; |
+ // Accessor to audio output parameters. |
+ const AudioParameters& params() const { return params_; } |
+ |
+ // Stops the normal audio output stream and begins providing audio data to |
+ // another destination. |to_stream| remains under complete control of |
+ // AudioOutputController. |
+ void StartDiverting(AudioOutputStream* to_stream); |
+ |
+ // Restores normal audio output behavior. The stream that was provided in the |
+ // previous call to StartDiverting() is closed at some point by |
+ // AudioOutputController. |
+ void StopDiverting(); |
+ |
protected: |
// Internal state of the source. |
enum State { |
@@ -196,12 +210,22 @@ class MEDIA_EXPORT AudioOutputController |
// Signals event when done if it is not NULL. |
void DoStopCloseAndClearStream(base::WaitableEvent *done); |
- AudioManager* audio_manager_; |
+ AudioManager* const audio_manager_; |
+ const AudioParameters params_; |
// |handler_| may be called only if |state_| is not kClosed. |
EventHandler* handler_; |
+ |
+ // Currently open stream. |
AudioOutputStream* stream_; |
+ // When non-NULL, audio is being diverted to this stream. |
+ AudioOutputStream* diverting_to_stream_; |
+ |
+ // Checks that the same single outside thread is calling StartDiverting() and |
+ // StopDiverting(). |
+ base::ThreadChecker divert_thread_checker_; |
+ |
// The current volume of the audio stream. |
double volume_; |
@@ -224,8 +248,6 @@ class MEDIA_EXPORT AudioOutputController |
// Number of times left. |
int number_polling_attempts_left_; |
- AudioParameters params_; |
- |
// Used to post delayed tasks to ourselves that we can cancel. |
// We don't want the tasks to hold onto a reference as it will slow down |
// shutdown and force it to wait for the most delayed task. |