summaryrefslogtreecommitdiffstats
path: root/media/audio/audio_output_controller.h
diff options
context:
space:
mode:
authorsergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-16 01:13:53 +0000
committersergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-16 01:13:53 +0000
commitfa71f6840afff9f846471d4eb2e9461c636b0c21 (patch)
tree6f18ed7c375f5badfc6652a3ee93936aa9317cdc /media/audio/audio_output_controller.h
parent2055d3fde0b4ac33bbde4f020bd64d7cd047b3d7 (diff)
downloadchromium_src-fa71f6840afff9f846471d4eb2e9461c636b0c21.zip
chromium_src-fa71f6840afff9f846471d4eb2e9461c636b0c21.tar.gz
chromium_src-fa71f6840afff9f846471d4eb2e9461c636b0c21.tar.bz2
Make AudioOutputController.Close() truly asynchronous.
Added closed_task parameter in this method. This parameter is used to notify the caller when the stream is actually closed. Callbacks may be called until closed_task is executed. BUG=55755 TEST=Unittests, audio still works, doesn't crash Review URL: http://codereview.chromium.org/3415007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59600 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/audio/audio_output_controller.h')
-rw-r--r--media/audio/audio_output_controller.h15
1 files changed, 8 insertions, 7 deletions
diff --git a/media/audio/audio_output_controller.h b/media/audio/audio_output_controller.h
index e9ed321..8208e28 100644
--- a/media/audio/audio_output_controller.h
+++ b/media/audio/audio_output_controller.h
@@ -14,6 +14,7 @@
#include "media/audio/simple_sources.h"
class MessageLoop;
+class Task;
// An AudioOutputController controls an AudioOutputStream and provides data
// to this output stream. It has an important function that it executes
@@ -134,13 +135,14 @@ class AudioOutputController
// has effect when the stream is paused.
void Flush();
- // Closes the audio output stream. It changes state to kClosed and returns
- // right away. The physical resources are freed on the audio thread if
- // neccessary.
+ // Closes the audio output stream. The state is changed and the resources
+ // are freed on the audio thread. closed_task is executed after that.
+ // Callbacks (EventHandler and SyncReader) must exist until closed_task is
+ // called.
//
// It is safe to call this method more than once. Calls after the first one
// will have no effect.
- void Close();
+ void Close(Task* closed_task);
// Sets the volume of the audio output stream.
void SetVolume(double volume);
@@ -168,7 +170,7 @@ class AudioOutputController
void DoPlay();
void DoPause();
void DoFlush();
- void DoClose();
+ void DoClose(Task* closed_task);
void DoSetVolume(double volume);
void DoReportError(int code);
@@ -190,8 +192,7 @@ class AudioOutputController
uint32 hardware_pending_bytes_;
base::Time last_callback_time_;
- // The |lock_| must be acquired whenever we access |state_| or call
- // |handler_|.
+ // The |lock_| must be acquired whenever we access |push_source_|.
Lock lock_;
// PushSource role is to buffer and it's only used in regular latency mode.