Stop using LOG macros in favor of RTC_ prefixed macros.

This CL has been generated with the following script:

for m in PLOG \
  LOG_TAG \
  LOG_GLEM \
  LOG_GLE_EX \
  LOG_GLE \
  LAST_SYSTEM_ERROR \
  LOG_ERRNO_EX \
  LOG_ERRNO \
  LOG_ERR_EX \
  LOG_ERR \
  LOG_V \
  LOG_F \
  LOG_T_F \
  LOG_E \
  LOG_T \
  LOG_CHECK_LEVEL_V \
  LOG_CHECK_LEVEL \
  LOG
do
  git grep -l $m | xargs sed -i "s,\b$m\b,RTC_$m,g"
done
git checkout rtc_base/logging.h
git cl format

Bug: webrtc:8452
Change-Id: I1a53ef3e0a5ef6e244e62b2e012b864914784600
Reviewed-on: https://webrtc-review.googlesource.com/21325
Reviewed-by: Niels Moller <nisse@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20617}
This commit is contained in:
Mirko Bonadei
2017-11-09 11:09:25 +01:00
committed by Commit Bot
parent 34fa309129
commit 675513b96a
407 changed files with 5753 additions and 5371 deletions

View File

@ -81,7 +81,7 @@ AudioDeviceLinuxPulse::AudioDeviceLinuxPulse()
_playStream(NULL),
_recStreamFlags(0),
_playStreamFlags(0) {
LOG(LS_INFO) << __FUNCTION__ << " created";
RTC_LOG(LS_INFO) << __FUNCTION__ << " created";
memset(_paServerVersion, 0, sizeof(_paServerVersion));
memset(&_playBufferAttr, 0, sizeof(_playBufferAttr));
@ -90,7 +90,7 @@ AudioDeviceLinuxPulse::AudioDeviceLinuxPulse()
}
AudioDeviceLinuxPulse::~AudioDeviceLinuxPulse() {
LOG(LS_INFO) << __FUNCTION__ << " destroyed";
RTC_LOG(LS_INFO) << __FUNCTION__ << " destroyed";
RTC_DCHECK(thread_checker_.CalledOnValidThread());
Terminate();
@ -149,9 +149,9 @@ AudioDeviceGeneric::InitStatus AudioDeviceLinuxPulse::Init() {
// Initialize PulseAudio
if (InitPulseAudio() < 0) {
LOG(LS_ERROR) << "failed to initialize PulseAudio";
RTC_LOG(LS_ERROR) << "failed to initialize PulseAudio";
if (TerminatePulseAudio() < 0) {
LOG(LS_ERROR) << "failed to terminate PulseAudio";
RTC_LOG(LS_ERROR) << "failed to terminate PulseAudio";
}
return InitStatus::OTHER_ERROR;
}
@ -159,7 +159,7 @@ AudioDeviceGeneric::InitStatus AudioDeviceLinuxPulse::Init() {
// Get X display handle for typing detection
_XDisplay = XOpenDisplay(NULL);
if (!_XDisplay) {
LOG(LS_WARNING)
RTC_LOG(LS_WARNING)
<< "failed to open X display, typing detection will not work";
}
@ -209,7 +209,7 @@ int32_t AudioDeviceLinuxPulse::Terminate() {
// Terminate PulseAudio
if (TerminatePulseAudio() < 0) {
LOG(LS_ERROR) << "failed to terminate PulseAudio";
RTC_LOG(LS_ERROR) << "failed to terminate PulseAudio";
return -1;
}
@ -624,7 +624,7 @@ int32_t AudioDeviceLinuxPulse::MicrophoneVolume(uint32_t& volume) const {
uint32_t level(0);
if (_mixerManager.MicrophoneVolume(level) == -1) {
LOG(LS_WARNING) << "failed to retrieve current microphone level";
RTC_LOG(LS_WARNING) << "failed to retrieve current microphone level";
return -1;
}
@ -682,11 +682,11 @@ int32_t AudioDeviceLinuxPulse::SetPlayoutDevice(uint16_t index) {
const uint16_t nDevices = PlayoutDevices();
LOG(LS_VERBOSE) << "number of availiable output devices is " << nDevices;
RTC_LOG(LS_VERBOSE) << "number of availiable output devices is " << nDevices;
if (index > (nDevices - 1)) {
LOG(LS_ERROR) << "device index is out of range [0," << (nDevices - 1)
<< "]";
RTC_LOG(LS_ERROR) << "device index is out of range [0," << (nDevices - 1)
<< "]";
return -1;
}
@ -698,7 +698,7 @@ int32_t AudioDeviceLinuxPulse::SetPlayoutDevice(uint16_t index) {
int32_t AudioDeviceLinuxPulse::SetPlayoutDevice(
AudioDeviceModule::WindowsDeviceType /*device*/) {
LOG(LS_ERROR) << "WindowsDeviceType not supported";
RTC_LOG(LS_ERROR) << "WindowsDeviceType not supported";
return -1;
}
@ -803,11 +803,11 @@ int32_t AudioDeviceLinuxPulse::SetRecordingDevice(uint16_t index) {
const uint16_t nDevices(RecordingDevices());
LOG(LS_VERBOSE) << "number of availiable input devices is " << nDevices;
RTC_LOG(LS_VERBOSE) << "number of availiable input devices is " << nDevices;
if (index > (nDevices - 1)) {
LOG(LS_ERROR) << "device index is out of range [0," << (nDevices - 1)
<< "]";
RTC_LOG(LS_ERROR) << "device index is out of range [0," << (nDevices - 1)
<< "]";
return -1;
}
@ -819,7 +819,7 @@ int32_t AudioDeviceLinuxPulse::SetRecordingDevice(uint16_t index) {
int32_t AudioDeviceLinuxPulse::SetRecordingDevice(
AudioDeviceModule::WindowsDeviceType /*device*/) {
LOG(LS_ERROR) << "WindowsDeviceType not supported";
RTC_LOG(LS_ERROR) << "WindowsDeviceType not supported";
return -1;
}
@ -874,7 +874,7 @@ int32_t AudioDeviceLinuxPulse::InitPlayout() {
// Initialize the speaker (devices might have been added or removed)
if (InitSpeaker() == -1) {
LOG(LS_WARNING) << "InitSpeaker() failed";
RTC_LOG(LS_WARNING) << "InitSpeaker() failed";
}
// Set the play sample specification
@ -888,8 +888,8 @@ int32_t AudioDeviceLinuxPulse::InitPlayout() {
LATE(pa_stream_new)(_paContext, "playStream", &playSampleSpec, NULL);
if (!_playStream) {
LOG(LS_ERROR) << "failed to create play stream, err="
<< LATE(pa_context_errno)(_paContext);
RTC_LOG(LS_ERROR) << "failed to create play stream, err="
<< LATE(pa_context_errno)(_paContext);
return -1;
}
@ -902,7 +902,8 @@ int32_t AudioDeviceLinuxPulse::InitPlayout() {
_ptrAudioBuffer->SetPlayoutChannels((uint8_t)_playChannels);
}
LOG(LS_VERBOSE) << "stream state " << LATE(pa_stream_get_state)(_playStream);
RTC_LOG(LS_VERBOSE) << "stream state "
<< LATE(pa_stream_get_state)(_playStream);
// Set stream flags
_playStreamFlags = (pa_stream_flags_t)(PA_STREAM_AUTO_TIMING_UPDATE |
@ -921,7 +922,7 @@ int32_t AudioDeviceLinuxPulse::InitPlayout() {
const pa_sample_spec* spec = LATE(pa_stream_get_sample_spec)(_playStream);
if (!spec) {
LOG(LS_ERROR) << "pa_stream_get_sample_spec()";
RTC_LOG(LS_ERROR) << "pa_stream_get_sample_spec()";
return -1;
}
@ -977,7 +978,7 @@ int32_t AudioDeviceLinuxPulse::InitRecording() {
// Initialize the microphone (devices might have been added or removed)
if (InitMicrophone() == -1) {
LOG(LS_WARNING) << "InitMicrophone() failed";
RTC_LOG(LS_WARNING) << "InitMicrophone() failed";
}
// Set the rec sample specification
@ -990,8 +991,8 @@ int32_t AudioDeviceLinuxPulse::InitRecording() {
_recStream =
LATE(pa_stream_new)(_paContext, "recStream", &recSampleSpec, NULL);
if (!_recStream) {
LOG(LS_ERROR) << "failed to create rec stream, err="
<< LATE(pa_context_errno)(_paContext);
RTC_LOG(LS_ERROR) << "failed to create rec stream, err="
<< LATE(pa_context_errno)(_paContext);
return -1;
}
@ -1020,7 +1021,7 @@ int32_t AudioDeviceLinuxPulse::InitRecording() {
const pa_sample_spec* spec = LATE(pa_stream_get_sample_spec)(_recStream);
if (!spec) {
LOG(LS_ERROR) << "pa_stream_get_sample_spec(rec)";
RTC_LOG(LS_ERROR) << "pa_stream_get_sample_spec(rec)";
return -1;
}
@ -1077,7 +1078,7 @@ int32_t AudioDeviceLinuxPulse::StartRecording() {
_startRec = false;
}
StopRecording();
LOG(LS_ERROR) << "failed to activate recording";
RTC_LOG(LS_ERROR) << "failed to activate recording";
return -1;
}
@ -1087,7 +1088,7 @@ int32_t AudioDeviceLinuxPulse::StartRecording() {
// The recording state is set by the audio thread after recording
// has started.
} else {
LOG(LS_ERROR) << "failed to activate recording";
RTC_LOG(LS_ERROR) << "failed to activate recording";
return -1;
}
}
@ -1110,7 +1111,7 @@ int32_t AudioDeviceLinuxPulse::StopRecording() {
_recIsInitialized = false;
_recording = false;
LOG(LS_VERBOSE) << "stopping recording";
RTC_LOG(LS_VERBOSE) << "stopping recording";
// Stop Recording
PaLock();
@ -1124,13 +1125,13 @@ int32_t AudioDeviceLinuxPulse::StopRecording() {
if (LATE(pa_stream_get_state)(_recStream) != PA_STREAM_UNCONNECTED) {
// Disconnect the stream
if (LATE(pa_stream_disconnect)(_recStream) != PA_OK) {
LOG(LS_ERROR) << "failed to disconnect rec stream, err="
<< LATE(pa_context_errno)(_paContext);
RTC_LOG(LS_ERROR) << "failed to disconnect rec stream, err="
<< LATE(pa_context_errno)(_paContext);
PaUnLock();
return -1;
}
LOG(LS_VERBOSE) << "disconnected recording";
RTC_LOG(LS_VERBOSE) << "disconnected recording";
}
LATE(pa_stream_unref)(_recStream);
@ -1192,7 +1193,7 @@ int32_t AudioDeviceLinuxPulse::StartPlayout() {
_startPlay = false;
}
StopPlayout();
LOG(LS_ERROR) << "failed to activate playout";
RTC_LOG(LS_ERROR) << "failed to activate playout";
return -1;
}
@ -1202,7 +1203,7 @@ int32_t AudioDeviceLinuxPulse::StartPlayout() {
// The playing state is set by the audio thread after playout
// has started.
} else {
LOG(LS_ERROR) << "failed to activate playing";
RTC_LOG(LS_ERROR) << "failed to activate playing";
return -1;
}
}
@ -1227,7 +1228,7 @@ int32_t AudioDeviceLinuxPulse::StopPlayout() {
_sndCardPlayDelay = 0;
_sndCardRecDelay = 0;
LOG(LS_VERBOSE) << "stopping playback";
RTC_LOG(LS_VERBOSE) << "stopping playback";
// Stop Playout
PaLock();
@ -1241,13 +1242,13 @@ int32_t AudioDeviceLinuxPulse::StopPlayout() {
if (LATE(pa_stream_get_state)(_playStream) != PA_STREAM_UNCONNECTED) {
// Disconnect the stream
if (LATE(pa_stream_disconnect)(_playStream) != PA_OK) {
LOG(LS_ERROR) << "failed to disconnect play stream, err="
<< LATE(pa_context_errno)(_paContext);
RTC_LOG(LS_ERROR) << "failed to disconnect play stream, err="
<< LATE(pa_context_errno)(_paContext);
PaUnLock();
return -1;
}
LOG(LS_VERBOSE) << "disconnected playback";
RTC_LOG(LS_VERBOSE) << "disconnected playback";
}
LATE(pa_stream_unref)(_playStream);
@ -1315,26 +1316,26 @@ void AudioDeviceLinuxPulse::PaStreamStateCallback(pa_stream* p, void* pThis) {
}
void AudioDeviceLinuxPulse::PaContextStateCallbackHandler(pa_context* c) {
LOG(LS_VERBOSE) << "context state cb";
RTC_LOG(LS_VERBOSE) << "context state cb";
pa_context_state_t state = LATE(pa_context_get_state)(c);
switch (state) {
case PA_CONTEXT_UNCONNECTED:
LOG(LS_VERBOSE) << "unconnected";
RTC_LOG(LS_VERBOSE) << "unconnected";
break;
case PA_CONTEXT_CONNECTING:
case PA_CONTEXT_AUTHORIZING:
case PA_CONTEXT_SETTING_NAME:
LOG(LS_VERBOSE) << "no state";
RTC_LOG(LS_VERBOSE) << "no state";
break;
case PA_CONTEXT_FAILED:
case PA_CONTEXT_TERMINATED:
LOG(LS_VERBOSE) << "failed";
RTC_LOG(LS_VERBOSE) << "failed";
_paStateChanged = true;
LATE(pa_threaded_mainloop_signal)(_paMainloop, 0);
break;
case PA_CONTEXT_READY:
LOG(LS_VERBOSE) << "ready";
RTC_LOG(LS_VERBOSE) << "ready";
_paStateChanged = true;
LATE(pa_threaded_mainloop_signal)(_paMainloop, 0);
break;
@ -1425,22 +1426,22 @@ void AudioDeviceLinuxPulse::PaServerInfoCallbackHandler(
}
void AudioDeviceLinuxPulse::PaStreamStateCallbackHandler(pa_stream* p) {
LOG(LS_VERBOSE) << "stream state cb";
RTC_LOG(LS_VERBOSE) << "stream state cb";
pa_stream_state_t state = LATE(pa_stream_get_state)(p);
switch (state) {
case PA_STREAM_UNCONNECTED:
LOG(LS_VERBOSE) << "unconnected";
RTC_LOG(LS_VERBOSE) << "unconnected";
break;
case PA_STREAM_CREATING:
LOG(LS_VERBOSE) << "creating";
RTC_LOG(LS_VERBOSE) << "creating";
break;
case PA_STREAM_FAILED:
case PA_STREAM_TERMINATED:
LOG(LS_VERBOSE) << "failed";
RTC_LOG(LS_VERBOSE) << "failed";
break;
case PA_STREAM_READY:
LOG(LS_VERBOSE) << "ready";
RTC_LOG(LS_VERBOSE) << "ready";
break;
}
@ -1460,7 +1461,7 @@ int32_t AudioDeviceLinuxPulse::CheckPulseAudioVersion() {
PaUnLock();
LOG(LS_VERBOSE) << "checking PulseAudio version: " << _paServerVersion;
RTC_LOG(LS_VERBOSE) << "checking PulseAudio version: " << _paServerVersion;
return 0;
}
@ -1558,50 +1559,50 @@ int32_t AudioDeviceLinuxPulse::InitPulseAudio() {
if (!PaSymbolTable.Load()) {
// Most likely the Pulse library and sound server are not installed on
// this system
LOG(LS_ERROR) << "failed to load symbol table";
RTC_LOG(LS_ERROR) << "failed to load symbol table";
return -1;
}
// Create a mainloop API and connection to the default server
// the mainloop is the internal asynchronous API event loop
if (_paMainloop) {
LOG(LS_ERROR) << "PA mainloop has already existed";
RTC_LOG(LS_ERROR) << "PA mainloop has already existed";
return -1;
}
_paMainloop = LATE(pa_threaded_mainloop_new)();
if (!_paMainloop) {
LOG(LS_ERROR) << "could not create mainloop";
RTC_LOG(LS_ERROR) << "could not create mainloop";
return -1;
}
// Start the threaded main loop
retVal = LATE(pa_threaded_mainloop_start)(_paMainloop);
if (retVal != PA_OK) {
LOG(LS_ERROR) << "failed to start main loop, error=" << retVal;
RTC_LOG(LS_ERROR) << "failed to start main loop, error=" << retVal;
return -1;
}
LOG(LS_VERBOSE) << "mainloop running!";
RTC_LOG(LS_VERBOSE) << "mainloop running!";
PaLock();
_paMainloopApi = LATE(pa_threaded_mainloop_get_api)(_paMainloop);
if (!_paMainloopApi) {
LOG(LS_ERROR) << "could not create mainloop API";
RTC_LOG(LS_ERROR) << "could not create mainloop API";
PaUnLock();
return -1;
}
// Create a new PulseAudio context
if (_paContext) {
LOG(LS_ERROR) << "PA context has already existed";
RTC_LOG(LS_ERROR) << "PA context has already existed";
PaUnLock();
return -1;
}
_paContext = LATE(pa_context_new)(_paMainloopApi, "WEBRTC VoiceEngine");
if (!_paContext) {
LOG(LS_ERROR) << "could not create context";
RTC_LOG(LS_ERROR) << "could not create context";
PaUnLock();
return -1;
}
@ -1615,7 +1616,7 @@ int32_t AudioDeviceLinuxPulse::InitPulseAudio() {
LATE(pa_context_connect)(_paContext, NULL, PA_CONTEXT_NOAUTOSPAWN, NULL);
if (retVal != PA_OK) {
LOG(LS_ERROR) << "failed to connect context, error=" << retVal;
RTC_LOG(LS_ERROR) << "failed to connect context, error=" << retVal;
PaUnLock();
return -1;
}
@ -1630,13 +1631,13 @@ int32_t AudioDeviceLinuxPulse::InitPulseAudio() {
if (state != PA_CONTEXT_READY) {
if (state == PA_CONTEXT_FAILED) {
LOG(LS_ERROR) << "failed to connect to PulseAudio sound server";
RTC_LOG(LS_ERROR) << "failed to connect to PulseAudio sound server";
} else if (state == PA_CONTEXT_TERMINATED) {
LOG(LS_ERROR) << "PulseAudio connection terminated early";
RTC_LOG(LS_ERROR) << "PulseAudio connection terminated early";
} else {
// Shouldn't happen, because we only signal on one of those three
// states
LOG(LS_ERROR) << "unknown problem connecting to PulseAudio";
RTC_LOG(LS_ERROR) << "unknown problem connecting to PulseAudio";
}
PaUnLock();
return -1;
@ -1649,15 +1650,15 @@ int32_t AudioDeviceLinuxPulse::InitPulseAudio() {
// Check the version
if (CheckPulseAudioVersion() < 0) {
LOG(LS_ERROR) << "PulseAudio version " << _paServerVersion
<< " not supported";
RTC_LOG(LS_ERROR) << "PulseAudio version " << _paServerVersion
<< " not supported";
return -1;
}
// Initialize sampling frequency
if (InitSamplingFrequency() < 0 || sample_rate_hz_ == 0) {
LOG(LS_ERROR) << "failed to initialize sampling frequency, set to "
<< sample_rate_hz_ << " Hz";
RTC_LOG(LS_ERROR) << "failed to initialize sampling frequency, set to "
<< sample_rate_hz_ << " Hz";
return -1;
}
@ -1698,7 +1699,7 @@ int32_t AudioDeviceLinuxPulse::TerminatePulseAudio() {
_paMainloop = NULL;
LOG(LS_VERBOSE) << "PulseAudio terminated";
RTC_LOG(LS_VERBOSE) << "PulseAudio terminated";
return 0;
}
@ -1714,7 +1715,7 @@ void AudioDeviceLinuxPulse::PaUnLock() {
void AudioDeviceLinuxPulse::WaitForOperationCompletion(
pa_operation* paOperation) const {
if (!paOperation) {
LOG(LS_ERROR) << "paOperation NULL in WaitForOperationCompletion";
RTC_LOG(LS_ERROR) << "paOperation NULL in WaitForOperationCompletion";
return;
}
@ -1773,7 +1774,7 @@ void AudioDeviceLinuxPulse::PaStreamUnderflowCallback(pa_stream* /*unused*/,
}
void AudioDeviceLinuxPulse::PaStreamUnderflowCallbackHandler() {
LOG(LS_WARNING) << "Playout underflow";
RTC_LOG(LS_WARNING) << "Playout underflow";
if (_configuredLatencyPlay == WEBRTC_PA_NO_LATENCY_REQUIREMENTS) {
// We didn't configure a pa_buffer_attr before, so switching to
@ -1785,7 +1786,7 @@ void AudioDeviceLinuxPulse::PaStreamUnderflowCallbackHandler() {
const pa_sample_spec* spec = LATE(pa_stream_get_sample_spec)(_playStream);
if (!spec) {
LOG(LS_ERROR) << "pa_stream_get_sample_spec()";
RTC_LOG(LS_ERROR) << "pa_stream_get_sample_spec()";
return;
}
@ -1804,7 +1805,7 @@ void AudioDeviceLinuxPulse::PaStreamUnderflowCallbackHandler() {
pa_operation* op = LATE(pa_stream_set_buffer_attr)(
_playStream, &_playBufferAttr, NULL, NULL);
if (!op) {
LOG(LS_ERROR) << "pa_stream_set_buffer_attr()";
RTC_LOG(LS_ERROR) << "pa_stream_set_buffer_attr()";
return;
}
@ -1834,7 +1835,7 @@ void AudioDeviceLinuxPulse::PaStreamReadCallbackHandler() {
// in the worker thread.
if (LATE(pa_stream_peek)(_recStream, &_tempSampleData,
&_tempSampleDataSize) != 0) {
LOG(LS_ERROR) << "Can't read data!";
RTC_LOG(LS_ERROR) << "Can't read data!";
return;
}
@ -1851,7 +1852,7 @@ void AudioDeviceLinuxPulse::PaStreamOverflowCallback(pa_stream* /*unused*/,
}
void AudioDeviceLinuxPulse::PaStreamOverflowCallbackHandler() {
LOG(LS_WARNING) << "Recording overflow";
RTC_LOG(LS_WARNING) << "Recording overflow";
}
int32_t AudioDeviceLinuxPulse::LatencyUsecs(pa_stream* stream) {
@ -1866,14 +1867,15 @@ int32_t AudioDeviceLinuxPulse::LatencyUsecs(pa_stream* stream) {
pa_usec_t latency;
int negative;
if (LATE(pa_stream_get_latency)(stream, &latency, &negative) != 0) {
LOG(LS_ERROR) << "Can't query latency";
RTC_LOG(LS_ERROR) << "Can't query latency";
// We'd rather continue playout/capture with an incorrect delay than
// stop it altogether, so return a valid value.
return 0;
}
if (negative) {
LOG(LS_VERBOSE) << "warning: pa_stream_get_latency reported negative delay";
RTC_LOG(LS_VERBOSE)
<< "warning: pa_stream_get_latency reported negative delay";
// The delay can be negative for monitoring streams if the captured
// samples haven't been played yet. In such a case, "latency"
@ -2006,10 +2008,10 @@ int32_t AudioDeviceLinuxPulse::ProcessRecordedData(int8_t* bufferData,
// change is needed.
// Set this new mic level (received from the observer as return
// value in the callback).
LOG(LS_VERBOSE) << "AGC change of volume: old=" << currentMicLevel
<< " => new=" << newMicLevel;
RTC_LOG(LS_VERBOSE) << "AGC change of volume: old=" << currentMicLevel
<< " => new=" << newMicLevel;
if (SetMicrophoneVolume(newMicLevel) == -1) {
LOG(LS_WARNING)
RTC_LOG(LS_WARNING)
<< "the required modification of the microphone volume failed";
}
}
@ -2031,7 +2033,7 @@ bool AudioDeviceLinuxPulse::PlayThreadProcess() {
case kEventSignaled:
break;
case kEventError:
LOG(LS_WARNING) << "EventWrapper::Wait() failed";
RTC_LOG(LS_WARNING) << "EventWrapper::Wait() failed";
return true;
case kEventTimeout:
return true;
@ -2040,7 +2042,7 @@ bool AudioDeviceLinuxPulse::PlayThreadProcess() {
rtc::CritScope lock(&_critSect);
if (_startPlay) {
LOG(LS_VERBOSE) << "_startPlay true, performing initial actions";
RTC_LOG(LS_VERBOSE) << "_startPlay true, performing initial actions";
_startPlay = false;
_playDeviceName = NULL;
@ -2088,18 +2090,18 @@ bool AudioDeviceLinuxPulse::PlayThreadProcess() {
if (LATE(pa_stream_connect_playback)(
_playStream, _playDeviceName, &_playBufferAttr,
(pa_stream_flags_t)_playStreamFlags, ptr_cvolume, NULL) != PA_OK) {
LOG(LS_ERROR) << "failed to connect play stream, err="
<< LATE(pa_context_errno)(_paContext);
RTC_LOG(LS_ERROR) << "failed to connect play stream, err="
<< LATE(pa_context_errno)(_paContext);
}
LOG(LS_VERBOSE) << "play stream connected";
RTC_LOG(LS_VERBOSE) << "play stream connected";
// Wait for state change
while (LATE(pa_stream_get_state)(_playStream) != PA_STREAM_READY) {
LATE(pa_threaded_mainloop_wait)(_paMainloop);
}
LOG(LS_VERBOSE) << "play stream ready";
RTC_LOG(LS_VERBOSE) << "play stream ready";
// We can now handle write callbacks
EnableWriteCallback();
@ -2136,8 +2138,8 @@ bool AudioDeviceLinuxPulse::PlayThreadProcess() {
NULL, (int64_t)0, PA_SEEK_RELATIVE) != PA_OK) {
_writeErrors++;
if (_writeErrors > 10) {
LOG(LS_ERROR) << "Playout error: _writeErrors=" << _writeErrors
<< ", error=" << LATE(pa_context_errno)(_paContext);
RTC_LOG(LS_ERROR) << "Playout error: _writeErrors=" << _writeErrors
<< ", error=" << LATE(pa_context_errno)(_paContext);
_writeErrors = 0;
}
}
@ -2154,7 +2156,7 @@ bool AudioDeviceLinuxPulse::PlayThreadProcess() {
// AudioDeviceBuffer ensure that this callback is executed
// without taking the audio-thread lock.
UnLock();
LOG(LS_VERBOSE) << "requesting data";
RTC_LOG(LS_VERBOSE) << "requesting data";
uint32_t nSamples = _ptrAudioBuffer->RequestPlayoutData(numPlaySamples);
Lock();
@ -2165,7 +2167,8 @@ bool AudioDeviceLinuxPulse::PlayThreadProcess() {
nSamples = _ptrAudioBuffer->GetPlayoutData(_playBuffer);
if (nSamples != numPlaySamples) {
LOG(LS_ERROR) << "invalid number of output samples(" << nSamples << ")";
RTC_LOG(LS_ERROR) << "invalid number of output samples(" << nSamples
<< ")";
}
size_t write = _playbackBufferSize;
@ -2173,14 +2176,14 @@ bool AudioDeviceLinuxPulse::PlayThreadProcess() {
write = _tempBufferSpace;
}
LOG(LS_VERBOSE) << "will write";
RTC_LOG(LS_VERBOSE) << "will write";
PaLock();
if (LATE(pa_stream_write)(_playStream, (void*)&_playBuffer[0], write,
NULL, (int64_t)0, PA_SEEK_RELATIVE) != PA_OK) {
_writeErrors++;
if (_writeErrors > 10) {
LOG(LS_ERROR) << "Playout error: _writeErrors=" << _writeErrors
<< ", error=" << LATE(pa_context_errno)(_paContext);
RTC_LOG(LS_ERROR) << "Playout error: _writeErrors=" << _writeErrors
<< ", error=" << LATE(pa_context_errno)(_paContext);
_writeErrors = 0;
}
}
@ -2204,7 +2207,7 @@ bool AudioDeviceLinuxPulse::RecThreadProcess() {
case kEventSignaled:
break;
case kEventError:
LOG(LS_WARNING) << "EventWrapper::Wait() failed";
RTC_LOG(LS_WARNING) << "EventWrapper::Wait() failed";
return true;
case kEventTimeout:
return true;
@ -2213,7 +2216,7 @@ bool AudioDeviceLinuxPulse::RecThreadProcess() {
rtc::CritScope lock(&_critSect);
if (_startRec) {
LOG(LS_VERBOSE) << "_startRec true, performing initial actions";
RTC_LOG(LS_VERBOSE) << "_startRec true, performing initial actions";
_recDeviceName = NULL;
@ -2227,24 +2230,24 @@ bool AudioDeviceLinuxPulse::RecThreadProcess() {
PaLock();
LOG(LS_VERBOSE) << "connecting stream";
RTC_LOG(LS_VERBOSE) << "connecting stream";
// Connect the stream to a source
if (LATE(pa_stream_connect_record)(
_recStream, _recDeviceName, &_recBufferAttr,
(pa_stream_flags_t)_recStreamFlags) != PA_OK) {
LOG(LS_ERROR) << "failed to connect rec stream, err="
<< LATE(pa_context_errno)(_paContext);
RTC_LOG(LS_ERROR) << "failed to connect rec stream, err="
<< LATE(pa_context_errno)(_paContext);
}
LOG(LS_VERBOSE) << "connected";
RTC_LOG(LS_VERBOSE) << "connected";
// Wait for state change
while (LATE(pa_stream_get_state)(_recStream) != PA_STREAM_READY) {
LATE(pa_threaded_mainloop_wait)(_paMainloop);
}
LOG(LS_VERBOSE) << "done";
RTC_LOG(LS_VERBOSE) << "done";
// We can now handle read callbacks
EnableReadCallback();
@ -2277,8 +2280,8 @@ bool AudioDeviceLinuxPulse::RecThreadProcess() {
while (true) {
// Ack the last thing we read
if (LATE(pa_stream_drop)(_recStream) != 0) {
LOG(LS_WARNING) << "failed to drop, err="
<< LATE(pa_context_errno)(_paContext);
RTC_LOG(LS_WARNING)
<< "failed to drop, err=" << LATE(pa_context_errno)(_paContext);
}
if (LATE(pa_stream_readable_size)(_recStream) <= 0) {
@ -2291,8 +2294,8 @@ bool AudioDeviceLinuxPulse::RecThreadProcess() {
size_t sampleDataSize;
if (LATE(pa_stream_peek)(_recStream, &sampleData, &sampleDataSize) != 0) {
LOG(LS_ERROR) << "RECORD_ERROR, error = "
<< LATE(pa_context_errno)(_paContext);
RTC_LOG(LS_ERROR) << "RECORD_ERROR, error = "
<< LATE(pa_context_errno)(_paContext);
break;
}