Don't depend on X11 when rtc_use_x11=false.
This CL makes X11 optional for audio_device_pulse_linux. Apply the same guards than for audio_device_alsa_linux. Cf commit 75f18fca8eef7c27073923c46ff73be5ba0e0491. Bug: webrtc:9569 Change-Id: Iaddbfb62112c504531376bad0db8f04caa4350c7 Reviewed-on: https://webrtc-review.googlesource.com/93030 Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Patrik Höglund <phoglund@webrtc.org> Commit-Queue: Yves Gerey <yvesg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#24274}
This commit is contained in:
@ -155,12 +155,14 @@ AudioDeviceGeneric::InitStatus AudioDeviceLinuxPulse::Init() {
|
|||||||
return InitStatus::OTHER_ERROR;
|
return InitStatus::OTHER_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(WEBRTC_USE_X11)
|
||||||
// Get X display handle for typing detection
|
// Get X display handle for typing detection
|
||||||
_XDisplay = XOpenDisplay(NULL);
|
_XDisplay = XOpenDisplay(NULL);
|
||||||
if (!_XDisplay) {
|
if (!_XDisplay) {
|
||||||
RTC_LOG(LS_WARNING)
|
RTC_LOG(LS_WARNING)
|
||||||
<< "failed to open X display, typing detection will not work";
|
<< "failed to open X display, typing detection will not work";
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// RECORDING
|
// RECORDING
|
||||||
_ptrThreadRec.reset(new rtc::PlatformThread(
|
_ptrThreadRec.reset(new rtc::PlatformThread(
|
||||||
@ -212,10 +214,12 @@ int32_t AudioDeviceLinuxPulse::Terminate() {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(WEBRTC_USE_X11)
|
||||||
if (_XDisplay) {
|
if (_XDisplay) {
|
||||||
XCloseDisplay(_XDisplay);
|
XCloseDisplay(_XDisplay);
|
||||||
_XDisplay = NULL;
|
_XDisplay = NULL;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
_initialized = false;
|
_initialized = false;
|
||||||
_outputDeviceIsSpecified = false;
|
_outputDeviceIsSpecified = false;
|
||||||
@ -2280,6 +2284,7 @@ bool AudioDeviceLinuxPulse::RecThreadProcess() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool AudioDeviceLinuxPulse::KeyPressed() const {
|
bool AudioDeviceLinuxPulse::KeyPressed() const {
|
||||||
|
#if defined(WEBRTC_USE_X11)
|
||||||
char szKey[32];
|
char szKey[32];
|
||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
char state = 0;
|
char state = 0;
|
||||||
@ -2297,5 +2302,8 @@ bool AudioDeviceLinuxPulse::KeyPressed() const {
|
|||||||
// Save old state
|
// Save old state
|
||||||
memcpy((char*)_oldKeyState, (char*)szKey, sizeof(_oldKeyState));
|
memcpy((char*)_oldKeyState, (char*)szKey, sizeof(_oldKeyState));
|
||||||
return (state != 0);
|
return (state != 0);
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
@ -19,7 +19,10 @@
|
|||||||
#include "rtc_base/platform_thread.h"
|
#include "rtc_base/platform_thread.h"
|
||||||
#include "rtc_base/thread_checker.h"
|
#include "rtc_base/thread_checker.h"
|
||||||
|
|
||||||
|
#if defined(WEBRTC_USE_X11)
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <pulse/pulseaudio.h>
|
#include <pulse/pulseaudio.h>
|
||||||
|
|
||||||
// We define this flag if it's missing from our headers, because we want to be
|
// We define this flag if it's missing from our headers, because we want to be
|
||||||
@ -328,7 +331,9 @@ class AudioDeviceLinuxPulse : public AudioDeviceGeneric {
|
|||||||
pa_buffer_attr _recBufferAttr;
|
pa_buffer_attr _recBufferAttr;
|
||||||
|
|
||||||
char _oldKeyState[32];
|
char _oldKeyState[32];
|
||||||
|
#if defined(WEBRTC_USE_X11)
|
||||||
Display* _XDisplay;
|
Display* _XDisplay;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
Reference in New Issue
Block a user