Merge branch 'tizen' into tizen_line_coverage 48/191548/1
authorSeungbae Shin <seungbae.shin@samsung.com>
Thu, 18 Oct 2018 07:38:01 +0000 (16:38 +0900)
committerSeungbae Shin <seungbae.shin@samsung.com>
Thu, 18 Oct 2018 07:41:33 +0000 (16:41 +0900)
Change-Id: Ib35e0f83c76869e8471b4deed33f4f0aec3f8a72

src/audio_io.c
src/cpp/CAudioError.cpp
src/cpp/CAudioIO.cpp
src/cpp/CAudioInput.cpp
src/cpp/CAudioOutput.cpp
src/cpp/CPulseAudioClient.cpp
src/cpp/CPulseStreamSpec.cpp
src/cpp/cpp_audio_in_privilege.cpp
src/cpp/cpp_audio_io.cpp

index 17e5d31..af5ebb3 100644 (file)
@@ -118,7 +118,6 @@ int audio_in_unset_state_changed_cb(audio_in_h input)
        return cpp_audio_in_unset_state_changed_cb(input);
 }
 
-
 /* Audio Out */
 int audio_out_create_new(int sample_rate, audio_channel_e channel, audio_sample_type_e type, audio_out_h *output)
 {
index b25a63d..655c34f 100644 (file)
@@ -30,6 +30,7 @@ using namespace tizen_media_audio;
 CAudioError::EError CAudioError::__mLastError = CAudioError::EError::ERROR_NONE;
 char CAudioError::__mLastErrorMsg[CAudioError::MSG_LENGTH];
 
+//LCOV_EXCL_START
 CAudioError::CAudioError(EError err) :
     __mError(err) {
     __mLastError = __mError;
@@ -51,6 +52,7 @@ CAudioError::CAudioError(EError err, const char* fileName, const char* parentFun
 
     snprintf(__mLastErrorMsg, CAudioError::MSG_LENGTH, "LastError:%s", __mErrorMsg);
 }
+//LCOV_EXCL_STOP
 
 CAudioError::CAudioError(EError err, const char* msg, const char* fileName, const char* parentFunc, int lineNum) :
     __mError(err) {
@@ -71,10 +73,12 @@ CAudioError::CAudioError(EError err, const char* msg, const char* fileName, cons
     snprintf(__mLastErrorMsg, CAudioError::MSG_LENGTH, "LastError:%s", __mErrorMsg);
 }
 
+//LCOV_EXCL_START
 CAudioError::CAudioError(const CAudioError& err) {
     __mError = err.__mError;
     memcpy(__mErrorMsg, err.__mErrorMsg, MSG_LENGTH);
 }
+//LCOV_EXCL_STOP
 
 CAudioError::~CAudioError() {
 }
@@ -84,16 +88,19 @@ const char* CAudioError::__convertErrorToString(EError err) {
     default:
     case EError::ERROR_NONE:                return COLOR_GREEN "ERROR_NONE"               COLOR_END;
     case EError::ERROR_INVALID_ARGUMENT:    return COLOR_RED   "ERROR_INVALID_ARGUMENT"   COLOR_END;
+//LCOV_EXCL_START
     case EError::ERROR_INVALID_HANDLE:      return COLOR_RED   "ERROR_INVALID_HANDLE"     COLOR_END;
     case EError::ERROR_INVALID_SAMPLERATE:  return COLOR_RED   "ERROR_INVALID_SAMPLERATE" COLOR_END;
     case EError::ERROR_INVALID_CHANNEL:     return COLOR_RED   "ERROR_INVALID_CHANNEL"    COLOR_END;
     case EError::ERROR_INVALID_FORMAT:      return COLOR_RED   "ERROR_INVALID_FORMAT"     COLOR_END;
     case EError::ERROR_INVALID_POINTER:     return COLOR_RED   "ERROR_INVALID_POINTER"    COLOR_END;
+//LCOV_EXCL_STOP
     case EError::ERROR_INVALID_OPERATION:   return COLOR_RED   "ERROR_INVALID_OPERATION"  COLOR_END;
     case EError::ERROR_INVALID_STATE:       return COLOR_RED   "ERROR_INVALID_STATE"      COLOR_END;
     case EError::ERROR_NOT_INITIALIZED:     return COLOR_RED   "ERROR_NOT_INITIALIZED"    COLOR_END;
     case EError::ERROR_NOT_SUPPORTED:       return COLOR_RED   "ERROR_NOT_SUPPORTED"      COLOR_END;
     case EError::ERROR_NOT_SUPPORTED_TYPE:  return COLOR_RED   "ERROR_NOT_SUPPORTED_TYPE" COLOR_END;
+//LCOV_EXCL_START
     case EError::ERROR_PERMISSION_DENIED:   return COLOR_RED   "ERROR_PERMISSION_DENIED"  COLOR_END;
     case EError::ERROR_DEVICE_POLICY_RESTRICTION:   return COLOR_RED   "ERROR_DEVICE_POLICY_RESTRICTION"  COLOR_END;
     case EError::ERROR_DEVICE_NOT_OPENED:   return COLOR_RED   "ERROR_DEVICE_NOT_OPENED"  COLOR_END;
@@ -104,9 +111,11 @@ const char* CAudioError::__convertErrorToString(EError err) {
     case EError::ERROR_POLICY_BLOCKED:      return COLOR_RED   "ERROR_POLICY_BLOCKED"     COLOR_END;
     case EError::ERROR_POLICY_INTERRUPTED:  return COLOR_RED   "ERROR_POLICY_INTERRUPTED" COLOR_END;
     case EError::ERROR_POLICY_DUPLICATED:   return COLOR_RED   "ERROR_POLICY_DUPLICATED"  COLOR_END;
+//LCOV_EXCL_STOP
     }
 }
 
+//LCOV_EXCL_START
 CAudioError::EError CAudioError::getLastError() {
     return __mLastError;
 }
@@ -114,6 +123,7 @@ CAudioError::EError CAudioError::getLastError() {
 const char* CAudioError::getLastErrorMsg() {
     return __mLastErrorMsg;
 }
+//LCOV_EXCL_STOP
 
 CAudioError::EError CAudioError::getError() {
     return __mError;
@@ -123,6 +133,7 @@ const char* CAudioError::getErrorMsg() {
     return __mErrorMsg;
 }
 
+//LCOV_EXCL_START
 CAudioError& CAudioError::operator = (const EError err) {
     __mError = err;
     __mLastError = __mError;
@@ -144,6 +155,7 @@ bool CAudioError::operator != (const EError err) {
 bool CAudioError::operator == (const EError err) {
     return (__mError == err);
 }
+//LCOV_EXCL_STOP
 
 //bool operator == (const CAudioError& src, const CAudioError::EError& err) {
 //    //return (src.__mLastError == err);
index 93e192f..1d44607 100644 (file)
@@ -27,6 +27,7 @@ using namespace tizen_media_audio;
 /**
  * class CAudioIO
  */
+//LCOV_EXCL_START
 CAudioIO::CAudioIO() :
     mpPulseAudioClient(NULL),
     __mMutex(PTHREAD_MUTEX_INITIALIZER),
@@ -38,6 +39,7 @@ CAudioIO::CAudioIO() :
     mStatePrev = CAudioInfo::EAudioIOState::AUDIO_IO_STATE_NONE;
     mByPolicy = false;
 }
+//LCOV_EXCL_STOP
 
 CAudioIO::CAudioIO(CAudioInfo& audioInfo) :
     mpPulseAudioClient(NULL),
@@ -73,7 +75,7 @@ void CAudioIO::internalLock() {
         THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Doesn't initialize CAudioIO");
 
     if (pthread_mutex_lock(&__mMutex) != 0)
-        THROW_ERROR_MSG(CAudioError::EError::ERROR_INTERNAL_OPERATION, "Failed pthread_mutex_lock()");
+        THROW_ERROR_MSG(CAudioError::EError::ERROR_INTERNAL_OPERATION, "Failed pthread_mutex_lock()"); //LCOV_EXCL_LINE
 
 #ifdef _AUDIO_IO_DEBUG_TIMING_
     AUDIO_IO_LOGD(COLOR_RED "%p LOCKED" COLOR_END, &__mMutex);
@@ -85,7 +87,7 @@ void CAudioIO::internalUnlock() {
         THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Doesn't initialize CAudioIO");
 
     if (pthread_mutex_unlock(&__mMutex) != 0)
-        THROW_ERROR_MSG(CAudioError::EError::ERROR_INTERNAL_OPERATION, "Failed pthread_mutex_lock()");
+        THROW_ERROR_MSG(CAudioError::EError::ERROR_INTERNAL_OPERATION, "Failed pthread_mutex_lock()"); //LCOV_EXCL_LINE
 
 #ifdef _AUDIO_IO_DEBUG_TIMING_
     AUDIO_IO_LOGD(COLOR_GREEN "%p UNLOCKED" COLOR_END, &__mMutex);
@@ -126,11 +128,11 @@ void CAudioIO::initialize() {
 
     int ret = pthread_mutex_init(&__mMutex, NULL);
     if (ret != 0)
-        THROW_ERROR_MSG(CAudioError::EError::ERROR_OUT_OF_MEMORY, "Failed pthread_mutex_init()");
+        THROW_ERROR_MSG(CAudioError::EError::ERROR_OUT_OF_MEMORY, "Failed pthread_mutex_init()"); //LCOV_EXCL_LINE
 
     ret = pthread_cond_init(&__mCond, NULL);
     if (ret != 0)
-        THROW_ERROR_MSG(CAudioError::EError::ERROR_OUT_OF_MEMORY, "Failed pthread_cond_init()");
+        THROW_ERROR_MSG(CAudioError::EError::ERROR_OUT_OF_MEMORY, "Failed pthread_cond_init()"); //LCOV_EXCL_LINE
 
     __mIsInit = true;
 }
@@ -144,20 +146,24 @@ void CAudioIO::finalize() {
     bool error_occured = false;
     int ret = pthread_mutex_destroy(&__mMutex);
     if (ret != 0) {
-        AUDIO_IO_LOGE("Failed pthread_mutex_destroy(%p) errno:%d", &__mMutex, ret);
+        AUDIO_IO_LOGE("Failed pthread_mutex_destroy(%p) errno:%d", &__mMutex, ret); //LCOV_EXCL_LINE
         error_occured = true;
     }
 
     ret = pthread_mutex_destroy(&__mCondMutex);
     if (ret != 0) {
+//LCOV_EXCL_START
         AUDIO_IO_LOGE("Failed cond pthread_mutex_destroy(%p) errno:%d", &__mCondMutex, ret);
         error_occured = true;
+//LCOV_EXCL_STOP
     }
 
     ret = pthread_cond_destroy(&__mCond);
     if (ret != 0) {
+//LCOV_EXCL_START
         AUDIO_IO_LOGE("Failed pthread_cond_destroy(%p) errno:%d", &__mCond, ret);
         error_occured = true;
+//LCOV_EXCL_STOP
     }
 
     if (error_occured)
@@ -347,7 +353,7 @@ void CAudioIO::setStreamInfo(sound_stream_info_h stream_info) {
             THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_NOT_SUPPORTED_TYPE, "Input stream is not supported");
 
         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().convertInputStreamType2AudioType(type, &audioType);
         else
@@ -355,7 +361,7 @@ void CAudioIO::setStreamInfo(sound_stream_info_h stream_info) {
         getAudioInfo().setAudioType(audioType);
 
         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);
 
     } catch (CAudioError& e) {
index 64d2e94..c9f384c 100644 (file)
@@ -37,6 +37,7 @@ CAudioInput::CAudioInput(CAudioInfo& info) :
     mDirection = CAudioInfo::EAudioDirection::AUDIO_DIRECTION_IN;
 }
 
+//LCOV_EXCL_START
 CAudioInput::CAudioInput(
         unsigned int            sampleRate,
         CAudioInfo::EChannel    channel,
@@ -47,6 +48,7 @@ CAudioInput::CAudioInput(
     mDirection = CAudioInfo::EAudioDirection::AUDIO_DIRECTION_IN;
     mAudioInfo = CAudioInfo(sampleRate, channel, type, audioType, -1);
 }
+//LCOV_EXCL_STOP
 
 CAudioInput::~CAudioInput() {
 }
@@ -154,8 +156,10 @@ void CAudioInput::prepare() {
         internalUnlock();
         throw;
     } catch (const std::bad_alloc&) {
+//LCOV_EXCL_START
         internalUnlock();
         THROW_ERROR_MSG(CAudioError::EError::ERROR_OUT_OF_MEMORY, "Failed to allocate CPulseAudioClient object");
+//LCOV_EXCL_STOP
     }
 }
 
index f330bed..996cdc5 100644 (file)
@@ -33,6 +33,7 @@ CAudioOutput::CAudioOutput(CAudioInfo& info) :
     mDirection = CAudioInfo::EAudioDirection::AUDIO_DIRECTION_OUT;
 }
 
+//LCOV_EXCL_START
 CAudioOutput::CAudioOutput(
         unsigned int            sampleRate,
         CAudioInfo::EChannel    channel,
@@ -43,6 +44,7 @@ CAudioOutput::CAudioOutput(
     mDirection = CAudioInfo::EAudioDirection::AUDIO_DIRECTION_OUT;
     mAudioInfo = CAudioInfo(sampleRate, channel, sampleType, audioType, -1);
 }
+//LCOV_EXCL_STOP
 
 CAudioOutput::~CAudioOutput() {
 }
@@ -156,8 +158,10 @@ void CAudioOutput::prepare() {
         internalUnlock();
         throw;
     } catch (const std::bad_alloc&) {
+//LCOV_EXCL_START
         internalUnlock();
         THROW_ERROR_MSG(CAudioError::EError::ERROR_OUT_OF_MEMORY, "Failed to allocate CPulseAudioClient object");
+//LCOV_EXCL_STOP
     }
 }
 
@@ -306,8 +310,8 @@ size_t CAudioOutput::write(const void* buffer, size_t length) {
 
             int ret = mpPulseAudioClient->write(buffer, l);
             if (ret < 0)
-                THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INTERNAL_OPERATION,
-                                       "The written result is invalid ret:%d", ret);
+                THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INTERNAL_OPERATION,//LCOV_EXCL_LINE
+                                       "The written result is invalid ret:%d", ret); //LCOV_EXCL_LINE
 
             buffer = static_cast<const uint8_t*>(buffer) + l;
             lengthIter -= l;
index 0e0bb28..32a6e85 100644 (file)
@@ -84,6 +84,7 @@ void CPulseAudioClient::__contextStateChangeCb(pa_context* c, void* user_data) {
     }
 }
 
+//LCOV_EXCL_START
 void CPulseAudioClient::__successContextCb(pa_context* c, int success, void* user_data) {
     AUDIO_IO_LOGD("pa_context[%p], success[%d], user_data[%p]", c, success, user_data);
     assert(c);
@@ -113,6 +114,7 @@ static bool __is_microphone_restricted(void) {
 #endif
     return (state ? false : true);
 }
+//LCOV_EXCL_STOP
 
 void CPulseAudioClient::__streamStateChangeCb(pa_stream* s, void* user_data) {
     assert(s);
@@ -131,11 +133,13 @@ void CPulseAudioClient::__streamStateChangeCb(pa_stream* s, void* user_data) {
         break;
 
     case PA_STREAM_FAILED:
+//LCOV_EXCL_START
         AUDIO_IO_LOGD("The stream is failed");
         pClient->__mpListener->onStateChanged(CAudioInfo::EAudioIOState::AUDIO_IO_STATE_IDLE,
                                               __is_microphone_restricted());
         pa_threaded_mainloop_signal(pClient->__mpMainloop, 0);
         break;
+//LCOV_EXCL_STOP
 
     case PA_STREAM_TERMINATED:
         AUDIO_IO_LOGD("The stream is terminated");
@@ -238,6 +242,7 @@ void CPulseAudioClient::__streamUnderflowCb(pa_stream* s, void* user_data) {
     pClient->__mIsStarted = false;
 }
 
+//LCOV_EXCL_START
 void CPulseAudioClient::__streamEventCb(pa_stream* s, const char *name, pa_proplist *pl, void *user_data) {
     assert(s);
     assert(user_data);
@@ -249,7 +254,7 @@ void CPulseAudioClient::__streamEventCb(pa_stream* s, const char *name, pa_propl
         pa_operation_unref(pa_stream_cork(pClient->__mpStream, 1, NULL, NULL));
     }
 }
-
+//LCOV_EXCL_STOP
 
 void CPulseAudioClient::__successStreamCb(pa_stream* s, int success, void* user_data) {
     AUDIO_IO_LOGD("pa_stream[%p], success[%d], user_data[%p]", s, success, user_data);
@@ -262,6 +267,7 @@ void CPulseAudioClient::__successStreamCb(pa_stream* s, int success, void* user_
     pa_threaded_mainloop_signal(pClient->__mpMainloop, 0);
 }
 
+//LCOV_EXCL_START
 void CPulseAudioClient::__successDrainCbInThread(pa_stream* s, int success, void* user_data) {
     AUDIO_IO_LOGD("pa_stream[%p], success[%d], user_data[%p]", s, success, user_data);
     assert(s);
@@ -271,6 +277,7 @@ void CPulseAudioClient::__successDrainCbInThread(pa_stream* s, int success, void
     pClient->__mIsOperationSuccess = static_cast<bool>(success);
     pClient->__mIsDraining = false;
 }
+//LCOV_EXCL_STOP
 
 void CPulseAudioClient::__successDrainCb(pa_stream* s, int success, void* user_data) {
     AUDIO_IO_LOGD("pa_stream[%p], success[%d], user_data[%p]", s, success, user_data);
@@ -296,7 +303,7 @@ void CPulseAudioClient::initialize() {
         // Allocates PA proplist
         __mpPropList = pa_proplist_new();
         if (__mpPropList == NULL) {
-            THROW_ERROR_MSG(CAudioError::EError::ERROR_OUT_OF_MEMORY, "Failed pa_proplist_new()");
+            THROW_ERROR_MSG(CAudioError::EError::ERROR_OUT_OF_MEMORY, "Failed pa_proplist_new()"); //LCOV_EXCL_LINE
         }
 
         // Adds values on proplist for delivery to PULSEAUDIO
@@ -317,13 +324,13 @@ void CPulseAudioClient::initialize() {
         // Allocates PA mainloop
         __mpMainloop = pa_threaded_mainloop_new();
         if (__mpMainloop == NULL) {
-            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
         }
 
         // Allocates PA context
         __mpContext = pa_context_new(pa_threaded_mainloop_get_api(__mpMainloop), CLIENT_NAME);
         if (__mpContext == NULL) {
-            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
         }
 
         // Sets context state changed callback
@@ -331,7 +338,7 @@ void CPulseAudioClient::initialize() {
 
         // Connects this client with PA server
         if (pa_context_connect(__mpContext, NULL, PA_CONTEXT_NOFLAGS, NULL) < 0) {
-            THROW_ERROR_MSG(CAudioError::EError::ERROR_OUT_OF_MEMORY, "Failed pa_context_connect()");
+            THROW_ERROR_MSG(CAudioError::EError::ERROR_OUT_OF_MEMORY, "Failed pa_context_connect()"); //LCOV_EXCL_LINE
         }
 
         // LOCK for synchronous connection
@@ -340,7 +347,7 @@ void CPulseAudioClient::initialize() {
         // Start mainloop
         if (pa_threaded_mainloop_start(__mpMainloop) < 0) {
             pa_threaded_mainloop_unlock(__mpMainloop);
-            THROW_ERROR_MSG(CAudioError::EError::ERROR_FAILED_OPERATION, "Failed pa_threaded_mainloop_start()");
+            THROW_ERROR_MSG(CAudioError::EError::ERROR_FAILED_OPERATION, "Failed pa_threaded_mainloop_start()"); //LCOV_EXCL_LINE
         }
 
         // Connection process is asynchronously
@@ -355,9 +362,11 @@ void CPulseAudioClient::initialize() {
             }
 
             if (!PA_CONTEXT_IS_GOOD(state)) {
+//LCOV_EXCL_START
                 err = pa_context_errno(__mpContext);
                 pa_threaded_mainloop_unlock(__mpMainloop);
                 THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INTERNAL_OPERATION, "pa_context's state is not good : err[%d]", err);
+//LCOV_EXCL_STOP
             }
 
             /* Wait until the context is ready */
@@ -370,8 +379,10 @@ void CPulseAudioClient::initialize() {
 
         __mpStream = pa_stream_new_with_proplist(__mpContext, __mSpec.getStreamName(), &ss, &map, __mpPropList);
         if (__mpStream == NULL) {
+//LCOV_EXCL_START
             pa_threaded_mainloop_unlock(__mpMainloop);
             THROW_ERROR_MSG(CAudioError::EError::ERROR_FAILED_OPERATION, "Failed pa_stream_new_with_proplist()");
+//LCOV_EXCL_STOP
         }
 
         // Sets stream callbacks
@@ -410,9 +421,11 @@ void CPulseAudioClient::initialize() {
         }
 
         if (ret != 0) {
+//LCOV_EXCL_START
             err = pa_context_errno(__mpContext);
             pa_threaded_mainloop_unlock(__mpMainloop);
             THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_FAILED_OPERATION, "Failed pa_stream_connect() : err[%d]", err);
+//LCOV_EXCL_STOP
         }
 
         while (true) {
@@ -430,7 +443,7 @@ void CPulseAudioClient::initialize() {
                 if (err == PA_ERR_ACCESS) {
                     THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_DEVICE_POLICY_RESTRICTION, "pa_stream's state is not good : err[%d]", err);
                 } else {
-                    THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INTERNAL_OPERATION, "pa_stream's state is not good : err[%d]", err);
+                    THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INTERNAL_OPERATION, "pa_stream's state is not good : err[%d]", err); //LCOV_EXCL_LINE
                 }
             }
 
@@ -547,7 +560,7 @@ int CPulseAudioClient::read(void* buffer, size_t length) {
                     // 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);
+                        THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INTERNAL_OPERATION, "Failed pa_stream_drop() : ret[%d]", ret); //LCOV_EXCL_LINE
                     }
                 } else {
                     __mSyncReadIndex = 0;
@@ -580,7 +593,7 @@ int CPulseAudioClient::read(void* buffer, size_t length) {
 #endif
                 ret = pa_stream_drop(__mpStream);
                 if (ret != 0) {
-                    THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INTERNAL_OPERATION, "Failed pa_stream_drop() : ret[%d]", ret);
+                    THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INTERNAL_OPERATION, "Failed pa_stream_drop() : ret[%d]", ret); //LCOV_EXCL_LINE
                 }
 
                 // Reset the internal pointer
@@ -631,7 +644,7 @@ int CPulseAudioClient::peek(const void** buffer, size_t* length) {
 #endif
 
     if (ret < 0) {
-        THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_FAILED_OPERATION, "Failed pa_stream_peek() : err[%d]", ret);
+        THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_FAILED_OPERATION, "Failed pa_stream_peek() : err[%d]", ret); //LCOV_EXCL_LINE
     }
 
     return ret;
@@ -663,7 +676,7 @@ int CPulseAudioClient::drop() {
     }
 
     if (ret < 0) {
-        THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_FAILED_OPERATION, "Failed pa_stream_drop() : err[%d]", ret);
+        THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_FAILED_OPERATION, "Failed pa_stream_drop() : err[%d]", ret); //LCOV_EXCL_LINE
     }
 
     return ret;
@@ -712,7 +725,7 @@ int CPulseAudioClient::write(const void* data, size_t length) {
     }
 
     if (ret < 0) {
-        THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_FAILED_OPERATION, "Failed pa_stream_write() : err[%d]", ret);
+        THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_FAILED_OPERATION, "Failed pa_stream_write() : err[%d]", ret); //LCOV_EXCL_LINE
     }
 
     return ret;
@@ -880,6 +893,7 @@ bool CPulseAudioClient::isInThread() {
     return static_cast<bool>(ret);
 }
 
+//LCOV_EXCL_START
 size_t CPulseAudioClient::getReadableSize() {
     if (__mIsInit == false) {
         THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Did not initialize CPulseAudioClient");
@@ -1048,3 +1062,4 @@ CPulseAudioClient::EStreamDirection CPulseAudioClient::getStreamDirection() {
 CPulseStreamSpec CPulseAudioClient::getStreamSpec() {
     return __mSpec;
 }
+//LCOV_EXCL_STOP
index 92dc4c8..2702130 100644 (file)
@@ -42,12 +42,13 @@ static const char* STREAM_LATENCY_VOIP    = "voip";
 static const char* STREAM_LATENCY_DEFAULT = "default";
 static const char* STREAM_LATENCY_DEFAULT_ASYNC = "default-async";
 
-
+//LCOV_EXCL_START
 CPulseStreamSpec::CPulseStreamSpec():
     __mLatency(EStreamLatency::STREAM_LATENCY_INPUT_DEFAULT),
     __mStreamName(NULL) {
     __adjustSpec();
 }
+//LCOV_EXCL_STOP
 
 CPulseStreamSpec::CPulseStreamSpec(EStreamLatency latency, CAudioInfo& audioInfo) :
     __mLatency(latency),
@@ -56,12 +57,14 @@ CPulseStreamSpec::CPulseStreamSpec(EStreamLatency latency, CAudioInfo& audioInfo
     __adjustSpec();
 }
 
+//LCOV_EXCL_START
 CPulseStreamSpec::CPulseStreamSpec(EStreamLatency latency, CAudioInfo& audioInfo, int customLatency) :
     __mLatency(latency),
     __mAudioInfo(audioInfo),
     __mStreamName(NULL) {
     __adjustSpec();
 }
+//LCOV_EXCL_STOP
 
 CPulseStreamSpec::~CPulseStreamSpec() {
 }
@@ -110,6 +113,7 @@ void CPulseStreamSpec::__adjustSpec() {
 
     // Sets stream name
     switch (__mLatency) {
+//LCOV_EXCL_START
     case EStreamLatency::STREAM_LATENCY_INPUT_LOW:
         __mStreamName = STREAM_NAME_INPUT_LOW_LATENCY;
         break;
@@ -125,11 +129,13 @@ void CPulseStreamSpec::__adjustSpec() {
     case EStreamLatency::STREAM_LATENCY_INPUT_VOIP:
         __mStreamName = STREAM_NAME_INPUT_VOIP;
         break;
+//LCOV_EXCL_STOP
 
     case EStreamLatency::STREAM_LATENCY_INPUT_DEFAULT:
         __mStreamName = STREAM_NAME_INPUT_DEFAULT;
         break;
 
+//LCOV_EXCL_START
     case EStreamLatency::STREAM_LATENCY_OUTPUT_LOW:
         __mStreamName = STREAM_NAME_OUTPUT_LOW_LATENCY;
         break;
@@ -145,6 +151,7 @@ void CPulseStreamSpec::__adjustSpec() {
     case EStreamLatency::STREAM_LATENCY_OUTPUT_VOIP:
         __mStreamName = STREAM_NAME_OUTPUT_VOIP;
         break;
+//LCOV_EXCL_STOP
 
     case EStreamLatency::STREAM_LATENCY_OUTPUT_DEFAULT:
         __mStreamName = STREAM_NAME_OUTPUT_DEFAULT;
@@ -154,10 +161,12 @@ void CPulseStreamSpec::__adjustSpec() {
         __mStreamName = STREAM_NAME_OUTPUT_DEFAULT_ASYNC;
         break;
 
+//LCOV_EXCL_START
     default:
         AUDIO_IO_LOGW("Invalid __mLatency[%d]", static_cast<int>(__mLatency));
         break;
     }
+//LCOV_EXCL_STOP
 }
 
 CPulseStreamSpec::EStreamLatency CPulseStreamSpec::getStreamLatency() {
@@ -168,6 +177,7 @@ const char* CPulseStreamSpec::getStreamLatencyToString() {
     const char* latency;
 
     switch (__mLatency) {
+//LCOV_EXCL_START
     case EStreamLatency::STREAM_LATENCY_INPUT_LOW:
     case EStreamLatency::STREAM_LATENCY_OUTPUT_LOW:
         latency = STREAM_LATENCY_LOW;
@@ -187,6 +197,7 @@ const char* CPulseStreamSpec::getStreamLatencyToString() {
     case EStreamLatency::STREAM_LATENCY_OUTPUT_VOIP:
         latency = STREAM_LATENCY_VOIP;
         break;
+//LCOV_EXCL_STOP
 
     case EStreamLatency::STREAM_LATENCY_INPUT_DEFAULT:
     case EStreamLatency::STREAM_LATENCY_OUTPUT_DEFAULT:
@@ -197,10 +208,12 @@ const char* CPulseStreamSpec::getStreamLatencyToString() {
         latency = STREAM_LATENCY_DEFAULT_ASYNC;
         break;
 
+//LCOV_EXCL_START
     default:
         AUDIO_IO_LOGW("Invalid __mLatency[%d]", static_cast<int>(__mLatency));
         latency = STREAM_LATENCY_DEFAULT;
         break;
+//LCOV_EXCL_STOP
     }
 
     return latency;
index ae914ca..d8a56c0 100644 (file)
@@ -75,22 +75,22 @@ bool cpp_audio_in_has_record_privilege(void) {
 
     prData.paMainloop = pa_threaded_mainloop_new();
     if (prData.paMainloop == NULL)
-        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 == NULL)
-        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);
 
     if (pa_context_connect(c, NULL, PA_CONTEXT_NOFLAGS, NULL) < 0)
-        THROW_ERROR_MSG(CAudioError::EError::ERROR_OUT_OF_MEMORY, "Failed pa_context_connect()");
+        THROW_ERROR_MSG(CAudioError::EError::ERROR_OUT_OF_MEMORY, "Failed pa_context_connect()"); //LCOV_EXCL_LINE
 
     pa_threaded_mainloop_lock(prData.paMainloop);
 
     if (pa_threaded_mainloop_start(prData.paMainloop) < 0) {
         pa_threaded_mainloop_unlock(prData.paMainloop);
-        THROW_ERROR_MSG(CAudioError::EError::ERROR_FAILED_OPERATION, "Failed pa_threaded_mainloop_start()");
+        THROW_ERROR_MSG(CAudioError::EError::ERROR_FAILED_OPERATION, "Failed pa_threaded_mainloop_start()"); //LCOV_EXCL_LINE
     }
 
     while (true) {
@@ -101,10 +101,12 @@ bool cpp_audio_in_has_record_privilege(void) {
             break;
 
         if (!PA_CONTEXT_IS_GOOD(state)) {
+//LCOV_EXCL_START
             err = pa_context_errno(c);
             pa_threaded_mainloop_unlock(prData.paMainloop);
             THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INTERNAL_OPERATION,
                                    "pa_context's state is not good : err[%d]", err);
+//LCOV_EXCL_STOP
         }
 
         /* Wait until the context is ready */
@@ -113,8 +115,10 @@ bool cpp_audio_in_has_record_privilege(void) {
 
     o = pa_context_check_privilege(c, RECORDER_PRIVILEGE, __checkPrivilegeCb, &prData);
     if (!o) {
+//LCOV_EXCL_START
         pa_threaded_mainloop_unlock(prData.paMainloop);
         THROW_ERROR_MSG(CAudioError::EError::ERROR_FAILED_OPERATION, "Failed to pa_context_check_privilege()");
+//LCOV_EXCL_STOP
     }
     while (pa_operation_get_state(o) == PA_OPERATION_RUNNING)
         pa_threaded_mainloop_wait(prData.paMainloop);
index d1717b8..fe55652 100644 (file)
@@ -390,10 +390,12 @@ int cpp_audio_in_create(int sample_rate, audio_channel_e channel, audio_sample_t
         __handle_safe_free(handle, (void *)input, false);
         return __convert_CAudioError(e);
     } catch (const std::bad_alloc&) {
+//LCOV_EXCL_START
         CAudioError e = CAudioError::EError::ERROR_OUT_OF_MEMORY;
         AUDIO_IO_LOGE("Failed to allocate handle");
         __handle_safe_free(handle, (void *)input, false);
         return __convert_CAudioError(e);
+//LCOV_EXCL_STOP
     }
 
     return AUDIO_IO_ERROR_NONE;
@@ -671,6 +673,7 @@ static void __stream_cb_internal(size_t nbytes, void *user_data) {
         audioIo->stream_callback.onStream(audioIo, nbytes, audioIo->stream_callback.user_data);
 }
 
+//LCOV_EXCL_START
 static void __state_changed_cb_internal(CAudioInfo::EAudioIOState state,
                                         CAudioInfo::EAudioIOState state_prev,
                                         bool by_policy,
@@ -683,6 +686,7 @@ static void __state_changed_cb_internal(CAudioInfo::EAudioIOState state,
                                                        __convert_state_type(state), by_policy,
                                                        audioIo->state_changed_callback.user_data);
 }
+//LCOV_EXCL_STOP
 
 int cpp_audio_in_set_stream_cb(audio_in_h input, audio_in_stream_cb callback, void* user_data) {
     audio_io_s* handle = static_cast<audio_io_s*>(input);
@@ -868,10 +872,12 @@ int cpp_audio_out_create_new(int sample_rate, audio_channel_e channel, audio_sam
         __handle_safe_free(handle, (void *)output, true);
         return __convert_CAudioError(e);
     } catch (const std::bad_alloc&) {
+//LCOV_EXCL_START
         CAudioError e = CAudioError::EError::ERROR_OUT_OF_MEMORY;
         AUDIO_IO_LOGE("Failed to allocate handle");
         __handle_safe_free(handle, (void *)output, true);
         return __convert_CAudioError(e);
+//LCOV_EXCL_STOP
     }
 
     return AUDIO_IO_ERROR_NONE;