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

Side by Side Diff: content/renderer/media/webrtc/processed_local_audio_source.cc

Issue 2416123002: Stop media stream source when audio capture error occurs. (Closed)
Patch Set: Rebase. Created 4 years, 2 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
« no previous file with comments | « content/renderer/media/speech_recognition_audio_sink_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/renderer/media/webrtc/processed_local_audio_source.h" 5 #include "content/renderer/media/webrtc/processed_local_audio_source.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/metrics/histogram_macros.h" 8 #include "base/metrics/histogram_macros.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "content/renderer/media/audio_device_factory.h" 10 #include "content/renderer/media/audio_device_factory.h"
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 SetVolume(new_volume); 332 SetVolume(new_volume);
333 333
334 // Update the |current_volume| to avoid passing the old volume to AGC. 334 // Update the |current_volume| to avoid passing the old volume to AGC.
335 current_volume = new_volume; 335 current_volume = new_volume;
336 } 336 }
337 } 337 }
338 } 338 }
339 339
340 void ProcessedLocalAudioSource::OnCaptureError(const std::string& message) { 340 void ProcessedLocalAudioSource::OnCaptureError(const std::string& message) {
341 WebRtcLogMessage("ProcessedLocalAudioSource::OnCaptureError: " + message); 341 WebRtcLogMessage("ProcessedLocalAudioSource::OnCaptureError: " + message);
342 StopSourceOnError(message);
342 } 343 }
343 344
344 media::AudioParameters ProcessedLocalAudioSource::GetInputFormat() const { 345 media::AudioParameters ProcessedLocalAudioSource::GetInputFormat() const {
345 return audio_processor_ ? audio_processor_->InputFormat() 346 return audio_processor_ ? audio_processor_->InputFormat()
346 : media::AudioParameters(); 347 : media::AudioParameters();
347 } 348 }
348 349
349 int ProcessedLocalAudioSource::GetBufferSize(int sample_rate) const { 350 int ProcessedLocalAudioSource::GetBufferSize(int sample_rate) const {
350 DCHECK(thread_checker_.CalledOnValidThread()); 351 DCHECK(thread_checker_.CalledOnValidThread());
351 #if defined(OS_ANDROID) 352 #if defined(OS_ANDROID)
(...skipping 14 matching lines...) Expand all
366 367
367 // If the buffer size is missing from the StreamDeviceInfo, provide 10ms as a 368 // If the buffer size is missing from the StreamDeviceInfo, provide 10ms as a
368 // fall-back. 369 // fall-back.
369 // 370 //
370 // TODO(miu): Identify where/why the buffer size might be missing, fix the 371 // TODO(miu): Identify where/why the buffer size might be missing, fix the
371 // code, and then require it here. http://crbug.com/638081 372 // code, and then require it here. http://crbug.com/638081
372 return (sample_rate / 100); 373 return (sample_rate / 100);
373 } 374 }
374 375
375 } // namespace content 376 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/speech_recognition_audio_sink_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698