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

Unified Diff: webrtc/audio/utility/audio_frame_operations.h

Issue 2712743004: Support 4 channel mic in Windows Core Audio (Closed)
Patch Set: Fix formatting Created 3 years, 10 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/audio/utility/audio_frame_operations.h
diff --git a/webrtc/audio/utility/audio_frame_operations.h b/webrtc/audio/utility/audio_frame_operations.h
index d16b163e7d1139f10ba00e87e73524648e01bebd..1d8b9a11dd2b74d2822156f83b78efae3854c956 100644
--- a/webrtc/audio/utility/audio_frame_operations.h
+++ b/webrtc/audio/utility/audio_frame_operations.h
@@ -54,6 +54,41 @@ class AudioFrameOperations {
// |num_channels_| is stereo.
static int StereoToMono(AudioFrame* frame);
+ // Downmixes 4 channels |src_audio| to stereo |dst_audio|. This is an in-place
+ // operation, meaning |src_audio| and |dst_audio| may point to the same
+ // buffer.
+ static void QuadToStereo(const int16_t* src_audio,
+ size_t samples_per_channel,
+ int16_t* dst_audio);
aleloi 2017/02/24 10:39:31 Add blank line
jens.nielsen 2017/02/24 14:55:49 Done.
+ // |frame.num_channels_| will be updated. This version checks that
+ // |num_channels_| is 4 channels.
+ static int QuadToStereo(AudioFrame* frame);
+
+ // Downmixes 4 channels |src_audio| to mono |dst_audio|. This is an in-place
+ // operation, meaning |src_audio| and |dst_audio| may point to the same
+ // buffer.
+ static void QuadToMono(const int16_t* src_audio,
+ size_t samples_per_channel,
+ int16_t* dst_audio);
aleloi 2017/02/24 10:39:31 Add blank line
jens.nielsen 2017/02/24 14:55:48 Done.
+ // |frame.num_channels_| will be updated. This version checks that
+ // |num_channels_| is stereo.
aleloi 2017/02/24 10:39:31 Shouldn't |num_channels_| be 4 here and not stereo
jens.nielsen 2017/02/24 14:55:48 Done. (Silly copy-paste error, sorry about that)
+ static int QuadToMono(AudioFrame* frame);
+
+ // Downmixes |src_channels| |src_audio| to |dst_channels| |dst_audio|.
+ // This is an in-place operation, meaning |src_audio| and |dst_audio|
+ // may point to the same buffer.
hlundin-webrtc 2017/02/24 09:46:36 Comment on which combinations of src_channels and
jens.nielsen 2017/02/24 14:55:49 Done.
+ static void AudioFrameOperations::DownmixChannels(const int16_t* src_audio,
+ size_t src_channels,
+ size_t samples_per_channel,
+ int16_t* dst_audio,
+ size_t dst_channels);
aleloi 2017/02/24 10:39:31 Please move the dst_audio to the end. Quote from
jens.nielsen 2017/02/24 14:55:49 Done.
+
+ // |frame.num_channels_| will be updated. This version checks that
+ // |num_channels_| and |dst_channels| are valid and performs relevant
+ // downmix.
hlundin-webrtc 2017/02/24 09:46:36 Comment on which combinations of src_channels and
jens.nielsen 2017/02/24 14:55:49 Done.
+ static int AudioFrameOperations::DownmixChannels(AudioFrame* frame,
+ size_t dst_channels);
aleloi 2017/02/24 10:39:31 Please swap function parameters here as well. |dst
jens.nielsen 2017/02/24 14:55:49 Done.
+
// Swap the left and right channels of |frame|. Fails silently if |frame| is
// not stereo.
static void SwapStereoChannels(AudioFrame* frame);

Powered by Google App Engine
This is Rietveld 408576698