Enable dummy write on streamCb only for async mode backward compatibility
[platform/core/api/audio-io.git] / src / cpp / CAudioOutput.cpp
index b4aeb8a..f96f78f 100644 (file)
@@ -224,9 +224,7 @@ void CAudioOutput::unprepare() {
     try {
         if (mpAudioSessionHandler->getId() >= 0 && !mIsInterrupted) {
             if (isForceIgnore() == false && mpAudioSessionHandler->isSkipSession() == false) {
-                CPulseStreamSpec::EStreamLatency streamSpec;
-                streamSpec = mpPulseAudioClient->getStreamSpec().getStreamLatency();
-                if (CPulseStreamSpec::EStreamLatency::STREAM_LATENCY_OUTPUT_DEFAULT_ASYNC != streamSpec)
+                if (mStreamCallback.onStream == NULL)
                     CAudioIO::drain();
             }
         }
@@ -305,15 +303,12 @@ void CAudioOutput::resume() {
 }
 
 void CAudioOutput::drain() {
-    CPulseStreamSpec::EStreamLatency streamSpec;
-
     if (__IsInit() == false || __IsReady() == false) {
         THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED,
                         "Did not initialize or prepare CAudioOutput");
     }
 
-    streamSpec = mpPulseAudioClient->getStreamSpec().getStreamLatency();
-    if (CPulseStreamSpec::EStreamLatency::STREAM_LATENCY_OUTPUT_DEFAULT_ASYNC == streamSpec)
+    if (mStreamCallback.onStream)
         THROW_ERROR_MSG(CAudioError::EError::ERROR_INVALID_OPERATION, "async type don't support drain");
 
     try {