blob: 184e2a551104d1d4923d1d4e5e510421ee5c48b0 [file] [log] [blame]
andrew@webrtc.orgddbb8a22014-04-22 21:00:04 +00001/*
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_COMMON_H_
12#define WEBRTC_MODULES_AUDIO_PROCESSING_COMMON_H_
13
Henrik Kjellanderdca1e092017-07-01 16:42:22 +020014#include "webrtc/base/checks.h"
andrew@webrtc.orgddbb8a22014-04-22 21:00:04 +000015#include "webrtc/modules/audio_processing/include/audio_processing.h"
andrew@webrtc.orgddbb8a22014-04-22 21:00:04 +000016
17namespace webrtc {
18
Peter Kasting69558702016-01-12 16:26:35 -080019static inline size_t ChannelsFromLayout(AudioProcessing::ChannelLayout layout) {
andrew@webrtc.orgddbb8a22014-04-22 21:00:04 +000020 switch (layout) {
21 case AudioProcessing::kMono:
22 case AudioProcessing::kMonoAndKeyboard:
23 return 1;
24 case AudioProcessing::kStereo:
25 case AudioProcessing::kStereoAndKeyboard:
26 return 2;
27 }
kwiberg9e2be5f2016-09-14 05:23:22 -070028 RTC_NOTREACHED();
pkasting25702cb2016-01-08 13:50:27 -080029 return 0;
andrew@webrtc.orgddbb8a22014-04-22 21:00:04 +000030}
31
andrew@webrtc.orgddbb8a22014-04-22 21:00:04 +000032} // namespace webrtc
33
34#endif // WEBRTC_MODULES_AUDIO_PROCESSING_COMMON_H_