Fix code warning.
Change-Id: Ib11fb49f528d3688351ae349d5b4e307c28b3967
diff --git a/mbtk/libmbtk_lib/audio/mbtk_pcm_stream.c b/mbtk/libmbtk_lib/audio/mbtk_pcm_stream.c
index 213534b..82d28ce 100755
--- a/mbtk/libmbtk_lib/audio/mbtk_pcm_stream.c
+++ b/mbtk/libmbtk_lib/audio/mbtk_pcm_stream.c
@@ -3,6 +3,7 @@
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
+#include <cutils/str_parms.h>
#include "mbtk_log.h"
#include "mbtk_audio_internal.h"
@@ -74,7 +75,7 @@
static void audio_recorder_thread(void *arg)
{
- int rc, len, frames = 0;
+ int len, frames = 0;
char buff[MBTK_PCM_WB_BUF_SIZE];
audio_info->info.recorder.state = AUDIO_RECORDER_STATE_RUNNING;
@@ -207,7 +208,7 @@
//printf("Direction is %d, Type is %d, Src_Dst is %d, Priority is %d, Dest is %d. \n",data[0], data[1], data[2], data[3], data[4]);
if (update_vcm) {
- configure_vcm(data); /*TODO check if all inputs got all values successfully*/
+ configure_vcm((unsigned int*)data); /*TODO check if all inputs got all values successfully*/
}
return 0;
@@ -587,7 +588,7 @@
};
static struct mopen_audio_t *internal_hdl = NULL;
-typedef int (*_play_callback)(int hdl, int result);
+typedef int (*_play_callback)(void *hdl, int result);
static int config_parameters_new(int in_out, int NBWB)
@@ -649,7 +650,7 @@
//printf("Direction is %d, Type is %d, Src_Dst is %d, Priority is %d, Dest is %d. \n",data[0], data[1], data[2], data[3], data[4]);
if (update_vcm) {
- configure_vcm(data); /*TODO check if all inputs got all values successfully*/
+ configure_vcm((unsigned int*)data); /*TODO check if all inputs got all values successfully*/
}
return 0;
@@ -677,6 +678,8 @@
} else if ((16000 == rate) && (1 == num_channels)) {
nb_wb = 1;//WB
pcxt->pcm_packet_size = 640;
+ } else {
+ return -1;
}
//config playback parameters.
@@ -689,7 +692,7 @@
{
struct mopen_audio_t *pcxt = (struct mopen_audio_t *)hdl;
if (NULL == hdl || NULL == internal_hdl)
- return 0;
+ return;
pthread_mutex_lock(&pcxt->_cond_mutex);
pcxt->state = _status;
pthread_mutex_unlock(&pcxt->_cond_mutex);
@@ -697,8 +700,6 @@
mbtk_audio_handle mbtk_audio_open_new(mbtk_audio_dev_enum dev, int flag, int rate, void *usrData)
{
-
- int value = 1;
struct mopen_audio_t *aud_hdl = NULL;
int ret;
@@ -750,7 +751,6 @@
return (void *)aud_hdl;
error:
- value = 0;
free(aud_hdl);
return NULL;
}
@@ -781,11 +781,6 @@
int res = 0;
int ret;
- char cmd[128] = {0};
- bool flay_flag = TRUE;
- int i = 0;
-
-
struct mopen_audio_t *pcxt = (struct mopen_audio_t *)dev_hdl;
_play_callback audio_play_cb = (_play_callback)pcxt->usrData;
if (NULL == dev_hdl || NULL == internal_hdl)
@@ -870,7 +865,6 @@
unsigned bufsize = 0;
char *data = NULL;
int first_set = 0;
- int res = 0;
int ret = 0;
int read_size = 0;
char *p = (char *)pData;
@@ -947,10 +941,11 @@
if(flay_flag && gain != 50)
{
sprintf(cmd, "ubus call audio_if config_dspgain \"{\'type\':1, \'gain\':%d}\"", gain);
- system(cmd);
-
- flay_flag = FALSE;
- usleep(80000);
+ ret = system(cmd);
+ if(ret != -1 && ret != 127) {
+ flay_flag = FALSE;
+ usleep(80000);
+ }
}
}
@@ -968,7 +963,6 @@
int mbtk_audio_close_new(void *dev_hdl)
{
LOGD("mbtk_audio_close()\n");
- int value = 0;
struct mopen_audio_t *_hdl = (struct mopen_audio_t *)dev_hdl;
if (NULL == _hdl || NULL == internal_hdl )