Chromium Code Reviews| Index: content/renderer/media/audio_message_filter.cc |
| diff --git a/content/renderer/media/audio_message_filter.cc b/content/renderer/media/audio_message_filter.cc |
| index 9e7322d128e65f0d5f9507a544c8cf01943e7d16..d58e7325544ff775df03d1999d0b620515e3fbff 100644 |
| --- a/content/renderer/media/audio_message_filter.cc |
| +++ b/content/renderer/media/audio_message_filter.cc |
| @@ -82,6 +82,10 @@ std::unique_ptr<media::AudioOutputIPC> AudioMessageFilter::CreateAudioOutputIPC( |
| new AudioOutputIPCImpl(this, render_frame_id)); |
| } |
| +void AudioMessageFilter::CloseStream(int stream_id) { |
| + Send(new AudioHostMsg_CloseStream(stream_id)); |
|
Henrik Grunell
2016/05/20 13:35:40
The AudioOutputIPCImpl should handle sending all t
rchtara
2016/05/27 15:24:37
this is going to be used for closing streams that
|
| +} |
| + |
| void AudioMessageFilter::AudioOutputIPCImpl::RequestDeviceAuthorization( |
| media::AudioOutputIPCDelegate* delegate, |
| int session_id, |
| @@ -103,11 +107,18 @@ void AudioMessageFilter::AudioOutputIPCImpl::CreateStream( |
| const media::AudioParameters& params) { |
| DCHECK(filter_->io_task_runner_->BelongsToCurrentThread()); |
| DCHECK(!stream_created_); |
| + auto client = filter_->audio_output_clients_.find(render_frame_id_); |
|
Henrik Grunell
2016/05/20 13:35:40
Should the clients be registered in AudioOutputIPC
Henrik Grunell
2016/05/20 13:35:40
Actually, we shouldn't need to go through the IPC
|
| + if (client == filter_->audio_output_clients_.end()) |
| + return; |
| if (stream_id_ == kStreamIDNotSet) |
| stream_id_ = filter_->delegates_.Add(delegate); |
| + // TODO(rchtara): This is temporary. In soon upcoming CLs AudioMessageFilter |
| + // and AudioMessageFilter::AudioOutputIPCImpl will be removed and replaced by |
| + // AudioOutputClient. |
| - filter_->Send( |
| - new AudioHostMsg_CreateStream(stream_id_, render_frame_id_, params)); |
| + client->second->CreateStream( |
| + stream_id_, params, |
| + base::Bind(&AudioOutputClient::CreateStreamCallback, client->second)); |
| stream_created_ = true; |
| } |
| @@ -124,7 +135,13 @@ void AudioMessageFilter::AudioOutputIPCImpl::PauseStream() { |
| void AudioMessageFilter::AudioOutputIPCImpl::CloseStream() { |
| DCHECK(filter_->io_task_runner_->BelongsToCurrentThread()); |
| DCHECK_NE(stream_id_, kStreamIDNotSet); |
| - filter_->Send(new AudioHostMsg_CloseStream(stream_id_)); |
| + auto client = filter_->audio_output_clients_.find(render_frame_id_); |
| + if (client == filter_->audio_output_clients_.end()) |
| + return; |
| + // TODO(rchtara): This is temporary. In soon upcoming CLs AudioMessageFilter |
| + // and AudioMessageFilter::AudioOutputIPCImpl will be removed and replaced by |
| + // AudioOutputClient. |
| + client->second->CloseStream(stream_id_); |
| filter_->delegates_.Remove(stream_id_); |
| stream_id_ = kStreamIDNotSet; |
| stream_created_ = false; |
| @@ -149,7 +166,6 @@ bool AudioMessageFilter::OnMessageReceived(const IPC::Message& message) { |
| bool handled = true; |
| IPC_BEGIN_MESSAGE_MAP(AudioMessageFilter, message) |
| IPC_MESSAGE_HANDLER(AudioMsg_NotifyDeviceAuthorized, OnDeviceAuthorized) |
| - IPC_MESSAGE_HANDLER(AudioMsg_NotifyStreamCreated, OnStreamCreated) |
| IPC_MESSAGE_HANDLER(AudioMsg_NotifyStreamStateChanged, OnStreamStateChanged) |
| IPC_MESSAGE_UNHANDLED(handled = false) |
| IPC_END_MESSAGE_MAP() |