Audio: aml_amaudioutils module reports [1/1]
PD#TV-61218
Problem:
The coverity detected problems with the AML Amaudioutils module
Solution:
fix the code based on the report
Verify:
yocto lge.
Change-Id: Iafa9e6db7f95e32b6e09d593bbb10ea004904218
Signed-off-by: zhaopeng.yan <zhaopeng.yan@amlogic.com>
diff --git a/src/IpcBuffer/IpcBuffer.cpp b/src/IpcBuffer/IpcBuffer.cpp
index 311f086..d879cf2 100644
--- a/src/IpcBuffer/IpcBuffer.cpp
+++ b/src/IpcBuffer/IpcBuffer.cpp
@@ -18,6 +18,8 @@
, capacity_(capacity)
, name_(std::string(name))
, wr_position_(0)
+ , blocking_(false)
+ , wr_time_(0)
{
managed_shared_memory *segment = audio_server_shmem::getInstance();
void *shptr = segment->allocate(capacity);
diff --git a/src/primitives.c b/src/primitives.c
index 8e92fdf..f97d6b2 100644
--- a/src/primitives.c
+++ b/src/primitives.c
@@ -420,7 +420,7 @@
case 3: { /* could be slow. use a struct to represent 3 bytes of data. */
uint8x3_t *udst = (uint8x3_t*)dst;
const uint8x3_t *usrc = (const uint8x3_t*)src;
- static const uint8x3_t zero; /* tricky - we use this to zero out a sample */
+ static const uint8x3_t zero = {0}; /* tricky - we use this to zero out a sample */
copy_frame_by_mask(udst, dst_mask, usrc, src_mask, count, zero);
} break;
@@ -475,7 +475,7 @@
case 3: { /* could be slow. use a struct to represent 3 bytes of data. */
uint8x3_t *udst = (uint8x3_t*)dst;
const uint8x3_t *usrc = (const uint8x3_t*)src;
- static const uint8x3_t zero;
+ static const uint8x3_t zero = {0};
copy_frame_by_idx(udst, dst_channels, usrc, src_channels, idxary, count, zero);
} break;
diff --git a/src/resampler.c b/src/resampler.c
index 43ba895..066668e 100644
--- a/src/resampler.c
+++ b/src/resampler.c
@@ -50,9 +50,10 @@
static void resampler_reset(struct resampler_itfe *resampler)
{
struct resampler *rsmp = (struct resampler *)resampler;
-
- rsmp->frames_in = 0;
- rsmp->frames_rq = 0;
+ if (rsmp != NULL) {
+ rsmp->frames_in = 0;
+ rsmp->frames_rq = 0;
+ }
if (rsmp != NULL && rsmp->speex_resampler != NULL) {
speex_resampler_reset_mem(rsmp->speex_resampler);
diff --git a/src/spdif/SPDIFEncoder.cpp b/src/spdif/SPDIFEncoder.cpp
index 62f547d..da7bea7 100644
--- a/src/spdif/SPDIFEncoder.cpp
+++ b/src/spdif/SPDIFEncoder.cpp
@@ -45,6 +45,7 @@
, mBitstreamNumber(0)
, mPayloadBytesPending(0)
, mScanning(true)
+ , mFrameSize(0)
{
switch(format) {
case AUDIO_FORMAT_AC3: