| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/shared_memory.h" | 8 #include "base/memory/shared_memory.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/numerics/safe_math.h" | 10 #include "base/numerics/safe_math.h" |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 } | 198 } |
| 199 | 199 |
| 200 AudioEntry* entry = LookupByController(controller); | 200 AudioEntry* entry = LookupByController(controller); |
| 201 if (!entry) | 201 if (!entry) |
| 202 return; | 202 return; |
| 203 | 203 |
| 204 audio_log_->OnError(entry->stream_id); | 204 audio_log_->OnError(entry->stream_id); |
| 205 DeleteEntryOnError(entry, AUDIO_INPUT_CONTROLLER_ERROR); | 205 DeleteEntryOnError(entry, AUDIO_INPUT_CONTROLLER_ERROR); |
| 206 } | 206 } |
| 207 | 207 |
| 208 bool AudioInputRendererHost::OnMessageReceived(const IPC::Message& message, | 208 bool AudioInputRendererHost::OnMessageReceived(const IPC::Message& message) { |
| 209 bool* message_was_ok) { | |
| 210 bool handled = true; | 209 bool handled = true; |
| 211 IPC_BEGIN_MESSAGE_MAP_EX(AudioInputRendererHost, message, *message_was_ok) | 210 IPC_BEGIN_MESSAGE_MAP(AudioInputRendererHost, message) |
| 212 IPC_MESSAGE_HANDLER(AudioInputHostMsg_CreateStream, OnCreateStream) | 211 IPC_MESSAGE_HANDLER(AudioInputHostMsg_CreateStream, OnCreateStream) |
| 213 IPC_MESSAGE_HANDLER(AudioInputHostMsg_RecordStream, OnRecordStream) | 212 IPC_MESSAGE_HANDLER(AudioInputHostMsg_RecordStream, OnRecordStream) |
| 214 IPC_MESSAGE_HANDLER(AudioInputHostMsg_CloseStream, OnCloseStream) | 213 IPC_MESSAGE_HANDLER(AudioInputHostMsg_CloseStream, OnCloseStream) |
| 215 IPC_MESSAGE_HANDLER(AudioInputHostMsg_SetVolume, OnSetVolume) | 214 IPC_MESSAGE_HANDLER(AudioInputHostMsg_SetVolume, OnSetVolume) |
| 216 IPC_MESSAGE_UNHANDLED(handled = false) | 215 IPC_MESSAGE_UNHANDLED(handled = false) |
| 217 IPC_END_MESSAGE_MAP_EX() | 216 IPC_END_MESSAGE_MAP() |
| 218 | 217 |
| 219 return handled; | 218 return handled; |
| 220 } | 219 } |
| 221 | 220 |
| 222 void AudioInputRendererHost::OnCreateStream( | 221 void AudioInputRendererHost::OnCreateStream( |
| 223 int stream_id, | 222 int stream_id, |
| 224 int render_view_id, | 223 int render_view_id, |
| 225 int session_id, | 224 int session_id, |
| 226 const AudioInputHostMsg_CreateStream_Config& config) { | 225 const AudioInputHostMsg_CreateStream_Config& config) { |
| 227 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 226 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 // TODO(hclam): Implement a faster look up method. | 439 // TODO(hclam): Implement a faster look up method. |
| 441 for (AudioEntryMap::iterator i = audio_entries_.begin(); | 440 for (AudioEntryMap::iterator i = audio_entries_.begin(); |
| 442 i != audio_entries_.end(); ++i) { | 441 i != audio_entries_.end(); ++i) { |
| 443 if (controller == i->second->controller.get()) | 442 if (controller == i->second->controller.get()) |
| 444 return i->second; | 443 return i->second; |
| 445 } | 444 } |
| 446 return NULL; | 445 return NULL; |
| 447 } | 446 } |
| 448 | 447 |
| 449 } // namespace content | 448 } // namespace content |
| OLD | NEW |