Remove AudioDeviceObserver and make ADM not inherit from the Module interface.
(Re-upload of https://codereview.webrtc.org/3020493002/) Bug: webrtc:4690, webrtc:7306 Change-Id: I67fb9ebca1296aabc08eae8a292a5c69832dc35e Reviewed-on: https://webrtc-review.googlesource.com/5360 Commit-Queue: Fredrik Solenberg <solenberg@webrtc.org> Reviewed-by: Henrik Andreassson <henrika@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20083}
This commit is contained in:
committed by
Commit Bot
parent
c007857ab9
commit
34cdd2d402
@ -89,11 +89,7 @@ AudioDeviceLinuxALSA::AudioDeviceLinuxALSA() :
|
||||
_playIsInitialized(false),
|
||||
_AGC(false),
|
||||
_recordingDelay(0),
|
||||
_playoutDelay(0),
|
||||
_playWarning(0),
|
||||
_playError(0),
|
||||
_recWarning(0),
|
||||
_recError(0)
|
||||
_playoutDelay(0)
|
||||
{
|
||||
memset(_oldKeyState, 0, sizeof(_oldKeyState));
|
||||
LOG(LS_INFO) << __FUNCTION__ << " created";
|
||||
@ -166,10 +162,6 @@ AudioDeviceGeneric::InitStatus AudioDeviceLinuxALSA::Init() {
|
||||
<< "failed to open X display, typing detection will not work";
|
||||
}
|
||||
#endif
|
||||
_playWarning = 0;
|
||||
_playError = 0;
|
||||
_recWarning = 0;
|
||||
_recError = 0;
|
||||
|
||||
_initialized = true;
|
||||
|
||||
@ -1014,8 +1006,6 @@ int32_t AudioDeviceLinuxALSA::InitPlayout()
|
||||
_handlePlayout, _playoutFramesIn10MS);
|
||||
|
||||
// Init varaibles used for play
|
||||
_playWarning = 0;
|
||||
_playError = 0;
|
||||
|
||||
if (_handlePlayout != NULL)
|
||||
{
|
||||
@ -1447,54 +1437,6 @@ bool AudioDeviceLinuxALSA::Playing() const
|
||||
return (_playing);
|
||||
}
|
||||
|
||||
bool AudioDeviceLinuxALSA::PlayoutWarning() const
|
||||
{
|
||||
rtc::CritScope lock(&_critSect);
|
||||
return (_playWarning > 0);
|
||||
}
|
||||
|
||||
bool AudioDeviceLinuxALSA::PlayoutError() const
|
||||
{
|
||||
rtc::CritScope lock(&_critSect);
|
||||
return (_playError > 0);
|
||||
}
|
||||
|
||||
bool AudioDeviceLinuxALSA::RecordingWarning() const
|
||||
{
|
||||
rtc::CritScope lock(&_critSect);
|
||||
return (_recWarning > 0);
|
||||
}
|
||||
|
||||
bool AudioDeviceLinuxALSA::RecordingError() const
|
||||
{
|
||||
rtc::CritScope lock(&_critSect);
|
||||
return (_recError > 0);
|
||||
}
|
||||
|
||||
void AudioDeviceLinuxALSA::ClearPlayoutWarning()
|
||||
{
|
||||
rtc::CritScope lock(&_critSect);
|
||||
_playWarning = 0;
|
||||
}
|
||||
|
||||
void AudioDeviceLinuxALSA::ClearPlayoutError()
|
||||
{
|
||||
rtc::CritScope lock(&_critSect);
|
||||
_playError = 0;
|
||||
}
|
||||
|
||||
void AudioDeviceLinuxALSA::ClearRecordingWarning()
|
||||
{
|
||||
rtc::CritScope lock(&_critSect);
|
||||
_recWarning = 0;
|
||||
}
|
||||
|
||||
void AudioDeviceLinuxALSA::ClearRecordingError()
|
||||
{
|
||||
rtc::CritScope lock(&_critSect);
|
||||
_recError = 0;
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Private Methods
|
||||
// ============================================================================
|
||||
|
||||
@ -125,15 +125,6 @@ public:
|
||||
int32_t PlayoutDelay(uint16_t& delayMS) const override;
|
||||
int32_t RecordingDelay(uint16_t& delayMS) const override;
|
||||
|
||||
bool PlayoutWarning() const override;
|
||||
bool PlayoutError() const override;
|
||||
bool RecordingWarning() const override;
|
||||
bool RecordingError() const override;
|
||||
void ClearPlayoutWarning() override;
|
||||
void ClearPlayoutError() override;
|
||||
void ClearRecordingWarning() override;
|
||||
void ClearRecordingError() override;
|
||||
|
||||
void AttachAudioBuffer(AudioDeviceBuffer* audioBuffer) override;
|
||||
|
||||
private:
|
||||
@ -206,11 +197,6 @@ private:
|
||||
snd_pcm_sframes_t _recordingDelay;
|
||||
snd_pcm_sframes_t _playoutDelay;
|
||||
|
||||
uint16_t _playWarning;
|
||||
uint16_t _playError;
|
||||
uint16_t _recWarning;
|
||||
uint16_t _recError;
|
||||
|
||||
char _oldKeyState[32];
|
||||
#if defined(USE_X11)
|
||||
Display* _XDisplay;
|
||||
|
||||
@ -54,10 +54,6 @@ AudioDeviceLinuxPulse::AudioDeviceLinuxPulse()
|
||||
_sndCardPlayDelay(0),
|
||||
_sndCardRecDelay(0),
|
||||
_writeErrors(0),
|
||||
_playWarning(0),
|
||||
_playError(0),
|
||||
_recWarning(0),
|
||||
_recError(0),
|
||||
_deviceIndex(-1),
|
||||
_numPlayDevices(0),
|
||||
_numRecDevices(0),
|
||||
@ -160,11 +156,6 @@ AudioDeviceGeneric::InitStatus AudioDeviceLinuxPulse::Init() {
|
||||
return InitStatus::OTHER_ERROR;
|
||||
}
|
||||
|
||||
_playWarning = 0;
|
||||
_playError = 0;
|
||||
_recWarning = 0;
|
||||
_recError = 0;
|
||||
|
||||
// Get X display handle for typing detection
|
||||
_XDisplay = XOpenDisplay(NULL);
|
||||
if (!_XDisplay) {
|
||||
@ -1292,46 +1283,6 @@ bool AudioDeviceLinuxPulse::Playing() const {
|
||||
return (_playing);
|
||||
}
|
||||
|
||||
bool AudioDeviceLinuxPulse::PlayoutWarning() const {
|
||||
rtc::CritScope lock(&_critSect);
|
||||
return (_playWarning > 0);
|
||||
}
|
||||
|
||||
bool AudioDeviceLinuxPulse::PlayoutError() const {
|
||||
rtc::CritScope lock(&_critSect);
|
||||
return (_playError > 0);
|
||||
}
|
||||
|
||||
bool AudioDeviceLinuxPulse::RecordingWarning() const {
|
||||
rtc::CritScope lock(&_critSect);
|
||||
return (_recWarning > 0);
|
||||
}
|
||||
|
||||
bool AudioDeviceLinuxPulse::RecordingError() const {
|
||||
rtc::CritScope lock(&_critSect);
|
||||
return (_recError > 0);
|
||||
}
|
||||
|
||||
void AudioDeviceLinuxPulse::ClearPlayoutWarning() {
|
||||
rtc::CritScope lock(&_critSect);
|
||||
_playWarning = 0;
|
||||
}
|
||||
|
||||
void AudioDeviceLinuxPulse::ClearPlayoutError() {
|
||||
rtc::CritScope lock(&_critSect);
|
||||
_playError = 0;
|
||||
}
|
||||
|
||||
void AudioDeviceLinuxPulse::ClearRecordingWarning() {
|
||||
rtc::CritScope lock(&_critSect);
|
||||
_recWarning = 0;
|
||||
}
|
||||
|
||||
void AudioDeviceLinuxPulse::ClearRecordingError() {
|
||||
rtc::CritScope lock(&_critSect);
|
||||
_recError = 0;
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Private Methods
|
||||
// ============================================================================
|
||||
@ -2191,12 +2142,7 @@ bool AudioDeviceLinuxPulse::PlayThreadProcess() {
|
||||
NULL, (int64_t)0, PA_SEEK_RELATIVE) != PA_OK) {
|
||||
_writeErrors++;
|
||||
if (_writeErrors > 10) {
|
||||
if (_playError == 1) {
|
||||
LOG(LS_WARNING) << "pending playout error exists";
|
||||
}
|
||||
// Triggers callback from module process thread.
|
||||
_playError = 1;
|
||||
LOG(LS_ERROR) << "kPlayoutError message posted: _writeErrors="
|
||||
LOG(LS_ERROR) << "Playout error: _writeErrors="
|
||||
<< _writeErrors
|
||||
<< ", error=" << LATE(pa_context_errno)(_paContext);
|
||||
_writeErrors = 0;
|
||||
@ -2240,12 +2186,7 @@ bool AudioDeviceLinuxPulse::PlayThreadProcess() {
|
||||
NULL, (int64_t)0, PA_SEEK_RELATIVE) != PA_OK) {
|
||||
_writeErrors++;
|
||||
if (_writeErrors > 10) {
|
||||
if (_playError == 1) {
|
||||
LOG(LS_WARNING) << "pending playout error exists";
|
||||
}
|
||||
// Triggers callback from module process thread.
|
||||
_playError = 1;
|
||||
LOG(LS_ERROR) << "kPlayoutError message posted: _writeErrors="
|
||||
LOG(LS_ERROR) << "Playout error: _writeErrors="
|
||||
<< _writeErrors
|
||||
<< ", error=" << LATE(pa_context_errno)(_paContext);
|
||||
_writeErrors = 0;
|
||||
@ -2358,8 +2299,7 @@ bool AudioDeviceLinuxPulse::RecThreadProcess() {
|
||||
size_t sampleDataSize;
|
||||
|
||||
if (LATE(pa_stream_peek)(_recStream, &sampleData, &sampleDataSize) != 0) {
|
||||
_recError = 1; // triggers callback from module process thread
|
||||
LOG(LS_ERROR) << "RECORD_ERROR message posted, error = "
|
||||
LOG(LS_ERROR) << "RECORD_ERROR, error = "
|
||||
<< LATE(pa_context_errno)(_paContext);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -187,15 +187,6 @@ public:
|
||||
int32_t PlayoutDelay(uint16_t& delayMS) const override;
|
||||
int32_t RecordingDelay(uint16_t& delayMS) const override;
|
||||
|
||||
bool PlayoutWarning() const override;
|
||||
bool PlayoutError() const override;
|
||||
bool RecordingWarning() const override;
|
||||
bool RecordingError() const override;
|
||||
void ClearPlayoutWarning() override;
|
||||
void ClearPlayoutError() override;
|
||||
void ClearRecordingWarning() override;
|
||||
void ClearRecordingError() override;
|
||||
|
||||
void AttachAudioBuffer(AudioDeviceBuffer* audioBuffer) override;
|
||||
|
||||
private:
|
||||
@ -306,10 +297,6 @@ private:
|
||||
uint32_t _sndCardRecDelay;
|
||||
|
||||
int32_t _writeErrors;
|
||||
uint16_t _playWarning;
|
||||
uint16_t _playError;
|
||||
uint16_t _recWarning;
|
||||
uint16_t _recError;
|
||||
|
||||
uint16_t _deviceIndex;
|
||||
int16_t _numPlayDevices;
|
||||
|
||||
Reference in New Issue
Block a user