Fix global_constructors, exit_time_destructors in audio device pulse.
Bug: webrtc:9693 Change-Id: I05498473be8a86756d65d0b9000d626c966d4ed3 Reviewed-on: https://webrtc-review.googlesource.com/100422 Reviewed-by: Henrik Andreassson <henrika@webrtc.org> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Cr-Commit-Position: refs/heads/master@{#24865}
This commit is contained in:
committed by
Commit Bot
parent
98b07e9180
commit
e0c01b9802
@ -321,10 +321,6 @@ rtc_source_set("audio_device_impl") {
|
||||
defines += [ "WEBRTC_USE_X11" ]
|
||||
}
|
||||
if (rtc_include_pulse_audio) {
|
||||
configs += [
|
||||
"../..:no_exit_time_destructors",
|
||||
"../..:no_global_constructors",
|
||||
]
|
||||
sources += [
|
||||
"linux/audio_device_pulse_linux.cc",
|
||||
"linux/audio_device_pulse_linux.h",
|
||||
|
||||
@ -22,6 +22,13 @@ WebRTCAlsaSymbolTable* GetAlsaSymbolTable() {
|
||||
return alsa_symbol_table;
|
||||
}
|
||||
|
||||
// Accesses ALSA functions through our late-binding symbol table instead of
|
||||
// directly. This way we don't have to link to libasound, which means our binary
|
||||
// will work on systems that don't have it.
|
||||
#define LATE(sym) \
|
||||
LATESYM_GET(webrtc::adm_linux_alsa::AlsaSymbolTable, GetAlsaSymbolTable(), \
|
||||
sym)
|
||||
|
||||
// Redefine these here to be able to do late-binding
|
||||
#undef snd_ctl_card_info_alloca
|
||||
#define snd_ctl_card_info_alloca(ptr) \
|
||||
|
||||
@ -28,13 +28,6 @@
|
||||
typedef webrtc::adm_linux_alsa::AlsaSymbolTable WebRTCAlsaSymbolTable;
|
||||
WebRTCAlsaSymbolTable* GetAlsaSymbolTable();
|
||||
|
||||
// Accesses ALSA functions through our late-binding symbol table instead of
|
||||
// directly. This way we don't have to link to libasound, which means our binary
|
||||
// will work on systems that don't have it.
|
||||
#define LATE(sym) \
|
||||
LATESYM_GET(webrtc::adm_linux_alsa::AlsaSymbolTable, GetAlsaSymbolTable(), \
|
||||
sym)
|
||||
|
||||
namespace webrtc {
|
||||
class EventWrapper;
|
||||
|
||||
|
||||
@ -16,14 +16,18 @@
|
||||
#include "rtc_base/logging.h"
|
||||
#include "system_wrappers/include/event_wrapper.h"
|
||||
|
||||
webrtc::adm_linux_pulse::PulseAudioSymbolTable PaSymbolTable;
|
||||
WebRTCPulseSymbolTable* GetPulseSymbolTable() {
|
||||
static WebRTCPulseSymbolTable* pulse_symbol_table =
|
||||
new WebRTCPulseSymbolTable();
|
||||
return pulse_symbol_table;
|
||||
}
|
||||
|
||||
// Accesses Pulse functions through our late-binding symbol table instead of
|
||||
// directly. This way we don't have to link to libpulse, which means our binary
|
||||
// will work on systems that don't have it.
|
||||
#define LATE(sym) \
|
||||
LATESYM_GET(webrtc::adm_linux_pulse::PulseAudioSymbolTable, &PaSymbolTable, \
|
||||
sym)
|
||||
#define LATE(sym) \
|
||||
LATESYM_GET(webrtc::adm_linux_pulse::PulseAudioSymbolTable, \
|
||||
GetPulseSymbolTable(), sym)
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
@ -1547,7 +1551,7 @@ int32_t AudioDeviceLinuxPulse::InitPulseAudio() {
|
||||
int retVal = 0;
|
||||
|
||||
// Load libpulse
|
||||
if (!PaSymbolTable.Load()) {
|
||||
if (!GetPulseSymbolTable()->Load()) {
|
||||
// Most likely the Pulse library and sound server are not installed on
|
||||
// this system
|
||||
RTC_LOG(LS_ERROR) << "failed to load symbol table";
|
||||
@ -1658,7 +1662,7 @@ int32_t AudioDeviceLinuxPulse::InitPulseAudio() {
|
||||
|
||||
int32_t AudioDeviceLinuxPulse::TerminatePulseAudio() {
|
||||
// Do nothing if the instance doesn't exist
|
||||
// likely PaSymbolTable.Load() fails
|
||||
// likely GetPulseSymbolTable.Load() fails
|
||||
if (!_paMainloop) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -92,6 +92,9 @@ const int32_t WEBRTC_PA_NO_LATENCY_REQUIREMENTS = -1;
|
||||
// calculation
|
||||
const uint32_t WEBRTC_PA_CAPTURE_BUFFER_LATENCY_ADJUSTMENT = 0;
|
||||
|
||||
typedef webrtc::adm_linux_pulse::PulseAudioSymbolTable WebRTCPulseSymbolTable;
|
||||
WebRTCPulseSymbolTable* GetPulseSymbolTable();
|
||||
|
||||
namespace webrtc {
|
||||
class EventWrapper;
|
||||
|
||||
|
||||
@ -14,6 +14,13 @@
|
||||
#include "modules/audio_device/linux/audio_mixer_manager_alsa_linux.h"
|
||||
#include "rtc_base/logging.h"
|
||||
|
||||
// Accesses ALSA functions through our late-binding symbol table instead of
|
||||
// directly. This way we don't have to link to libasound, which means our binary
|
||||
// will work on systems that don't have it.
|
||||
#define LATE(sym) \
|
||||
LATESYM_GET(webrtc::adm_linux_alsa::AlsaSymbolTable, GetAlsaSymbolTable(), \
|
||||
sym)
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
AudioMixerManagerLinuxALSA::AudioMixerManagerLinuxALSA()
|
||||
|
||||
@ -10,18 +10,17 @@
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "modules/audio_device/linux/audio_device_pulse_linux.h"
|
||||
#include "modules/audio_device/linux/audio_mixer_manager_pulse_linux.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/logging.h"
|
||||
|
||||
extern webrtc::adm_linux_pulse::PulseAudioSymbolTable PaSymbolTable;
|
||||
|
||||
// Accesses Pulse functions through our late-binding symbol table instead of
|
||||
// directly. This way we don't have to link to libpulse, which means our
|
||||
// binary will work on systems that don't have it.
|
||||
#define LATE(sym) \
|
||||
LATESYM_GET(webrtc::adm_linux_pulse::PulseAudioSymbolTable, &PaSymbolTable, \
|
||||
sym)
|
||||
// directly. This way we don't have to link to libpulse, which means our binary
|
||||
// will work on systems that don't have it.
|
||||
#define LATE(sym) \
|
||||
LATESYM_GET(webrtc::adm_linux_pulse::PulseAudioSymbolTable, \
|
||||
GetPulseSymbolTable(), sym)
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user