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

Unified Diff: content/renderer/media/webrtc_audio_capturer.cc

Issue 225143006: Limit the max volume to 255 before pass it to APM. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fixed the comment Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/media/media_stream_audio_processor.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/webrtc_audio_capturer.cc
diff --git a/content/renderer/media/webrtc_audio_capturer.cc b/content/renderer/media/webrtc_audio_capturer.cc
index 482d25f1114b2479baabcda0d4fb930c4e5ba944..67882a17d8ea6fe6493767ab62be1a389c4c3e98 100644
--- a/content/renderer/media/webrtc_audio_capturer.cc
+++ b/content/renderer/media/webrtc_audio_capturer.cc
@@ -460,11 +460,11 @@ void WebRtcAudioCapturer::Capture(media::AudioBus* audio_source,
if (!running_)
return;
- // Map internal volume range of [0.0, 1.0] into [0, 255] used by the
- // webrtc::VoiceEngine. webrtc::VoiceEngine will handle the case when the
- // volume is higher than 255.
+ // Map internal volume range of [0.0, 1.0] into [0, 255] used by AGC.
+ // The volume can be higher than 255 on Linux, and it will be cropped to
+ // 255 since AGC does not allow values out of range.
volume_ = static_cast<int>((volume * MaxVolume()) + 0.5);
- current_volume = volume_;
+ current_volume = volume_ > MaxVolume() ? MaxVolume() : volume_;
audio_delay = base::TimeDelta::FromMilliseconds(audio_delay_milliseconds);
audio_delay_ = audio_delay;
key_pressed_ = key_pressed;
« no previous file with comments | « content/renderer/media/media_stream_audio_processor.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698