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

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

Issue 37793005: move the APM to chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/media/webrtc_audio_device_impl.cc
diff --git a/content/renderer/media/webrtc_audio_device_impl.cc b/content/renderer/media/webrtc_audio_device_impl.cc
index aadcda9b67232434a7177501215c4b78215d0416..b38423a9e0b365bbc1a6e64df81eaf162fa1a1a5 100644
--- a/content/renderer/media/webrtc_audio_device_impl.cc
+++ b/content/renderer/media/webrtc_audio_device_impl.cc
@@ -51,59 +51,23 @@ int32_t WebRtcAudioDeviceImpl::Release() {
}
return ret;
}
-int WebRtcAudioDeviceImpl::CaptureData(const std::vector<int>& channels,
- const int16* audio_data,
- int sample_rate,
- int number_of_channels,
- int number_of_frames,
- int audio_delay_milliseconds,
- int current_volume,
- bool need_audio_processing,
- bool key_pressed) {
- int total_delay_ms = 0;
+void WebRtcAudioDeviceImpl::CaptureData(const std::vector<int>& channels,
+ const int16* audio_data,
+ int sample_rate,
+ int number_of_channels,
+ int number_of_frames) {
{
base::AutoLock auto_lock(lock_);
// Return immediately when not recording or |channels| is empty.
// See crbug.com/274017: renderer crash dereferencing invalid channels[0].
if (!recording_ || channels.empty())
- return 0;
-
- // Store the reported audio delay locally.
- input_delay_ms_ = audio_delay_milliseconds;
- total_delay_ms = input_delay_ms_ + output_delay_ms_;
- DVLOG(2) << "total delay: " << input_delay_ms_ + output_delay_ms_;
- }
-
- // Write audio samples in blocks of 10 milliseconds to the registered
- // webrtc::AudioTransport sink. Keep writing until our internal byte
- // buffer is empty.
- const int16* audio_buffer = audio_data;
- const int samples_per_10_msec = (sample_rate / 100);
- int accumulated_audio_samples = 0;
- uint32_t new_volume = 0;
- while (accumulated_audio_samples < number_of_frames) {
- // Deliver 10ms of recorded 16-bit linear PCM audio.
- int new_mic_level = audio_transport_callback_->OnDataAvailable(
- &channels[0],
- channels.size(),
- audio_buffer,
- sample_rate,
- number_of_channels,
- samples_per_10_msec,
- total_delay_ms,
- current_volume,
- key_pressed,
- need_audio_processing);
-
- accumulated_audio_samples += samples_per_10_msec;
- audio_buffer += samples_per_10_msec * number_of_channels;
-
- // The latest non-zero new microphone level will be returned.
- if (new_mic_level)
- new_volume = new_mic_level;
+ return;
}
- return new_volume;
+ // Deliver 10ms of recorded 16-bit linear PCM audio.
+ audio_transport_callback_->OnDataAvailable(
+ &channels[0], channels.size(), audio_data, sample_rate,
+ number_of_channels, number_of_frames, 0, 0, false, false);
}
void WebRtcAudioDeviceImpl::SetCaptureFormat(

Powered by Google App Engine
This is Rietveld 408576698