audio-io uses new 'default' latency configuration. 57/108457/3
authorKimJeongYeon <jeongyeon.kim@samsung.com>
Thu, 8 Dec 2016 01:31:59 +0000 (10:31 +0900)
committerJeongYeon Kim <jeongyeon.kim@samsung.com>
Thu, 5 Jan 2017 05:06:07 +0000 (21:06 -0800)
To provide backward compatibility, prebuf use -1.

[Version] 0.3.49
[Profile] Common
[Issue Type] Improves

Signed-off-by: KimJeongYeon <jeongyeon.kim@samsung.com>
Change-Id: I5425d10044ada179cccc012f687477c92785a617

include/CPulseStreamSpec.h
packaging/capi-media-audio-io.spec
src/cpp/CAudioInput.cpp
src/cpp/CAudioOutput.cpp
src/cpp/CPulseAudioClient.cpp
src/cpp/CPulseStreamSpec.cpp

index 1c75259a27719e43a0fd716502bb7f3580ade8cd..0e9cf09dd4688153f6184b901ce329d4be121a14 100644 (file)
@@ -38,10 +38,12 @@ namespace tizen_media_audio {
             STREAM_LATENCY_INPUT_MID,
             STREAM_LATENCY_INPUT_HIGH,
             STREAM_LATENCY_INPUT_VOIP,
+            STREAM_LATENCY_INPUT_DEFAULT,
             STREAM_LATENCY_OUTPUT_LOW,
             STREAM_LATENCY_OUTPUT_MID,
             STREAM_LATENCY_OUTPUT_HIGH,
             STREAM_LATENCY_OUTPUT_VOIP,
+            STREAM_LATENCY_OUTPUT_DEFAULT,
             STREAM_LATENCY_MAX
         };
 
index d5dca2721e2a4fad506bbc49ffe9a630c8e073dd..5346f2b343a98e6c26d5d2897b77b92fe66c237f 100644 (file)
@@ -1,6 +1,6 @@
 Name:           capi-media-audio-io
 Summary:        An Audio Input & Audio Output library in Tizen Native API
-Version:        0.3.48
+Version:        0.3.49
 Release:        0
 Group:          Multimedia/API
 License:        Apache-2.0
index 919cecd3b12bfe200f8a5442282ba6b948eeca56..4cee3e17c10c2ad815a448544cb250ce698405b2 100644 (file)
@@ -260,8 +260,8 @@ void CAudioInput::prepare() throw(CAudioError) {
         }
 
         // Init StreamSpec
-        AUDIO_IO_LOGD("Set Stream Spec : CPulseStreamSpec::STREAM_LATENCY_INPUT_MID");
-        CPulseStreamSpec::EStreamLatency streamSpec = CPulseStreamSpec::EStreamLatency::STREAM_LATENCY_INPUT_MID;
+        AUDIO_IO_LOGD("Set Stream Spec : CPulseStreamSpec::STREAM_LATENCY_INPUT_DEFAULT");
+        CPulseStreamSpec::EStreamLatency streamSpec = CPulseStreamSpec::EStreamLatency::STREAM_LATENCY_INPUT_DEFAULT;
         CPulseStreamSpec spec(streamSpec, mAudioInfo);
 
         // Create PulseAudio Handler
index 267ba9593a9cfb59b0fc7af845b29475f024dc91..ae33c403346c37fd5cb50a0fc1a3bf8caaed4cd6 100644 (file)
@@ -159,8 +159,8 @@ void CAudioOutput::prepare() throw(CAudioError) {
         }
 
         // Init StreamSpec
-        AUDIO_IO_LOGD("Set Stream Spec : CPulseStreamSpec::STREAM_LATENCY_OUTPUT_MID");
-        CPulseStreamSpec::EStreamLatency streamSpec = CPulseStreamSpec::EStreamLatency::STREAM_LATENCY_OUTPUT_MID;
+        AUDIO_IO_LOGD("Set Stream Spec : CPulseStreamSpec::STREAM_LATENCY_OUTPUT_DEFAULT");
+        CPulseStreamSpec::EStreamLatency streamSpec = CPulseStreamSpec::EStreamLatency::STREAM_LATENCY_OUTPUT_DEFAULT;
         CPulseStreamSpec spec(streamSpec, mAudioInfo);
 
         // Create PulseAudio Handler
index bfe72b28a420053e36dc3d8088df00fbb3e8824b..fe28ea9a96d84c7ecde34fee6b5e07006cc31699 100644 (file)
@@ -162,17 +162,6 @@ void CPulseAudioClient::__streamPlaybackCb(pa_stream* s, size_t length, void* us
     CPulseAudioClient* pClient = static_cast<CPulseAudioClient*>(user_data);
     assert(pClient->__mpListener);
 
-    if (pClient->__mIsInit == false) {
-        AUDIO_IO_LOGD("Occurred this listener when an out stream is on the way to create : Write dummy, length[%d]", length);
-
-        char* dummy = new char[length];
-        memset(dummy, 0, length);
-        pa_stream_write(s, dummy, length, NULL, 0LL, PA_SEEK_RELATIVE);
-        delete [] dummy;
-
-        return;
-    }
-
     pClient->__mpListener->onStream(pClient, length);
 }
 
@@ -563,12 +552,6 @@ int CPulseAudioClient::drop() throw(CAudioError) {
 }
 
 int CPulseAudioClient::write(const void* data, size_t length) throw(CAudioError) {
-    if (__mIsInit == false) {
-        THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Did not initialize CPulseAudioClient");
-    }
-
-    checkRunningState();
-
     if (data == NULL) {
         THROW_ERROR_MSG(CAudioError::EError::ERROR_INVALID_ARGUMENT, "The parameter is invalid");
     }
@@ -712,10 +695,6 @@ size_t CPulseAudioClient::getWritableSize() throw(CAudioError) {
 }
 
 void CPulseAudioClient::checkRunningState() throw(CAudioError) {
-    if (__mIsInit == false) {
-        THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Did not initialize CPulseAudioClient");
-    }
-
     if (__mpContext == NULL || PA_CONTEXT_IS_GOOD(pa_context_get_state(__mpContext)) == 0) {
         THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_NOT_INITIALIZED, "The context[%p] is not created or not good state", __mpContext);
     }
@@ -732,10 +711,6 @@ void CPulseAudioClient::checkRunningState() throw(CAudioError) {
 }
 
 bool CPulseAudioClient::isInThread() throw(CAudioError) {
-    if (__mIsInit == false) {
-        THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Did not initialize CPulseAudioClient");
-    }
-
     int ret = pa_threaded_mainloop_in_thread(__mpMainloop);
 
 #ifdef _AUDIO_IO_DEBUG_TIMING_
index 0e7f8a4fdc4329cfe2cdbed2a14876f804c539e6..7ce3092cf906298db9a8f0f797065fc308086665 100644 (file)
@@ -22,24 +22,27 @@ using namespace std;
 using namespace tizen_media_audio;
 
 
-static const char* STREAM_NAME_INPUT               = "CAPTURE";
 static const char* STREAM_NAME_INPUT_LOW_LATENCY   = "LOW LATENCY CAPTURE";
+static const char* STREAM_NAME_INPUT_MID_LATENCY   = "MID LATENCY CAPTURE";
 static const char* STREAM_NAME_INPUT_HIGH_LATENCY  = "HIGH LATENCY CAPTURE";
 static const char* STREAM_NAME_INPUT_VOIP          = "VOIP CAPTURE";
+static const char* STREAM_NAME_INPUT_DEFAULT       = "DEFAULT CAPTURE";
 
-static const char* STREAM_NAME_OUTPUT              = "PLAYBACK";
 static const char* STREAM_NAME_OUTPUT_LOW_LATENCY  = "LOW LATENCY PLAYBACK";
+static const char* STREAM_NAME_OUTPUT_MID_LATENCY  = "MID LATENCY PLAYBACK";
 static const char* STREAM_NAME_OUTPUT_HIGH_LATENCY = "HIGH LATENCY PLAYBACK";
 static const char* STREAM_NAME_OUTPUT_VOIP         = "VOIP PLAYBACK";
+static const char* STREAM_NAME_OUTPUT_DEFAULT      = "DEFAULT PLAYBACK";
 
-static const char* STREAM_LATENCY_LOW  = "low";
-static const char* STREAM_LATENCY_MID  = "mid";
-static const char* STREAM_LATENCY_HIGH = "high";
-static const char* STREAM_LATENCY_VOIP = "voip";
+static const char* STREAM_LATENCY_LOW     = "low";
+static const char* STREAM_LATENCY_MID     = "mid";
+static const char* STREAM_LATENCY_HIGH    = "high";
+static const char* STREAM_LATENCY_VOIP    = "voip";
+static const char* STREAM_LATENCY_DEFAULT = "default";
 
 
 CPulseStreamSpec::CPulseStreamSpec() throw(CAudioError) :
-    __mLatency(EStreamLatency::STREAM_LATENCY_INPUT_MID),
+    __mLatency(EStreamLatency::STREAM_LATENCY_INPUT_DEFAULT),
     __mStreamName(NULL) {
     __adjustSpec();
 }
@@ -94,37 +97,48 @@ void CPulseStreamSpec::__adjustSpec() throw(CAudioError) {
 
     // Sets stream name
     switch (__mLatency) {
-    case EStreamLatency::STREAM_LATENCY_OUTPUT_MID:
-        __mStreamName = STREAM_NAME_OUTPUT;
+    case EStreamLatency::STREAM_LATENCY_INPUT_LOW:
+        __mStreamName = STREAM_NAME_INPUT_LOW_LATENCY;
         break;
 
-    case EStreamLatency::STREAM_LATENCY_OUTPUT_HIGH:
-        __mStreamName = STREAM_NAME_OUTPUT_HIGH_LATENCY;
+    case EStreamLatency::STREAM_LATENCY_INPUT_MID:
+        __mStreamName = STREAM_NAME_INPUT_MID_LATENCY;
+        break;
+
+    case EStreamLatency::STREAM_LATENCY_INPUT_HIGH:
+        __mStreamName = STREAM_NAME_INPUT_HIGH_LATENCY;
+        break;
+
+    case EStreamLatency::STREAM_LATENCY_INPUT_VOIP:
+        __mStreamName = STREAM_NAME_INPUT_VOIP;
+        break;
+
+    case EStreamLatency::STREAM_LATENCY_INPUT_DEFAULT:
+        __mStreamName = STREAM_NAME_INPUT_DEFAULT;
         break;
 
     case EStreamLatency::STREAM_LATENCY_OUTPUT_LOW:
         __mStreamName = STREAM_NAME_OUTPUT_LOW_LATENCY;
         break;
 
-    case EStreamLatency::STREAM_LATENCY_OUTPUT_VOIP:
-        __mStreamName = STREAM_NAME_OUTPUT_VOIP;
+    case EStreamLatency::STREAM_LATENCY_OUTPUT_MID:
+        __mStreamName = STREAM_NAME_OUTPUT_MID_LATENCY;
         break;
 
-    case EStreamLatency::STREAM_LATENCY_INPUT_HIGH:
-        __mStreamName = STREAM_NAME_INPUT_HIGH_LATENCY;
+    case EStreamLatency::STREAM_LATENCY_OUTPUT_HIGH:
+        __mStreamName = STREAM_NAME_OUTPUT_HIGH_LATENCY;
         break;
 
-    case EStreamLatency::STREAM_LATENCY_INPUT_LOW:
-        __mStreamName = STREAM_NAME_INPUT_LOW_LATENCY;
+    case EStreamLatency::STREAM_LATENCY_OUTPUT_VOIP:
+        __mStreamName = STREAM_NAME_OUTPUT_VOIP;
         break;
 
-    case EStreamLatency::STREAM_LATENCY_INPUT_VOIP:
-        __mStreamName = STREAM_NAME_INPUT_VOIP;
+    case EStreamLatency::STREAM_LATENCY_OUTPUT_DEFAULT:
+        __mStreamName = STREAM_NAME_OUTPUT_DEFAULT;
         break;
 
-    case EStreamLatency::STREAM_LATENCY_INPUT_MID:
     default:
-        __mStreamName = STREAM_NAME_INPUT;
+        AUDIO_IO_LOGW("Invalid __mLatency[%d]", __mLatency);
         break;
     }
 }
@@ -141,20 +155,30 @@ const char* CPulseStreamSpec::getStreamLatencyToString() {
     case EStreamLatency::STREAM_LATENCY_OUTPUT_LOW:
         latency = STREAM_LATENCY_LOW;
         break;
+
     case EStreamLatency::STREAM_LATENCY_INPUT_MID:
     case EStreamLatency::STREAM_LATENCY_OUTPUT_MID:
         latency = STREAM_LATENCY_MID;
         break;
+
     case EStreamLatency::STREAM_LATENCY_INPUT_HIGH:
     case EStreamLatency::STREAM_LATENCY_OUTPUT_HIGH:
         latency = STREAM_LATENCY_HIGH;
         break;
+
     case EStreamLatency::STREAM_LATENCY_INPUT_VOIP:
     case EStreamLatency::STREAM_LATENCY_OUTPUT_VOIP:
         latency = STREAM_LATENCY_VOIP;
         break;
+
+    case EStreamLatency::STREAM_LATENCY_INPUT_DEFAULT:
+    case EStreamLatency::STREAM_LATENCY_OUTPUT_DEFAULT:
+        latency = STREAM_LATENCY_DEFAULT;
+        break;
+
     default:
-        latency = STREAM_LATENCY_MID;
+        AUDIO_IO_LOGW("Invalid __mLatency[%d]", __mLatency);
+        latency = STREAM_LATENCY_DEFAULT;
         break;
     }