blob: 56721a1faffa51155194266f6aa6dfe3073db56a [file] [log] [blame]
henrike@webrtc.org66a35822014-08-26 22:04:04 +00001/*
2 * Copyright 2004 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_SOUND_LINUXSOUNDSYSTEM_H_
12#define WEBRTC_SOUND_LINUXSOUNDSYSTEM_H_
13
tfarina5237aaf2015-11-10 23:44:30 -080014#include "webrtc/base/arraysize.h"
henrike@webrtc.org66a35822014-08-26 22:04:04 +000015#include "webrtc/sound/automaticallychosensoundsystem.h"
16
17namespace rtc {
18
19extern const SoundSystemCreator kLinuxSoundSystemCreators[
20#ifdef HAVE_LIBPULSE
21 2
22#else
23 1
24#endif
25 ];
26
27// The vast majority of Linux systems use ALSA for the device-level sound API,
28// but an increasing number are using PulseAudio for the application API and
29// only using ALSA internally in PulseAudio itself. But like everything on
30// Linux this is user-configurable, so we need to support both and choose the
31// right one at run-time.
32// PulseAudioSoundSystem is designed to only successfully initialize if
33// PulseAudio is installed and running, and if it is running then direct device
34// access using ALSA typically won't work, so if PulseAudioSoundSystem
35// initializes then we choose that. Otherwise we choose ALSA.
36typedef AutomaticallyChosenSoundSystem<
37 kLinuxSoundSystemCreators,
tfarina5237aaf2015-11-10 23:44:30 -080038 arraysize(kLinuxSoundSystemCreators)> LinuxSoundSystem;
henrike@webrtc.org66a35822014-08-26 22:04:04 +000039
40} // namespace rtc
41
42#endif // WEBRTC_SOUND_LINUXSOUNDSYSTEM_H_