coverity fixes

Signed-off-by: Geevarghese V K <geevarghese.v.k1@huawei.com>
This commit is contained in:
Geevarghese V K
2022-06-21 18:48:46 +05:30
parent 8e9af80596
commit a5c6d5e290
7 changed files with 24 additions and 13 deletions
@@ -68,7 +68,7 @@ private:
struct AudioManager *audioManager_;
struct AudioAdapter *audioAdapter_;
struct AudioRender *audioRender_;
struct AudioPort audioPort_;
struct AudioPort audioPort_ = {};
int32_t CreateRender(struct AudioPort &renderPort);
int32_t InitAudioManager();
@@ -60,7 +60,7 @@ private:
struct HDI::Audio_Bluetooth::AudioProxyManager *audioManager_;
struct HDI::Audio_Bluetooth::AudioAdapter *audioAdapter_;
struct HDI::Audio_Bluetooth::AudioRender *audioRender_;
struct HDI::Audio_Bluetooth::AudioPort audioPort;
struct HDI::Audio_Bluetooth::AudioPort audioPort = {};
void *handle_;
int32_t CreateRender(struct HDI::Audio_Bluetooth::AudioPort &renderPort);
@@ -83,7 +83,7 @@ private:
std::atomic<bool> isWriteInProgress_;
bool resetTime_;
uint64_t resetTimestamp_;
struct timespec baseTimestamp_;
struct timespec baseTimestamp_ = {0};
AudioRenderMode renderMode_;
AudioCaptureMode captureMode_;
std::queue<BufferDesc> freeBufferQ_;
@@ -227,14 +227,17 @@ static void thread_func(void *userdata)
now = pa_rtclock_now();
AUDIO_DEBUG_LOG("HDI Source: now: %{public}" PRIu64 " timer_elapsed: %{public}d", now, timer_elapsed);
if (timer_elapsed && (chunk.length = pa_usec_to_bytes(now - u->timestamp, &u->source->sample_spec)) > 0) {
ret = get_capturer_frame_from_hdi(&chunk, u);
if (ret != 0) {
break;
}
if (timer_elapsed) {
chunk.length = pa_usec_to_bytes(now - u->timestamp, &u->source->sample_spec);
if (chunk.length > 0) {
ret = get_capturer_frame_from_hdi(&chunk, u);
if (ret != 0) {
break;
}
u->timestamp += pa_bytes_to_usec(chunk.length, &u->source->sample_spec);
AUDIO_DEBUG_LOG("HDI Source: new u->timestamp : %{public}" PRIu64, u->timestamp);
u->timestamp += pa_bytes_to_usec(chunk.length, &u->source->sample_spec);
AUDIO_DEBUG_LOG("HDI Source: new u->timestamp : %{public}" PRIu64, u->timestamp);
}
}
pa_rtpoll_set_timer_absolute(u->rtpoll, u->timestamp + u->block_usec);