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

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

Issue 2396803004: Moved MixerAudioSource and removed audio_mixer_defines.h. (Closed)
Patch Set: Simplified CL to only contain the MixerAudioSource and RemixFrame change. 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_frame_manipulator.cc
diff --git a/webrtc/modules/audio_mixer/audio_frame_manipulator.cc b/webrtc/modules/audio_mixer/audio_frame_manipulator.cc
index 7ced9e29fa9e1c522c0c2de0cb3a1a9e990ec386..b8274d3f62d0443165492a5bd1afd7b0fda2b142 100644
--- a/webrtc/modules/audio_mixer/audio_frame_manipulator.cc
+++ b/webrtc/modules/audio_mixer/audio_frame_manipulator.cc
@@ -8,8 +8,10 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include "webrtc/base/checks.h"
#include "webrtc/modules/audio_mixer/audio_frame_manipulator.h"
#include "webrtc/modules/include/module_common_types.h"
+#include "webrtc/modules/utility/include/audio_frame_operations.h"
#include "webrtc/typedefs.h"
namespace webrtc {
@@ -59,4 +61,15 @@ void NewMixerRampOut(AudioFrame* audio_frame) {
(audio_frame->samples_per_channel_ - kRampSize) *
sizeof(audio_frame->data_[0]));
}
+
+void RemixFrame(AudioFrame* frame, size_t target_number_of_channels) {
hlundin-webrtc 2016/10/11 11:11:49 Put input parameters before input/output parameter
aleloi 2016/10/11 11:48:57 Thanks for noticing! I did the same mistake in the
+ RTC_DCHECK_GE(target_number_of_channels, static_cast<size_t>(1));
hlundin-webrtc 2016/10/11 11:11:49 Can't you write 1u and 2u instead of static_cast..
aleloi 2016/10/11 11:48:57 I've already changed this in the next dependent CL
hlundin-webrtc 2016/10/11 11:54:11 Acknowledged.
+ RTC_DCHECK_LE(target_number_of_channels, static_cast<size_t>(2));
+ if (frame->num_channels_ == 1 && target_number_of_channels == 2) {
+ AudioFrameOperations::MonoToStereo(frame);
+ } else if (frame->num_channels_ == 2 && target_number_of_channels == 1) {
+ AudioFrameOperations::StereoToMono(frame);
+ }
+}
+
} // namespace webrtc

Powered by Google App Engine
This is Rietveld 408576698