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:
Fredrik Solenberg
2017-10-02 14:55:33 +02:00
committed by Commit Bot
parent c007857ab9
commit 34cdd2d402
35 changed files with 14 additions and 698 deletions

View File

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