static constexpr unsigned int MSG_LENGTH = 512;
/* Constructor & Destructor */
- explicit CAudioError(EError err);
CAudioError(EError err, const char* msg, const char* file, const char* func, int line);
~CAudioError() = default;
LOGW("DEPRECATION WARNING: %s() is deprecated. Use %s() instead.", __func__, msg); \
} while (0)
+//LCOV_EXCL_START
int audio_out_create(int sample_rate, audio_channel_e channel, audio_sample_type_e type, sound_type_e sound_type, audio_out_h* output)
{
DEPRECATED_WARN_INSTEAD("audio_out_create_new");
/* dummy, do nothing */
return AUDIO_IO_ERROR_NONE;
}
-
+//LCOV_EXCL_STOP
__mFullMsg = __mErrorMsg;
}
-CAudioError::CAudioError(EError err) :
- __mError(err),
- __mMsg(nullptr) {
- char __mErrorMsg[MSG_LENGTH] = { 0, };
- snprintf(__mErrorMsg, MSG_LENGTH, "[%s]", __convertErrorToString(__mError));
-
- __mFullMsg = __mErrorMsg;
-}
-
const char* CAudioError::getErrorMsg() const noexcept {
- return __mFullMsg.c_str();
+ return what();
}
const CAudioError::EError CAudioError::getError() const noexcept {
void CAudioIO::internalLock() {
if (!__mIsInit)
- THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Doesn't initialize CAudioIO");
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Doesn't initialize CAudioIO"); //LCOV_EXCL_LINE
if (pthread_mutex_lock(&__mMutex) != 0)
THROW_ERROR_MSG(CAudioError::EError::ERROR_INTERNAL_OPERATION, "Failed pthread_mutex_lock()"); //LCOV_EXCL_LINE
void CAudioIO::internalUnlock() {
if (!__mIsInit)
- THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Doesn't initialize CAudioIO");
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Doesn't initialize CAudioIO"); //LCOV_EXCL_LINE
if (pthread_mutex_unlock(&__mMutex) != 0)
THROW_ERROR_MSG(CAudioError::EError::ERROR_INTERNAL_OPERATION, "Failed pthread_mutex_lock()"); //LCOV_EXCL_LINE
void CAudioIO::internalWait() {
if (!__mIsInit)
- THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Doesn't initialize CAudioIO");
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Doesn't initialize CAudioIO"); //LCOV_EXCL_LINE
#ifdef _AUDIO_IO_DEBUG_TIMING_
AUDIO_IO_LOGD(COLOR_RED "WAIT" COLOR_END);
void CAudioIO::internalSignal() {
if (!__mIsInit)
- THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Doesn't initialize CAudioIO");
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Doesn't initialize CAudioIO"); //LCOV_EXCL_LINE
#ifdef _AUDIO_IO_DEBUG_TIMING_
AUDIO_IO_LOGD(COLOR_GREEN "SIGNAL" COLOR_END);
void CAudioIO::prepare() {
if (!__mIsInit)
- THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Doesn't initialize CAudioIO");
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Doesn't initialize CAudioIO"); //LCOV_EXCL_LINE
}
void CAudioIO::unprepare() {
if (!__mIsInit)
- THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Doesn't initialize CAudioIO");
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Doesn't initialize CAudioIO"); //LCOV_EXCL_LINE
}
void CAudioIO::pause() {
if (!__mIsInit || !IsReady())
- THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Did not initialize or prepare CAudioIO");
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Did not initialize or prepare CAudioIO"); //LCOV_EXCL_LINE
try {
internalLock();
void CAudioIO::resume() {
if (!__mIsInit || !IsReady())
- THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Did not initialize or prepare CAudioIO");
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Did not initialize or prepare CAudioIO"); //LCOV_EXCL_LINE
try {
internalLock();
void CAudioIO::drain() {
if (!__mIsInit || !IsReady())
- THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Did not initialize or prepare CAudioIO");
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Did not initialize or prepare CAudioIO"); //LCOV_EXCL_LINE
try {
if (mpPulseAudioClient->isInThread()) {
void CAudioIO::flush() {
if (!__mIsInit || !IsReady())
- THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Did not initialize or prepare CAudioIO");
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Did not initialize or prepare CAudioIO"); //LCOV_EXCL_LINE
try {
if (mpPulseAudioClient->isInThread()) {
CAudioInfo& CAudioIO::getAudioInfo() {
if (!__mIsInit)
- THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Doesn't initialize CAudioIO");
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Doesn't initialize CAudioIO"); //LCOV_EXCL_LINE
return mAudioInfo;
}
void CAudioIO::setStreamCallback(SStreamCallback callback) {
if (!__mIsInit)
- THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Doesn't initialize CAudioIO");
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Doesn't initialize CAudioIO"); //LCOV_EXCL_LINE
mStreamCallback = callback;
}
CAudioIO::SStreamCallback CAudioIO::getStreamCallback() {
if (!__mIsInit)
- THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Doesn't initialize CAudioIO");
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Doesn't initialize CAudioIO"); //LCOV_EXCL_LINE
return mStreamCallback;
}
void CAudioIO::setStateChangedCallback(SStateChangedCallback callback) {
if (!__mIsInit)
- THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Doesn't initialize CAudioIO");
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Doesn't initialize CAudioIO"); //LCOV_EXCL_LINE
mStateChangedCallback = callback;
}
CAudioIO::SStateChangedCallback CAudioIO::getStateChangedCallback() {
if (!__mIsInit)
- THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Doesn't initialize CAudioIO");
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Doesn't initialize CAudioIO"); //LCOV_EXCL_LINE
return mStateChangedCallback;
}
void CAudioIO::setStreamInfo(sound_stream_info_h stream_info) {
if (!stream_info)
- THROW_ERROR_MSG(CAudioError::EError::ERROR_INVALID_ARGUMENT, "stream_info is NULL");
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_INVALID_ARGUMENT, "stream_info is NULL"); //LCOV_EXCL_LINE
if (!__mIsInit)
- THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Doesn't initialize CAudioIO");
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Doesn't initialize CAudioIO"); //LCOV_EXCL_LINE
if (mState != CAudioInfo::EAudioIOState::AUDIO_IO_STATE_IDLE)
- THROW_ERROR_MSG(CAudioError::EError::ERROR_INVALID_STATE, "it is not permitted while started");
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_INVALID_STATE, "it is not permitted while started"); //LCOV_EXCL_LINE
int errorCode = SOUND_MANAGER_ERROR_NONE;
char *type = nullptr;
bool avail = false;
if ((errorCode = sound_manager_is_available_stream_information(stream_info, NATIVE_API_AUDIO_IO, &avail)) != SOUND_MANAGER_ERROR_NONE)
- THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT, "Parameter stream_info is invalid [ret:%d]", errorCode);
+ THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT, "Parameter stream_info is invalid [ret:%d]", errorCode); //LCOV_EXCL_LINE
if (!avail)
- THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_NOT_SUPPORTED_TYPE, "Input stream is not supported");
+ THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_NOT_SUPPORTED_TYPE, "Input stream is not supported"); //LCOV_EXCL_LINE
if ((errorCode = sound_manager_get_type_from_stream_information(stream_info, &type)) != SOUND_MANAGER_ERROR_NONE)
- THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT, "Parameter stream_info->stream_type is invalid [ret:%d]", errorCode);
+ THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT, "Parameter stream_info->stream_type is invalid [ret:%d]", errorCode); //LCOV_EXCL_LINE
if (mDirection == CAudioInfo::EAudioDirection::AUDIO_DIRECTION_IN)
getAudioInfo().setAudioTypeByInputStreamType(type);
else
getAudioInfo().setAudioTypeByOutputStreamType(type);
if ((errorCode = sound_manager_get_index_from_stream_information(stream_info, &index)) != SOUND_MANAGER_ERROR_NONE)
- THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT, "Parameter stream_info->index is invalid [ret:%d]", errorCode);
+ THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT, "Parameter stream_info->index is invalid [ret:%d]", errorCode); //LCOV_EXCL_LINE
getAudioInfo().setAudioIndex(index);
}
CAudioIO::initialize();
__setInit(true);
} catch (const CAudioError& e) {
+//LCOV_EXCL_START
finalize();
throw;
+//LCOV_EXCL_STOP
}
CAudioIO::onStateChanged(CAudioInfo::EAudioIOState::AUDIO_IO_STATE_IDLE);
void CAudioInput::finalize() {
if (!__IsInit()) {
+//LCOV_EXCL_START
AUDIO_IO_LOGD("Did not initialize");
return;
+//LCOV_EXCL_STOP
}
CAudioIO::finalize();
void CAudioInput::prepare() {
if (!__IsInit())
- THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Did not initialize CAudioInput");
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Did not initialize CAudioInput"); //LCOV_EXCL_LINE
if (__IsReady()) {
AUDIO_IO_LOGD("Already prepared CAudioInput");
CAudioIO::prepare();
} catch (const CAudioError& e) {
+//LCOV_EXCL_START
SAFE_FINALIZE(mpPulseAudioClient);
SAFE_DELETE(mpPulseAudioClient);
internalUnlock();
throw;
+//LCOV_EXCL_STOP
} catch (const std::bad_alloc&) {
//LCOV_EXCL_START
internalUnlock();
void CAudioInput::unprepare() {
if (!__IsInit())
- THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED,
- "Did not initialize CAudioInput");
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, //LCOV_EXCL_LINE
+ "Did not initialize CAudioInput"); //LCOV_EXCL_LINE
if (!__IsReady()) {
AUDIO_IO_LOGD("Already unprepared");
SAFE_DELETE(mpPulseAudioClient);
internalUnlock();
} catch (const CAudioError& e) {
+//LCOV_EXCL_START
internalUnlock();
throw;
+//LCOV_EXCL_STOP
}
CAudioIO::onStateChanged(CAudioInfo::EAudioIOState::AUDIO_IO_STATE_IDLE);
void CAudioInput::pause() {
if (!__IsInit() || !__IsReady())
- THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED,
- "Did not initialize or prepare CAudioInput");
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, //LCOV_EXCL_LINE
+ "Did not initialize or prepare CAudioInput"); //LCOV_EXCL_LINE
if (CAudioIO::getState() != CAudioInfo::EAudioIOState::AUDIO_IO_STATE_RUNNING)
THROW_ERROR_MSG(CAudioError::EError::ERROR_INVALID_STATE,
"Can't pause if not in Running state");
if (mpPulseAudioClient->isInThread())
- THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_OPERATION, "Can't pause in thread");
+ THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_OPERATION, "Can't pause in thread"); //LCOV_EXCL_LINE
CAudioIO::pause();
CAudioIO::onStateChanged(CAudioInfo::EAudioIOState::AUDIO_IO_STATE_PAUSED);
void CAudioInput::resume() {
if (!__IsInit() || !__IsReady())
- THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED,
- "Did not initialize or prepare CAudioInput");
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, //LCOV_EXCL_LINE
+ "Did not initialize or prepare CAudioInput"); //LCOV_EXCL_LINE
if (CAudioIO::getState() != CAudioInfo::EAudioIOState::AUDIO_IO_STATE_PAUSED)
THROW_ERROR_MSG(CAudioError::EError::ERROR_INVALID_STATE,
"Can't resume if not in Paused state");
if (mpPulseAudioClient->isInThread())
- THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_OPERATION, "Can't resume in thread");
+ THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_OPERATION, "Can't resume in thread"); //LCOV_EXCL_LINE
CAudioIO::resume();
CAudioIO::onStateChanged(CAudioInfo::EAudioIOState::AUDIO_IO_STATE_RUNNING);
void CAudioInput::flush() {
if (!__IsInit() || !__IsReady())
- THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED,
- "Did not initialize or prepare CAudioInput");
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, //LCOV_EXCL_LINE
+ "Did not initialize or prepare CAudioInput"); //LCOV_EXCL_LINE
CAudioIO::flush();
}
int CAudioInput::getBufferSize() {
if (!__IsInit())
- THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Did not initialize CAudioInput");
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Did not initialize CAudioInput"); //LCOV_EXCL_LINE
/* FIXME : return calculated size here to satisfy backward compatibility */
return (mAudioInfo.getSampleRate() * DEFAULT_PERIOD_SIZE) / 1000 * mAudioInfo.getSampleSize();
void CAudioInput::setStreamCallback(SStreamCallback callback) {
if (!__IsInit())
- THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Did not initialize CAudioInput");
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Did not initialize CAudioInput"); //LCOV_EXCL_LINE
__mIsUsedSyncRead = (callback.onStream == nullptr);
size_t CAudioInput::read(void* buffer, size_t length) {
if (!__IsInit() || !__IsReady())
- THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED,
- "Did not initialize or prepare CAudioInput");
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, //LCOV_EXCL_LINE
+ "Did not initialize or prepare CAudioInput"); //LCOV_EXCL_LINE
if (!buffer)
THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT,
// If another thread did call unprepare, do not read
if (!mpPulseAudioClient)
- THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED,
- "Did not initialize CPulseAudioClient");
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, //LCOV_EXCL_LINE
+ "Did not initialize CPulseAudioClient"); //LCOV_EXCL_LINE
// Block until read done
ret = mpPulseAudioClient->read(buffer, length);
sched_yield();
} catch (const CAudioError& e) {
+//LCOV_EXCL_START
internalUnlock();
throw;
+//LCOV_EXCL_STOP
}
return ret;
int CAudioInput::peek(const void** buffer, size_t* length) {
if (!__IsInit() || !__IsReady())
- THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED,
- "Did not initialize or prepare CAudioInput");
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, //LCOV_EXCL_LINE
+ "Did not initialize or prepare CAudioInput"); //LCOV_EXCL_LINE
if (buffer == nullptr || length == nullptr)
- THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT,
- "Parameters are NULL buffer:%p, length:%p", buffer, length);
+ THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT, //LCOV_EXCL_LINE
+ "Parameters are NULL buffer:%p, length:%p", buffer, length); //LCOV_EXCL_LINE
/* Checks synchronous flag */
if (__mIsUsedSyncRead)
int CAudioInput::drop() {
if (!__IsInit() || !__IsReady())
- THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED,
- "Did not initialize or prepare CAudioInput");
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, //LCOV_EXCL_LINE
+ "Did not initialize or prepare CAudioInput"); //LCOV_EXCL_LINE
/* Checks synchronous flag */
if (__mIsUsedSyncRead)
CAudioIO::initialize();
__setInit(true);
} catch (const CAudioError& e) {
+//LCOV_EXCL_START
finalize();
throw;
+//LCOV_EXCL_STOP
}
CAudioIO::onStateChanged(CAudioInfo::EAudioIOState::AUDIO_IO_STATE_IDLE);
void CAudioOutput::prepare() {
if (!__IsInit())
- THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Did not initialize CAudioOutput");
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Did not initialize CAudioOutput"); //LCOV_EXCL_LINE
if (__IsReady()) {
+//LCOV_EXCL_START
AUDIO_IO_LOGD("Already prepared CAudioOutput");
CAudioIO::prepare();
return;
+//LCOV_EXCL_STOP
}
/* Check invalid AudioType */
CAudioIO::prepare();
} catch (const CAudioError& e) {
+//LCOV_EXCL_START
SAFE_FINALIZE(mpPulseAudioClient);
SAFE_DELETE(mpPulseAudioClient);
internalUnlock();
throw;
+//LCOV_EXCL_STOP
} catch (const std::bad_alloc&) {
//LCOV_EXCL_START
internalUnlock();
void CAudioOutput::unprepare() {
if (!__IsInit())
- THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED,
- "Did not initialize CAudioOutput");
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, //LCOV_EXCL_LINE
+ "Did not initialize CAudioOutput"); //LCOV_EXCL_LINE
if (!__IsReady()) {
AUDIO_IO_LOGD("Already unprepared");
SAFE_DELETE(mpPulseAudioClient);
internalUnlock();
} catch (const CAudioError& e) {
+//LCOV_EXCL_START
internalUnlock();
throw;
+//LCOV_EXCL_STOP
}
CAudioIO::onStateChanged(CAudioInfo::EAudioIOState::AUDIO_IO_STATE_IDLE);
void CAudioOutput::pause() {
if (!__IsInit() || !__IsReady())
- THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED,
- "Did not initialize or prepare CAudioOutput");
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, //LCOV_EXCL_LINE
+ "Did not initialize or prepare CAudioOutput"); //LCOV_EXCL_LINE
if (CAudioIO::getState() != CAudioInfo::EAudioIOState::AUDIO_IO_STATE_RUNNING)
THROW_ERROR_MSG(CAudioError::EError::ERROR_INVALID_STATE,
"Can't pause if not in Running state");
if (mpPulseAudioClient->isInThread() )
- THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_OPERATION, "Can't pause in thread");
+ THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_OPERATION, "Can't pause in thread"); //LCOV_EXCL_LINE
CAudioIO::pause();
CAudioIO::onStateChanged(CAudioInfo::EAudioIOState::AUDIO_IO_STATE_PAUSED);
void CAudioOutput::resume() {
if (!__IsInit() || !__IsReady())
- THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED,
- "Did not initialize or prepare CAudioOutput");
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, //LCOV_EXCL_LINE
+ "Did not initialize or prepare CAudioOutput"); //LCOV_EXCL_LINE
if (CAudioIO::getState() != CAudioInfo::EAudioIOState::AUDIO_IO_STATE_PAUSED)
THROW_ERROR_MSG(CAudioError::EError::ERROR_INVALID_STATE,
"Can't resume if not in Paused state");
if (mpPulseAudioClient->isInThread())
- THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_OPERATION, "Can't resume in thread");
+ THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_OPERATION, "Can't resume in thread"); //LCOV_EXCL_LINE
CAudioIO::resume();
CAudioIO::onStateChanged(CAudioInfo::EAudioIOState::AUDIO_IO_STATE_RUNNING);
void CAudioOutput::drain() {
if (!__IsInit() || !__IsReady())
- THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED,
- "Did not initialize or prepare CAudioOutput");
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, //LCOV_EXCL_LINE
+ "Did not initialize or prepare CAudioOutput"); //LCOV_EXCL_LINE
if (mStreamCallback.onStream)
THROW_ERROR_MSG(CAudioError::EError::ERROR_INVALID_OPERATION, "async type don't support drain");
void CAudioOutput::flush() {
if (!__IsInit() || !__IsReady())
- THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED,
- "Did not initialize or prepare CAudioOutput");
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, //LCOV_EXCL_LINE
+ "Did not initialize or prepare CAudioOutput"); //LCOV_EXCL_LINE
CAudioIO::flush();
}
int CAudioOutput::getBufferSize() {
if (!__IsInit())
- THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED,
- "Did not initialize or prepare CAudioOutput");
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, //LCOV_EXCL_LINE
+ "Did not initialize or prepare CAudioOutput"); //LCOV_EXCL_LINE
/* FIXME : return calculated size here to satisfy backward compatibility */
return (mAudioInfo.getSampleRate() * DEFAULT_PERIOD_SIZE) / 1000 * mAudioInfo.getSampleSize();
size_t CAudioOutput::write(const void* buffer, size_t length) {
if (!__IsInit() || !__IsReady())
- THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED,
- "Did not initialize or prepare CAudioOutput");
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, //LCOV_EXCL_LINE
+ "Did not initialize or prepare CAudioOutput"); //LCOV_EXCL_LINE
if (!buffer)
THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT,
// If another thread did call unprepare, do not write
if (!mpPulseAudioClient)
- THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED,
- "Did not initialize CPulseAudioClient");
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, //LCOV_EXCL_LINE
+ "Did not initialize CPulseAudioClient"); //LCOV_EXCL_LINE
// Sets synchronous flag
__mIsUsedSyncWrite = true;
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");
prData.paMainloop = pa_threaded_mainloop_new();
if (!prData.paMainloop)
- THROW_ERROR_MSG(CAudioError::EError::ERROR_OUT_OF_MEMORY, "Failed pa_threaded_mainloop_new()");
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_OUT_OF_MEMORY, "Failed pa_threaded_mainloop_new()"); // LCOV_EXCL_LINE
c = pa_context_new(pa_threaded_mainloop_get_api(prData.paMainloop), CLIENT_NAME);
if (!c)
- THROW_ERROR_MSG(CAudioError::EError::ERROR_OUT_OF_MEMORY, "Failed pa_context_new()");
+ THROW_ERROR_MSG(CAudioError::EError::ERROR_OUT_OF_MEMORY, "Failed pa_context_new()"); // LCOV_EXCL_LINE
pa_context_set_state_callback(c, __contextStateChangeCb, prData.paMainloop);
pa_threaded_mainloop_lock(prData.paMainloop);
if (pa_threaded_mainloop_start(prData.paMainloop) < 0) {
+// LCOV_EXCL_START
pa_threaded_mainloop_unlock(prData.paMainloop);
- 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
}
while (true) {
auto inputHandle = static_cast<CAudioInput*>(handle->audioIoHandle);
if (!inputHandle)
- THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_HANDLE, "Handle is NULL");
+ THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_HANDLE, "Handle is NULL"); // LCOV_EXCL_LINE
inputHandle->peek(buffer, &_length);
} catch (const CAudioError& e) {
auto inputHandle = static_cast<CAudioInput*>(handle->audioIoHandle);
if (!inputHandle)
- THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_HANDLE, "Handle is NULL");
+ THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_HANDLE, "Handle is NULL"); // LCOV_EXCL_LINE
inputHandle->drop();
} catch (const CAudioError& e) {