| 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 base::RetainedRef(controller), error_code)); | 154 base::RetainedRef(controller), error_code)); |
| 155 } | 155 } |
| 156 | 156 |
| 157 void AudioInputRendererHost::OnLog(media::AudioInputController* controller, | 157 void AudioInputRendererHost::OnLog(media::AudioInputController* controller, |
| 158 const std::string& message) { | 158 const std::string& message) { |
| 159 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 159 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
| 160 base::Bind(&AudioInputRendererHost::DoLog, this, | 160 base::Bind(&AudioInputRendererHost::DoLog, this, |
| 161 base::RetainedRef(controller), message)); | 161 base::RetainedRef(controller), message)); |
| 162 } | 162 } |
| 163 | 163 |
| 164 void AudioInputRendererHost::OnMuted(media::AudioInputController* controller, |
| 165 bool is_muted) { |
| 166 BrowserThread::PostTask( |
| 167 BrowserThread::IO, FROM_HERE, |
| 168 base::Bind(&AudioInputRendererHost::DoNotifyMutedState, this, |
| 169 base::RetainedRef(controller), is_muted)); |
| 170 } |
| 171 |
| 164 void AudioInputRendererHost::set_renderer_pid(int32_t renderer_pid) { | 172 void AudioInputRendererHost::set_renderer_pid(int32_t renderer_pid) { |
| 165 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 173 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 166 renderer_pid_ = renderer_pid; | 174 renderer_pid_ = renderer_pid; |
| 167 } | 175 } |
| 168 | 176 |
| 169 void AudioInputRendererHost::DoCompleteCreation( | 177 void AudioInputRendererHost::DoCompleteCreation( |
| 170 media::AudioInputController* controller) { | 178 media::AudioInputController* controller) { |
| 171 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 179 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 172 | 180 |
| 173 AudioEntry* entry = LookupByController(controller); | 181 AudioEntry* entry = LookupByController(controller); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 void AudioInputRendererHost::DoLog(media::AudioInputController* controller, | 232 void AudioInputRendererHost::DoLog(media::AudioInputController* controller, |
| 225 const std::string& message) { | 233 const std::string& message) { |
| 226 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 234 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 227 AudioEntry* entry = LookupByController(controller); | 235 AudioEntry* entry = LookupByController(controller); |
| 228 DCHECK(entry); | 236 DCHECK(entry); |
| 229 | 237 |
| 230 // Add stream ID and current audio level reported by AIC to native log. | 238 // Add stream ID and current audio level reported by AIC to native log. |
| 231 LogMessage(entry->stream_id, message, false); | 239 LogMessage(entry->stream_id, message, false); |
| 232 } | 240 } |
| 233 | 241 |
| 242 void AudioInputRendererHost::DoNotifyMutedState( |
| 243 media::AudioInputController* controller, |
| 244 bool is_muted) { |
| 245 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 246 AudioEntry* entry = LookupByController(controller); |
| 247 DCHECK(entry); |
| 248 Send(new AudioInputMsg_NotifyStreamMuted(entry->stream_id, is_muted)); |
| 249 } |
| 250 |
| 234 bool AudioInputRendererHost::OnMessageReceived(const IPC::Message& message) { | 251 bool AudioInputRendererHost::OnMessageReceived(const IPC::Message& message) { |
| 235 bool handled = true; | 252 bool handled = true; |
| 236 IPC_BEGIN_MESSAGE_MAP(AudioInputRendererHost, message) | 253 IPC_BEGIN_MESSAGE_MAP(AudioInputRendererHost, message) |
| 237 IPC_MESSAGE_HANDLER(AudioInputHostMsg_CreateStream, OnCreateStream) | 254 IPC_MESSAGE_HANDLER(AudioInputHostMsg_CreateStream, OnCreateStream) |
| 238 IPC_MESSAGE_HANDLER(AudioInputHostMsg_RecordStream, OnRecordStream) | 255 IPC_MESSAGE_HANDLER(AudioInputHostMsg_RecordStream, OnRecordStream) |
| 239 IPC_MESSAGE_HANDLER(AudioInputHostMsg_CloseStream, OnCloseStream) | 256 IPC_MESSAGE_HANDLER(AudioInputHostMsg_CloseStream, OnCloseStream) |
| 240 IPC_MESSAGE_HANDLER(AudioInputHostMsg_SetVolume, OnSetVolume) | 257 IPC_MESSAGE_HANDLER(AudioInputHostMsg_SetVolume, OnSetVolume) |
| 241 IPC_MESSAGE_UNHANDLED(handled = false) | 258 IPC_MESSAGE_UNHANDLED(handled = false) |
| 242 IPC_END_MESSAGE_MAP() | 259 IPC_END_MESSAGE_MAP() |
| 243 | 260 |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 const base::FilePath& file, | 611 const base::FilePath& file, |
| 595 int stream_id) { | 612 int stream_id) { |
| 596 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 613 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 597 EnableDebugRecordingForId(GetDebugRecordingFilePathWithExtensions(file), | 614 EnableDebugRecordingForId(GetDebugRecordingFilePathWithExtensions(file), |
| 598 stream_id); | 615 stream_id); |
| 599 } | 616 } |
| 600 | 617 |
| 601 #endif // BUILDFLAG(ENABLE_WEBRTC) | 618 #endif // BUILDFLAG(ENABLE_WEBRTC) |
| 602 | 619 |
| 603 } // namespace content | 620 } // namespace content |
| OLD | NEW |