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

Unified Diff: content/renderer/media/audio_message_filter.cc

Issue 1930393002: Switch stream creation and closing in Chrome audio rendering from IPC to Mojo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase + tests in progress Created 4 years, 7 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: 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..2e74b6cbb3335591a840e04f8c945b17710b65fc 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));
+}
+
void AudioMessageFilter::AudioOutputIPCImpl::RequestDeviceAuthorization(
media::AudioOutputIPCDelegate* delegate,
int session_id,
@@ -103,11 +107,16 @@ 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_);
+ 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);
stream_created_ = true;
}
@@ -124,7 +133,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 +164,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()

Powered by Google App Engine
This is Rietveld 408576698