Reduce continous latency during frame write

Signed-off-by: Anurup M <anurup.m@huawei.com>
This commit is contained in:
Anurup M 2022-03-16 18:02:50 +05:30
parent b178e4da6b
commit e9657a6d05
3 changed files with 22 additions and 4 deletions

View File

@ -55,6 +55,10 @@ config("audio_client_public_config") {
"-Werror",
]
if ("${product_name}" == "m40") {
cflags += [ "-DPRODUCT_M40" ]
}
if (target_cpu == "arm") {
cflags += [ "-DBINDER_IPC_32BIT" ]
}

View File

@ -496,7 +496,7 @@ private:
const void *internalReadBuffer;
size_t internalRdBufLen;
size_t internalRdBufIndex;
size_t setBufferSize = MINIMUM_BUFFER_SIZE;
size_t setBufferSize;
int32_t streamCmdStatus;
int32_t streamDrainStatus;
int32_t streamFlushStatus;

View File

@ -33,8 +33,12 @@ namespace AudioStandard {
AudioRendererCallbacks::~AudioRendererCallbacks() = default;
AudioCapturerCallbacks::~AudioCapturerCallbacks() = default;
const uint32_t CHECK_UTIL_SUCCESS = 0;
#ifdef PRODUCT_M40
const uint64_t LATENCY_IN_MSEC = 45UL;
#else
const uint64_t LATENCY_IN_MSEC = 50UL;
#endif
const uint32_t CHECK_UTIL_SUCCESS = 0;
const uint32_t READ_TIMEOUT_IN_SEC = 5;
const uint32_t DOUBLE_VALUE = 2;
const uint32_t MAX_LENGTH_FACTOR = 5;
@ -414,6 +418,7 @@ AudioServiceClient::AudioServiceClient()
acache.totalCacheSize = 0;
acache.buffer = nullptr;
setBufferSize = 0;
PAStreamCorkSuccessCb = PAStreamStopSuccessCb;
}
@ -491,6 +496,7 @@ void AudioServiceClient::ResetPAAudioClient()
acache.isFull = false;
acache.totalCacheSize = 0;
setBufferSize = 0;
PAStreamCorkSuccessCb = nullptr;
}
@ -1445,7 +1451,11 @@ int32_t AudioServiceClient::GetMinimumBufferSize(size_t &minBufferSize) const
if (renderMode_ == RENDER_MODE_CALLBACK) {
minBufferSize = (size_t)bufferAttr->minreq;
} else {
minBufferSize = setBufferSize;
if (setBufferSize) {
minBufferSize = setBufferSize;
} else {
minBufferSize = (size_t)bufferAttr->minreq;
}
}
}
@ -1475,7 +1485,11 @@ int32_t AudioServiceClient::GetMinimumFrameCount(uint32_t &frameCount) const
if (renderMode_ == RENDER_MODE_CALLBACK) {
minBufferSize = (size_t)bufferAttr->minreq;
} else {
minBufferSize = setBufferSize;
if (setBufferSize) {
minBufferSize = setBufferSize;
} else {
minBufferSize = (size_t)bufferAttr->minreq;
}
}
}