Merge "CAudioInput/Output: Apply VoIP latency in case of VoIP audio type" into tizen accepted/tizen/unified/20181217.064613 submit/tizen/20181214.011817
authorSangchul Lee <sc11.lee@samsung.com>
Wed, 12 Dec 2018 02:53:00 +0000 (02:53 +0000)
committerGerrit Code Review <gerrit@review.ap-northeast-2.compute.internal>
Wed, 12 Dec 2018 02:53:00 +0000 (02:53 +0000)
1  2 
src/cpp/CAudioInput.cpp
src/cpp/CAudioOutput.cpp

diff --combined src/cpp/CAudioInput.cpp
@@@ -60,7 -60,7 +60,7 @@@ void CAudioInput::onStream(CPulseAudioC
       */
      if (__mIsUsedSyncRead == true) {
  #ifdef _AUDIO_IO_DEBUG_TIMING_
 -        AUDIO_IO_LOGD("Sync Read Mode! - pClient:[%p], length:[%d]", pClient, length);
 +        AUDIO_IO_LOGD("Sync Read Mode! - pClient:[%p], length:[%zu]", pClient, length);
  #endif
          return;
      }
@@@ -69,7 -69,7 +69,7 @@@
       * Accrues callback function
       */
  #ifdef _AUDIO_IO_DEBUG_TIMING_
 -    AUDIO_IO_LOGD("pClient:[%p], length:[%d]", pClient, length);
 +    AUDIO_IO_LOGD("pClient:[%p], length:[%zu]", pClient, length);
  #endif
      CAudioIO::onStream(pClient, length);
  }
@@@ -136,6 -136,10 +136,10 @@@ void CAudioInput::prepare() 
          /* Init StreamSpec */
          AUDIO_IO_LOGD("Set Stream Spec : CPulseStreamSpec::STREAM_LATENCY_INPUT_DEFAULT");
          CPulseStreamSpec::EStreamLatency streamSpec = CPulseStreamSpec::EStreamLatency::STREAM_LATENCY_INPUT_DEFAULT;
+         /* Override the default value by audio type */
+         if (audioType == CAudioInfo::EAudioType::AUDIO_IN_TYPE_VOIP)
+             streamSpec = CPulseStreamSpec::EStreamLatency::STREAM_LATENCY_INPUT_VOIP;
          CPulseStreamSpec spec(streamSpec, mAudioInfo);
  
          internalLock();
diff --combined src/cpp/CAudioOutput.cpp
@@@ -56,7 -56,7 +56,7 @@@ void CAudioOutput::onStream(CPulseAudio
       */
      if (__mIsUsedSyncWrite == true) {
  #ifdef _AUDIO_IO_DEBUG_TIMING_
 -        AUDIO_IO_LOGD("Sync Write Mode! - signal! - pClient:[%p], length:[%d]", pClient, length);
 +        AUDIO_IO_LOGD("Sync Write Mode! - signal! - pClient:[%p], length:[%zu]", pClient, length);
  #endif
          internalSignal();
          return;
@@@ -66,7 -66,7 +66,7 @@@
       * Accrues callback function
       */
  #ifdef _AUDIO_IO_DEBUG_TIMING_
 -    AUDIO_IO_LOGD("pClient:[%p], length:[%d]", pClient, length);
 +    AUDIO_IO_LOGD("pClient:[%p], length:[%zu]", pClient, length);
  #endif
      CAudioIO::onStream(pClient, length);
  }
@@@ -138,6 -138,10 +138,10 @@@ void CAudioOutput::prepare() 
              streamSpec = CPulseStreamSpec::EStreamLatency::STREAM_LATENCY_OUTPUT_DEFAULT_ASYNC;
          }
  #endif
+         /* Override the default value by audio type */
+         if (audioType == CAudioInfo::EAudioType::AUDIO_OUT_TYPE_VOIP)
+             streamSpec = CPulseStreamSpec::EStreamLatency::STREAM_LATENCY_OUTPUT_VOIP;
          CPulseStreamSpec spec(streamSpec, mAudioInfo);
  
          internalLock();
@@@ -268,7 -272,7 +272,7 @@@ size_t CAudioOutput::write(const void* 
              THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INTERNAL_OPERATION,
                                     "The written result is invalid ret:%d", ret);
  #ifdef _AUDIO_IO_DEBUG_TIMING_
 -        AUDIO_IO_LOGD("CPulseAudioClient->write(buffer:%p, length:%d)", buffer, length);
 +        AUDIO_IO_LOGD("CPulseAudioClient->write(buffer:%p, length:%zu)", buffer, length);
  #endif
          return length;
      }
  
              while ((l = mpPulseAudioClient->getWritableSize()) == 0) {
  #ifdef _AUDIO_IO_DEBUG_TIMING_
 -                AUDIO_IO_LOGD("writableSize is [%d].. wait", l);
 +                AUDIO_IO_LOGD("writableSize is [%zu].. wait", l);
  #endif
                  internalWait();
              }
                  l = lengthIter;
  
  #ifdef _AUDIO_IO_DEBUG_TIMING_
 -            AUDIO_IO_LOGD("CPulseAudioClient->write(buffer:%p, length:%d)", buffer, l);
 +            AUDIO_IO_LOGD("CPulseAudioClient->write(buffer:%p, length:%zu)", buffer, l);
  #endif
  
              int ret = mpPulseAudioClient->write(buffer, l);