| 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 base::RetainedRef(controller), error_code)); | 151 base::RetainedRef(controller), error_code)); |
| 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(BrowserThread::IO, FROM_HERE, | 156 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
| 157 base::Bind(&AudioInputRendererHost::DoLog, this, | 157 base::Bind(&AudioInputRendererHost::DoLog, this, |
| 158 base::RetainedRef(controller), message)); | 158 base::RetainedRef(controller), message)); |
| 159 } | 159 } |
| 160 | 160 |
| 161 void AudioInputRendererHost::OnMuted(media::AudioInputController* controller, |
| 162 bool is_muted) { |
| 163 BrowserThread::PostTask( |
| 164 BrowserThread::IO, FROM_HERE, |
| 165 base::Bind(&AudioInputRendererHost::DoNotifyMutedState, this, |
| 166 base::RetainedRef(controller), is_muted)); |
| 167 } |
| 168 |
| 161 void AudioInputRendererHost::set_renderer_pid(int32_t renderer_pid) { | 169 void AudioInputRendererHost::set_renderer_pid(int32_t renderer_pid) { |
| 162 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 170 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 163 renderer_pid_ = renderer_pid; | 171 renderer_pid_ = renderer_pid; |
| 164 } | 172 } |
| 165 | 173 |
| 166 void AudioInputRendererHost::DoCompleteCreation( | 174 void AudioInputRendererHost::DoCompleteCreation( |
| 167 media::AudioInputController* controller) { | 175 media::AudioInputController* controller) { |
| 168 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 176 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 169 | 177 |
| 170 AudioEntry* entry = LookupByController(controller); | 178 AudioEntry* entry = LookupByController(controller); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 void AudioInputRendererHost::DoLog(media::AudioInputController* controller, | 235 void AudioInputRendererHost::DoLog(media::AudioInputController* controller, |
| 228 const std::string& message) { | 236 const std::string& message) { |
| 229 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 237 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 230 AudioEntry* entry = LookupByController(controller); | 238 AudioEntry* entry = LookupByController(controller); |
| 231 DCHECK(entry); | 239 DCHECK(entry); |
| 232 | 240 |
| 233 // Add stream ID and current audio level reported by AIC to native log. | 241 // Add stream ID and current audio level reported by AIC to native log. |
| 234 LogMessage(entry->stream_id, message, false); | 242 LogMessage(entry->stream_id, message, false); |
| 235 } | 243 } |
| 236 | 244 |
| 245 void AudioInputRendererHost::DoNotifyMutedState( |
| 246 media::AudioInputController* controller, |
| 247 bool is_muted) { |
| 248 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 249 AudioEntry* entry = LookupByController(controller); |
| 250 DCHECK(entry); |
| 251 LogMessage(entry->stream_id, |
| 252 base::StringPrintf("OnMuted: State changed to: %s", |
| 253 (is_muted ? "muted" : "not muted")), |
| 254 true); |
| 255 Send(new AudioInputMsg_NotifyStreamMuted(entry->stream_id, is_muted)); |
| 256 } |
| 257 |
| 237 bool AudioInputRendererHost::OnMessageReceived(const IPC::Message& message) { | 258 bool AudioInputRendererHost::OnMessageReceived(const IPC::Message& message) { |
| 238 bool handled = true; | 259 bool handled = true; |
| 239 IPC_BEGIN_MESSAGE_MAP(AudioInputRendererHost, message) | 260 IPC_BEGIN_MESSAGE_MAP(AudioInputRendererHost, message) |
| 240 IPC_MESSAGE_HANDLER(AudioInputHostMsg_CreateStream, OnCreateStream) | 261 IPC_MESSAGE_HANDLER(AudioInputHostMsg_CreateStream, OnCreateStream) |
| 241 IPC_MESSAGE_HANDLER(AudioInputHostMsg_RecordStream, OnRecordStream) | 262 IPC_MESSAGE_HANDLER(AudioInputHostMsg_RecordStream, OnRecordStream) |
| 242 IPC_MESSAGE_HANDLER(AudioInputHostMsg_CloseStream, OnCloseStream) | 263 IPC_MESSAGE_HANDLER(AudioInputHostMsg_CloseStream, OnCloseStream) |
| 243 IPC_MESSAGE_HANDLER(AudioInputHostMsg_SetVolume, OnSetVolume) | 264 IPC_MESSAGE_HANDLER(AudioInputHostMsg_SetVolume, OnSetVolume) |
| 244 IPC_MESSAGE_UNHANDLED(handled = false) | 265 IPC_MESSAGE_UNHANDLED(handled = false) |
| 245 IPC_END_MESSAGE_MAP() | 266 IPC_END_MESSAGE_MAP() |
| 246 | 267 |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 const base::FilePath& file, | 597 const base::FilePath& file, |
| 577 int stream_id) { | 598 int stream_id) { |
| 578 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 599 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 579 EnableDebugRecordingForId(GetDebugRecordingFilePathWithExtensions(file), | 600 EnableDebugRecordingForId(GetDebugRecordingFilePathWithExtensions(file), |
| 580 stream_id); | 601 stream_id); |
| 581 } | 602 } |
| 582 | 603 |
| 583 #endif // BUILDFLAG(ENABLE_WEBRTC) | 604 #endif // BUILDFLAG(ENABLE_WEBRTC) |
| 584 | 605 |
| 585 } // namespace content | 606 } // namespace content |
| OLD | NEW |