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

Unified Diff: media/audio/audio_output_device.cc

Issue 12383016: Merge AssociateStreamWithProducer message into CreateStream message for both audio output and input. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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_device.cc
diff --git a/media/audio/audio_output_device.cc b/media/audio/audio_output_device.cc
index e95d21b712aa3351c81e988a75f5f12721281000..a532b045c37e34aad38b0176b1ab0faa94124bb6 100644
--- a/media/audio/audio_output_device.cc
+++ b/media/audio/audio_output_device.cc
@@ -49,7 +49,6 @@ AudioOutputDevice::AudioOutputDevice(
play_on_start_(true),
stopping_hack_(false) {
CHECK(ipc_);
- stream_id_ = ipc_->AddDelegate(this);
}
void AudioOutputDevice::Initialize(const AudioParameters& params,
@@ -64,9 +63,6 @@ AudioOutputDevice::~AudioOutputDevice() {
// The current design requires that the user calls Stop() before deleting
// this class.
DCHECK(audio_thread_.IsStopped());
-
- if (ipc_)
- ipc_->RemoveDelegate(stream_id_);
}
void AudioOutputDevice::Start() {
@@ -113,14 +109,14 @@ void AudioOutputDevice::CreateStreamOnIOThread(const AudioParameters& params) {
DCHECK(message_loop()->BelongsToCurrentThread());
if (state_ == IDLE) {
state_ = CREATING_STREAM;
- ipc_->CreateStream(stream_id_, params);
+ ipc_->CreateStream(this, params);
}
}
void AudioOutputDevice::PlayOnIOThread() {
DCHECK(message_loop()->BelongsToCurrentThread());
if (state_ == PAUSED) {
- ipc_->PlayStream(stream_id_);
+ ipc_->PlayStream();
state_ = PLAYING;
play_on_start_ = false;
} else {
@@ -131,9 +127,9 @@ void AudioOutputDevice::PlayOnIOThread() {
void AudioOutputDevice::PauseOnIOThread(bool flush) {
DCHECK(message_loop()->BelongsToCurrentThread());
if (state_ == PLAYING) {
- ipc_->PauseStream(stream_id_);
+ ipc_->PauseStream();
if (flush)
- ipc_->FlushStream(stream_id_);
+ ipc_->FlushStream();
state_ = PAUSED;
} else {
// Note that |flush| isn't relevant here since this is the case where
@@ -147,7 +143,7 @@ void AudioOutputDevice::ShutDownOnIOThread() {
// Make sure we don't call shutdown more than once.
if (state_ >= CREATING_STREAM) {
- ipc_->CloseStream(stream_id_);
+ ipc_->CloseStream();
state_ = IDLE;
}
@@ -169,7 +165,7 @@ void AudioOutputDevice::ShutDownOnIOThread() {
void AudioOutputDevice::SetVolumeOnIOThread(double volume) {
DCHECK(message_loop()->BelongsToCurrentThread());
if (state_ >= CREATING_STREAM)
- ipc_->SetVolume(stream_id_, volume);
+ ipc_->SetVolume(volume);
}
void AudioOutputDevice::OnStateChanged(AudioOutputIPCDelegate::State state) {
@@ -240,7 +236,6 @@ void AudioOutputDevice::OnStreamCreated(
void AudioOutputDevice::OnIPCClosed() {
DCHECK(message_loop()->BelongsToCurrentThread());
state_ = IPC_CLOSED;
- ipc_ = NULL;
DaleCurtis 2013/03/01 00:27:52 filter_ is destroyed after this is called, so you
miu 2013/03/02 00:24:16 That's why I added the comment in the header file
}
void AudioOutputDevice::WillDestroyCurrentMessageLoop() {

Powered by Google App Engine
This is Rietveld 408576698