ifdef the alsa code based on macro USE_X11

BUG=none
TEST=try bots
R=andrew@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/8949004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@5583 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
fbarchard@google.com 2014-02-20 03:05:05 +00:00
parent 056176b962
commit 66061992fb
2 changed files with 14 additions and 8 deletions

View File

@ -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

View File

@ -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 <X11/Xlib.h>
#endif
#include <alsa/asoundlib.h>
#include <sys/ioctl.h>
#include <sys/soundcard.h>
@ -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
};
}