pa_threaded_mainloop_signal(pClient->__mpMainloop, 0);
break;
- case PA_STREAM_FAILED:
//LCOV_EXCL_START
+ case PA_STREAM_FAILED:
AUDIO_IO_LOGD("The stream is failed");
pClient->__mpListener->onStateChanged(CAudioInfo::EAudioIOState::AUDIO_IO_STATE_IDLE,
__is_microphone_restricted());
// Start mainloop
if (pa_threaded_mainloop_start(__mpMainloop) < 0) {
+//LCOV_EXCL_START
pa_threaded_mainloop_unlock(__mpMainloop);
- THROW_ERROR_MSG(CAudioError::EError::ERROR_FAILED_OPERATION, "Failed pa_threaded_mainloop_start()"); //LCOV_EXCL_LINE
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_FAILED_OPERATION, "Failed pa_threaded_mainloop_start()");
+//LCOV_EXCL_STOP
}
// Connection process is asynchronously
// __mIsInit = true; // Moved to __streamStateChangeCb()
} catch (const CAudioError& e) {
+//LCOV_EXCL_START
finalize();
throw;
+//LCOV_EXCL_END
}
}
int CPulseAudioClient::read(void* buffer, size_t length) {
if (!__mIsInit)
- THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Did not initialize CPulseAudioClient");
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Did not initialize CPulseAudioClient"); //LCOV_EXCL_LINE
checkRunningState();
if (!buffer)
- THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT, "The parameter is invalid : buffer[%p]", buffer);
+ THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT, "The parameter is invalid : buffer[%p]", buffer); //LCOV_EXCL_LINE
if (__mDirection == EStreamDirection::STREAM_DIRECTION_PLAYBACK)
- THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_SUPPORTED, "The Playback client couldn't use this function");
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_SUPPORTED, "The Playback client couldn't use this function"); //LCOV_EXCL_LINE
size_t lengthIter = length;
int ret = 0;
while (!__mpSyncReadDataPtr) {
ret = pa_stream_peek(__mpStream, &__mpSyncReadDataPtr, &__mSyncReadLength);
if (ret != 0)
- THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INTERNAL_OPERATION, "Failed pa_stream_peek() : ret[%d]", ret);
+ THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INTERNAL_OPERATION, "Failed pa_stream_peek() : ret[%d]", ret); //LCOV_EXCL_LINE
if (__mSyncReadLength <= 0) {
#ifdef _AUDIO_IO_DEBUG_TIMING_
#endif
pa_threaded_mainloop_wait(__mpMainloop);
} else if (!__mpSyncReadDataPtr) {
+// LCOV_EXCL_START
// Data peeked, but it doesn't have any data
ret = pa_stream_drop(__mpStream);
if (ret != 0)
- THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INTERNAL_OPERATION, "Failed pa_stream_drop() : ret[%d]", ret); //LCOV_EXCL_LINE
+ THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INTERNAL_OPERATION, "Failed pa_stream_drop() : ret[%d]", ret);
+//LCOV_EXCL_STOP
} else {
__mSyncReadIndex = 0;
}
pa_threaded_mainloop_unlock(__mpMainloop);
__mIsUsedSyncRead = false;
} catch (const CAudioError& e) {
+// LCOV_EXCL_START
pa_threaded_mainloop_unlock(__mpMainloop);
__mIsUsedSyncRead = false;
throw;
+// LCOV_EXCL_STOP
}
return length;
int CPulseAudioClient::peek(const void** buffer, size_t* length) {
if (!__mIsInit)
- THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Did not initialize CPulseAudioClient");
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Did not initialize CPulseAudioClient"); // LCOV_EXCL_LINE
checkRunningState();
if (!buffer || !length)
- THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT, "The parameter is invalid : buffer[%p], length[%p]", buffer, length);
+ THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT, // LCOV_EXCL_LINE
+ "The parameter is invalid : buffer[%p], length[%p]", buffer, length); // LCOV_EXCL_LINE
if (__mDirection == EStreamDirection::STREAM_DIRECTION_PLAYBACK)
- THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_SUPPORTED, "The Playback client couldn't use this function");
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_SUPPORTED, "The Playback client couldn't use this function"); // LCOV_EXCL_LINE
int ret = 0;
int CPulseAudioClient::drop() {
if (!__mIsInit)
- THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Did not initialize CPulseAudioClient");
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Did not initialize CPulseAudioClient"); // LCOV_EXCL_LINE
#ifdef _AUDIO_IO_DEBUG_TIMING_
AUDIO_IO_LOGD("");
checkRunningState();
if (__mDirection == EStreamDirection::STREAM_DIRECTION_PLAYBACK)
- THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_SUPPORTED, "The Playback client couldn't use this function");
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_SUPPORTED, "The Playback client couldn't use this function"); // LCOV_EXCL_LINE
int ret = 0;
int CPulseAudioClient::write(const void* data, size_t length) {
if (!data)
- THROW_ERROR_MSG(CAudioError::EError::ERROR_INVALID_ARGUMENT, "The parameter is invalid");
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_INVALID_ARGUMENT, "The parameter is invalid"); // LCOV_EXCL_LINE
if (__mDirection == EStreamDirection::STREAM_DIRECTION_RECORD)
- THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_SUPPORTED, "The Playback client couldn't use this function");
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_SUPPORTED, "The Playback client couldn't use this function"); // LCOV_EXCL_LINE
int ret = 0;
ret = pa_stream_write(__mpStream, data, length, NULL, 0LL, PA_SEEK_RELATIVE);
pa_threaded_mainloop_unlock(__mpMainloop);
} else {
+// LCOV_EXCL_START
if (pa_stream_is_corked(__mpStream)) {
AUDIO_IO_LOGW("stream is corked...do uncork here first!!!!");
pa_operation_unref(pa_stream_cork(__mpStream, 0, NULL, this));
length, prebuf, (length < prebuf) ? prebuf - length : 0);
}
ret = pa_stream_write(__mpStream, data, length, NULL, 0LL, PA_SEEK_RELATIVE);
+// LCOV_EXCL_STOP
}
if (ret < 0)
AUDIO_IO_LOGD("cork[%d]", cork);
if (!__mIsInit)
- THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Did not initialize CPulseAudioClient");
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Did not initialize CPulseAudioClient"); // LCOV_EXCL_LINE
if (isInThread())
- THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_SUPPORTED, "This operation is not supported in callback");
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_SUPPORTED, "This operation is not supported in callback"); // LCOV_EXCL_LINE
checkRunningState();
bool CPulseAudioClient::isCorked() {
if (!__mIsInit)
- THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Did not initialize CPulseAudioClient");
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Did not initialize CPulseAudioClient"); // LCOV_EXCL_LINE
checkRunningState();
bool CPulseAudioClient::drain() {
if (!__mIsInit)
- THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Did not initialize CPulseAudioClient");
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Did not initialize CPulseAudioClient"); // LCOV_EXCL_LINE
checkRunningState();
bool CPulseAudioClient::flush() {
if (!__mIsInit)
- THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Did not initialize CPulseAudioClient");
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Did not initialize CPulseAudioClient"); // LCOV_EXCL_LINE
checkRunningState();
size_t CPulseAudioClient::getWritableSize() {
if (!__mIsInit)
- THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Did not initialize CPulseAudioClient");
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Did not initialize CPulseAudioClient"); // LCOV_EXCL_LINE
checkRunningState();
if (__mDirection != EStreamDirection::STREAM_DIRECTION_PLAYBACK)
- THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_SUPPORTED, "This client is used for Playback");
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_SUPPORTED, "This client is used for Playback"); // LCOV_EXCL_LINE
size_t ret = 0;
void CPulseAudioClient::checkRunningState() {
if (!__mpContext || !PA_CONTEXT_IS_GOOD(pa_context_get_state(__mpContext)))
- THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_NOT_INITIALIZED, "The context[%p] is not created or not good state", __mpContext);
+ THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_NOT_INITIALIZED, // LCOV_EXCL_LINE
+ "The context[%p] is not created or not good state", __mpContext); // LCOV_EXCL_LINE
if (!__mpStream || !PA_STREAM_IS_GOOD(pa_stream_get_state(__mpStream)))
- THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_NOT_INITIALIZED, "The stream[%p] is not created or not good state", __mpStream);
+ THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_NOT_INITIALIZED, // LCOV_EXCL_LINE
+ "The stream[%p] is not created or not good state", __mpStream); // LCOV_EXCL_LINE
if (pa_context_get_state(__mpContext) != PA_CONTEXT_READY || pa_stream_get_state(__mpStream) != PA_STREAM_READY)
- THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_NOT_INITIALIZED, "The context[%p] or stream[%p] state is not ready", __mpContext, __mpStream);
+ THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_NOT_INITIALIZED, // LCOV_EXCL_LINE
+ "The context[%p] or stream[%p] state is not ready", __mpContext, __mpStream); // LCOV_EXCL_LINE
#ifdef _AUDIO_IO_DEBUG_TIMING_
AUDIO_IO_LOGD("This client is running");
ret = pa_stream_readable_size(__mpStream);
pa_threaded_mainloop_unlock(__mpMainloop);
} else {
- ret = pa_stream_writable_size(__mpStream);
+ ret = pa_stream_readable_size(__mpStream);
}
return ret;