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

Unified Diff: webrtc/modules/audio_mixer/audio_mixer_impl.cc

Issue 2424173003: Move functionality out from AudioFrame and into AudioFrameOperations. (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_mixer/audio_mixer_impl.cc
diff --git a/webrtc/modules/audio_mixer/audio_mixer_impl.cc b/webrtc/modules/audio_mixer/audio_mixer_impl.cc
index 57fae8cc0d34e28d57fd71859d6340bf3140a486..650bd6e63cf6011f264301541bed74e8fc49a274 100644
--- a/webrtc/modules/audio_mixer/audio_mixer_impl.cc
+++ b/webrtc/modules/audio_mixer/audio_mixer_impl.cc
@@ -108,10 +108,10 @@ int32_t MixFromList(AudioFrame* mixed_audio,
if (use_limiter) {
// Divide by two to avoid saturation in the mixing.
// This is only meaningful if the limiter will be used.
- *frame >>= 1;
+ AudioFrameOperations::ShiftDown(frame);
}
RTC_DCHECK_EQ(frame->num_channels_, mixed_audio->num_channels_);
- *mixed_audio += *frame;
+ AudioFrameOperations::AddFrames(*frame, mixed_audio);
}
return 0;
}
@@ -205,9 +205,9 @@ void AudioMixerImpl::Mix(int sample_rate,
RemixFrame(number_of_channels, frame);
}
- audio_frame_for_mixing->UpdateFrame(
+ AudioFrameOperations::UpdateFrame(
-1, time_stamp_, NULL, 0, OutputFrequency(), AudioFrame::kNormalSpeech,
- AudioFrame::kVadPassive, number_of_channels);
+ AudioFrame::kVadPassive, number_of_channels, audio_frame_for_mixing);
time_stamp_ += static_cast<uint32_t>(sample_size_);
@@ -219,7 +219,7 @@ void AudioMixerImpl::Mix(int sample_rate,
if (audio_frame_for_mixing->samples_per_channel_ == 0) {
// Nothing was mixed, set the audio samples to silence.
audio_frame_for_mixing->samples_per_channel_ = sample_size_;
- audio_frame_for_mixing->Mute();
+ AudioFrameOperations::Mute(audio_frame_for_mixing);
} else {
// Only call the limiter if we have something to mix.
LimitMixedAudio(audio_frame_for_mixing);
@@ -330,7 +330,7 @@ bool AudioMixerImpl::LimitMixedAudio(AudioFrame* mixed_audio) const {
//
// Instead we double the frame (with addition since left-shifting a
// negative value is undefined).
- *mixed_audio += *mixed_audio;
+ AudioFrameOperations::AddFrames(*mixed_audio, mixed_audio);
if (error != limiter_->kNoError) {
LOG_F(LS_ERROR) << "Error from AudioProcessing: " << error;

Powered by Google App Engine
This is Rietveld 408576698