diff --git a/webrtc/modules/audio_device/linux/audio_device_alsa_linux.cc b/webrtc/modules/audio_device/linux/audio_device_alsa_linux.cc index caa1efed8f..15f441a07e 100644 --- a/webrtc/modules/audio_device/linux/audio_device_alsa_linux.cc +++ b/webrtc/modules/audio_device/linux/audio_device_alsa_linux.cc @@ -180,7 +180,7 @@ int32_t AudioDeviceLinuxALSA::Init() { return 0; } - +#if defined(USE_X11) //Get X display handle for typing detection _XDisplay = XOpenDisplay(NULL); if (!_XDisplay) @@ -188,7 +188,7 @@ int32_t AudioDeviceLinuxALSA::Init() WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, " failed to open X display, typing detection will not work"); } - +#endif _playWarning = 0; _playError = 0; _recWarning = 0; @@ -254,13 +254,13 @@ int32_t AudioDeviceLinuxALSA::Terminate() _critSect.Enter(); } - +#if defined(USE_X11) if (_XDisplay) { XCloseDisplay(_XDisplay); _XDisplay = NULL; } - +#endif _initialized = false; _outputDeviceIsSpecified = false; _inputDeviceIsSpecified = false; @@ -2342,7 +2342,7 @@ bool AudioDeviceLinuxALSA::RecThreadProcess() bool AudioDeviceLinuxALSA::KeyPressed() const{ - +#if defined(USE_X11) char szKey[32]; unsigned int i = 0; char state = 0; @@ -2360,5 +2360,8 @@ bool AudioDeviceLinuxALSA::KeyPressed() const{ // Save old state memcpy((char*)_oldKeyState, (char*)szKey, sizeof(_oldKeyState)); return (state != 0); +#else + return false; +#endif } } // namespace webrtc diff --git a/webrtc/modules/audio_device/linux/audio_device_alsa_linux.h b/webrtc/modules/audio_device/linux/audio_device_alsa_linux.h index 4591c293d2..e52d22bec1 100644 --- a/webrtc/modules/audio_device/linux/audio_device_alsa_linux.h +++ b/webrtc/modules/audio_device/linux/audio_device_alsa_linux.h @@ -15,8 +15,9 @@ #include "webrtc/modules/audio_device/linux/audio_mixer_manager_alsa_linux.h" #include "webrtc/system_wrappers/interface/critical_section_wrapper.h" - +#if defined(USE_X11) #include +#endif #include #include #include @@ -135,7 +136,7 @@ public: virtual int32_t StereoRecordingIsAvailable(bool& available) OVERRIDE; virtual int32_t SetStereoRecording(bool enable) OVERRIDE; virtual int32_t StereoRecording(bool& enabled) const OVERRIDE; - + // Delay information and control virtual int32_t SetPlayoutBuffer( const AudioDeviceModule::BufferType type, @@ -188,7 +189,7 @@ private: private: AudioDeviceBuffer* _ptrAudioBuffer; - + CriticalSectionWrapper& _critSect; ThreadWrapper* _ptrThreadRec; @@ -250,7 +251,9 @@ private: uint16_t _playBufDelayFixed; // fixed playback delay char _oldKeyState[32]; +#if defined(USE_X11) Display* _XDisplay; +#endif }; }