mirror of
https://github.com/openharmony/multimedia_audio_standard.git
synced 2026-07-21 06:35:28 -04:00
coverity fixes
Signed-off-by: Geevarghese V K <geevarghese.v.k1@huawei.com>
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -106,7 +106,7 @@ private:
|
||||
|
||||
bool isMainLoopStarted;
|
||||
bool isContextConnected;
|
||||
AudioData audioData_;
|
||||
AudioData audioData_ = {};
|
||||
|
||||
int32_t ConnectStreamToPA();
|
||||
void ResetPAAudioDump();
|
||||
|
||||
@@ -302,7 +302,7 @@ void AudioServiceDump::PlaybackStreamDump(std::string &dumpString)
|
||||
AppendFormat(dumpString, "Stream Id: %s\n", (sinkInputInfo.sessionId).c_str());
|
||||
AppendFormat(dumpString, "Application Name: %s\n", ((sinkInputInfo.applicationName).c_str()));
|
||||
AppendFormat(dumpString, "Process Id: %s\n", (sinkInputInfo.processId).c_str());
|
||||
AppendFormat(dumpString, "User Id: %d\n", sinkInputInfo.userId);
|
||||
AppendFormat(dumpString, "User Id: %u\n", sinkInputInfo.userId);
|
||||
|
||||
char *inputSampleSpec = pa_sample_spec_snprint(s, sizeof(s), &(sinkInputInfo.sampleSpec));
|
||||
AppendFormat(dumpString, "Stream Configuration: %s\n", inputSampleSpec);
|
||||
|
||||
@@ -611,7 +611,15 @@ void AudioServiceClient::SetEnv()
|
||||
void AudioServiceClient::SetApplicationCachePath(const std::string cachePath)
|
||||
{
|
||||
AUDIO_DEBUG_LOG("SetApplicationCachePath in");
|
||||
cachePath_ = cachePath;
|
||||
|
||||
char realPath[PATH_MAX] = {0x00};
|
||||
|
||||
if ((strlen(cachePath.c_str()) >= PATH_MAX) || (realpath(cachePath.c_str(), realPath) == nullptr)) {
|
||||
AUDIO_ERR_LOG("Invalid cache path. err = %{public}d", errno);
|
||||
return;
|
||||
}
|
||||
|
||||
cachePath_ = realPath;
|
||||
}
|
||||
|
||||
bool AudioServiceClient::VerifyClientPermission(const std::string &permissionName, uint32_t appTokenId)
|
||||
|
||||
Reference in New Issue
Block a user