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

Side by Side Diff: trunk/src/content/browser/renderer_host/media/audio_input_renderer_host.cc

Issue 132233058: Revert 247164 "Implement browser-side logging to WebRtc log" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/process/process.h" 10 #include "base/process/process.h"
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 void AudioInputRendererHost::DoSendRecordingMessage( 169 void AudioInputRendererHost::DoSendRecordingMessage(
170 media::AudioInputController* controller) { 170 media::AudioInputController* controller) {
171 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 171 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
172 // TODO(henrika): See crbug.com/115262 for details on why this method 172 // TODO(henrika): See crbug.com/115262 for details on why this method
173 // should be implemented. 173 // should be implemented.
174 } 174 }
175 175
176 void AudioInputRendererHost::DoHandleError( 176 void AudioInputRendererHost::DoHandleError(
177 media::AudioInputController* controller) { 177 media::AudioInputController* controller) {
178 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 178 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
179 MediaStreamManager::SendMessageToNativeLog(
180 "The AudioInputController signalled an error.");
181 179
182 AudioEntry* entry = LookupByController(controller); 180 AudioEntry* entry = LookupByController(controller);
183 if (!entry) 181 if (!entry)
184 return; 182 return;
185 183
186 audio_log_->OnError(entry->stream_id); 184 audio_log_->OnError(entry->stream_id);
187 DeleteEntryOnError(entry); 185 DeleteEntryOnError(entry);
188 } 186 }
189 187
190 bool AudioInputRendererHost::OnMessageReceived(const IPC::Message& message, 188 bool AudioInputRendererHost::OnMessageReceived(const IPC::Message& message,
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 // Set the initial AGC state for the audio input stream. Note that, the AGC 303 // Set the initial AGC state for the audio input stream. Note that, the AGC
306 // is only supported in AUDIO_PCM_LOW_LATENCY mode. 304 // is only supported in AUDIO_PCM_LOW_LATENCY mode.
307 if (config.params.format() == media::AudioParameters::AUDIO_PCM_LOW_LATENCY) 305 if (config.params.format() == media::AudioParameters::AUDIO_PCM_LOW_LATENCY)
308 entry->controller->SetAutomaticGainControl(config.automatic_gain_control); 306 entry->controller->SetAutomaticGainControl(config.automatic_gain_control);
309 307
310 // Since the controller was created successfully, create an entry and add it 308 // Since the controller was created successfully, create an entry and add it
311 // to the map. 309 // to the map.
312 entry->stream_id = stream_id; 310 entry->stream_id = stream_id;
313 audio_entries_.insert(std::make_pair(stream_id, entry.release())); 311 audio_entries_.insert(std::make_pair(stream_id, entry.release()));
314 312
315 MediaStreamManager::SendMessageToNativeLog(
316 "Audio input stream created successfully.");
317 audio_log_->OnCreated(stream_id, audio_params, device_id, std::string()); 313 audio_log_->OnCreated(stream_id, audio_params, device_id, std::string());
318 } 314 }
319 315
320 void AudioInputRendererHost::OnRecordStream(int stream_id) { 316 void AudioInputRendererHost::OnRecordStream(int stream_id) {
321 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 317 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
322 318
323 AudioEntry* entry = LookupById(stream_id); 319 AudioEntry* entry = LookupById(stream_id);
324 if (!entry) { 320 if (!entry) {
325 SendErrorMessage(stream_id); 321 SendErrorMessage(stream_id);
326 return; 322 return;
(...skipping 19 matching lines...) Expand all
346 if (!entry) { 342 if (!entry) {
347 SendErrorMessage(stream_id); 343 SendErrorMessage(stream_id);
348 return; 344 return;
349 } 345 }
350 346
351 entry->controller->SetVolume(volume); 347 entry->controller->SetVolume(volume);
352 audio_log_->OnSetVolume(stream_id, volume); 348 audio_log_->OnSetVolume(stream_id, volume);
353 } 349 }
354 350
355 void AudioInputRendererHost::SendErrorMessage(int stream_id) { 351 void AudioInputRendererHost::SendErrorMessage(int stream_id) {
356 MediaStreamManager::SendMessageToNativeLog(
357 "An error occurred in AudioInputRendererHost.");
358 Send(new AudioInputMsg_NotifyStreamStateChanged( 352 Send(new AudioInputMsg_NotifyStreamStateChanged(
359 stream_id, media::AudioInputIPCDelegate::kError)); 353 stream_id, media::AudioInputIPCDelegate::kError));
360 } 354 }
361 355
362 void AudioInputRendererHost::DeleteEntries() { 356 void AudioInputRendererHost::DeleteEntries() {
363 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 357 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
364 358
365 for (AudioEntryMap::iterator i = audio_entries_.begin(); 359 for (AudioEntryMap::iterator i = audio_entries_.begin();
366 i != audio_entries_.end(); ++i) { 360 i != audio_entries_.end(); ++i) {
367 CloseAndDeleteStream(i->second); 361 CloseAndDeleteStream(i->second);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 // TODO(hclam): Implement a faster look up method. 410 // TODO(hclam): Implement a faster look up method.
417 for (AudioEntryMap::iterator i = audio_entries_.begin(); 411 for (AudioEntryMap::iterator i = audio_entries_.begin();
418 i != audio_entries_.end(); ++i) { 412 i != audio_entries_.end(); ++i) {
419 if (controller == i->second->controller.get()) 413 if (controller == i->second->controller.get())
420 return i->second; 414 return i->second;
421 } 415 }
422 return NULL; 416 return NULL;
423 } 417 }
424 418
425 } // namespace content 419 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698