| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/renderer_host/media/audio_input_renderer_host.h" | 5 #include "content/browser/renderer_host/media/audio_input_renderer_host.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 } | 152 } |
| 153 | 153 |
| 154 void AudioInputRendererHost::OnLog(media::AudioInputController* controller, | 154 void AudioInputRendererHost::OnLog(media::AudioInputController* controller, |
| 155 const std::string& message) { | 155 const std::string& message) { |
| 156 BrowserThread::PostTask( | 156 BrowserThread::PostTask( |
| 157 BrowserThread::IO, FROM_HERE, | 157 BrowserThread::IO, FROM_HERE, |
| 158 base::BindOnce(&AudioInputRendererHost::DoLog, this, | 158 base::BindOnce(&AudioInputRendererHost::DoLog, this, |
| 159 base::RetainedRef(controller), message)); | 159 base::RetainedRef(controller), message)); |
| 160 } | 160 } |
| 161 | 161 |
| 162 void AudioInputRendererHost::OnMuted(media::AudioInputController* controller, |
| 163 bool is_muted) { |
| 164 BrowserThread::PostTask( |
| 165 BrowserThread::IO, FROM_HERE, |
| 166 base::Bind(&AudioInputRendererHost::DoNotifyMutedState, this, |
| 167 base::RetainedRef(controller), is_muted)); |
| 168 } |
| 169 |
| 162 void AudioInputRendererHost::set_renderer_pid(int32_t renderer_pid) { | 170 void AudioInputRendererHost::set_renderer_pid(int32_t renderer_pid) { |
| 163 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 171 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 164 renderer_pid_ = renderer_pid; | 172 renderer_pid_ = renderer_pid; |
| 165 } | 173 } |
| 166 | 174 |
| 167 void AudioInputRendererHost::DoCompleteCreation( | 175 void AudioInputRendererHost::DoCompleteCreation( |
| 168 media::AudioInputController* controller) { | 176 media::AudioInputController* controller) { |
| 169 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 177 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 170 | 178 |
| 171 AudioEntry* entry = LookupByController(controller); | 179 AudioEntry* entry = LookupByController(controller); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 void AudioInputRendererHost::DoLog(media::AudioInputController* controller, | 236 void AudioInputRendererHost::DoLog(media::AudioInputController* controller, |
| 229 const std::string& message) { | 237 const std::string& message) { |
| 230 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 238 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 231 AudioEntry* entry = LookupByController(controller); | 239 AudioEntry* entry = LookupByController(controller); |
| 232 DCHECK(entry); | 240 DCHECK(entry); |
| 233 | 241 |
| 234 // Add stream ID and current audio level reported by AIC to native log. | 242 // Add stream ID and current audio level reported by AIC to native log. |
| 235 LogMessage(entry->stream_id, message, false); | 243 LogMessage(entry->stream_id, message, false); |
| 236 } | 244 } |
| 237 | 245 |
| 246 void AudioInputRendererHost::DoNotifyMutedState( |
| 247 media::AudioInputController* controller, |
| 248 bool is_muted) { |
| 249 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 250 AudioEntry* entry = LookupByController(controller); |
| 251 DCHECK(entry); |
| 252 LogMessage(entry->stream_id, |
| 253 base::StringPrintf("OnMuted: State changed to: %s", |
| 254 (is_muted ? "muted" : "not muted")), |
| 255 true); |
| 256 Send(new AudioInputMsg_NotifyStreamMuted(entry->stream_id, is_muted)); |
| 257 } |
| 258 |
| 238 bool AudioInputRendererHost::OnMessageReceived(const IPC::Message& message) { | 259 bool AudioInputRendererHost::OnMessageReceived(const IPC::Message& message) { |
| 239 bool handled = true; | 260 bool handled = true; |
| 240 IPC_BEGIN_MESSAGE_MAP(AudioInputRendererHost, message) | 261 IPC_BEGIN_MESSAGE_MAP(AudioInputRendererHost, message) |
| 241 IPC_MESSAGE_HANDLER(AudioInputHostMsg_CreateStream, OnCreateStream) | 262 IPC_MESSAGE_HANDLER(AudioInputHostMsg_CreateStream, OnCreateStream) |
| 242 IPC_MESSAGE_HANDLER(AudioInputHostMsg_RecordStream, OnRecordStream) | 263 IPC_MESSAGE_HANDLER(AudioInputHostMsg_RecordStream, OnRecordStream) |
| 243 IPC_MESSAGE_HANDLER(AudioInputHostMsg_CloseStream, OnCloseStream) | 264 IPC_MESSAGE_HANDLER(AudioInputHostMsg_CloseStream, OnCloseStream) |
| 244 IPC_MESSAGE_HANDLER(AudioInputHostMsg_SetVolume, OnSetVolume) | 265 IPC_MESSAGE_HANDLER(AudioInputHostMsg_SetVolume, OnSetVolume) |
| 245 IPC_MESSAGE_UNHANDLED(handled = false) | 266 IPC_MESSAGE_UNHANDLED(handled = false) |
| 246 IPC_END_MESSAGE_MAP() | 267 IPC_END_MESSAGE_MAP() |
| 247 | 268 |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 const base::FilePath& file, | 595 const base::FilePath& file, |
| 575 int stream_id) { | 596 int stream_id) { |
| 576 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 597 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 577 EnableDebugRecordingForId(GetDebugRecordingFilePathWithExtensions(file), | 598 EnableDebugRecordingForId(GetDebugRecordingFilePathWithExtensions(file), |
| 578 stream_id); | 599 stream_id); |
| 579 } | 600 } |
| 580 | 601 |
| 581 #endif // BUILDFLAG(ENABLE_WEBRTC) | 602 #endif // BUILDFLAG(ENABLE_WEBRTC) |
| 582 | 603 |
| 583 } // namespace content | 604 } // namespace content |
| OLD | NEW |