af_ql_audio
Change-Id: Ic0c8174f86070e5a8f3b39e1e03d73ae437739a7
diff --git a/mbtk/libql_lib/src/ql_audio.c b/mbtk/libql_lib/src/ql_audio.c
index 12a65bb..d95ca9e 100755
--- a/mbtk/libql_lib/src/ql_audio.c
+++ b/mbtk/libql_lib/src/ql_audio.c
@@ -14,6 +14,7 @@
#ifdef MBTK_AF_SUPPORT
static mbtk_audio_handle player_hdl = NULL;
+static int player_hdl_1 = AUDIO_HANDLE;
static _cb_onRecorder record_cb_fun = NULL;
static int Samprate = 8000;
#endif
@@ -181,7 +182,14 @@
{
#ifdef MBTK_AF_SUPPORT
player_hdl = mbtk_audio_open_new(MBTK_AUTIO_TYPE_OUT, 1, Samprate, cb_func);
- return (int)player_hdl;
+ if(player_hdl == NULL)
+ {
+ return -1;
+ }
+ else
+ {
+ return player_hdl_1 = AUDIO_HANDLE;
+ }
#else
if(is_running || mbtk_audio_pcm_init()) {
return -1;
@@ -214,7 +222,11 @@
int Ql_AudPlayer_Play(int hdl, unsigned char* pData, unsigned int length)
{
#ifdef MBTK_AF_SUPPORT
- return mbtk_audio_play_stream_new((void *)hdl, pData, length,50);
+ if(hdl != player_hdl_1 || player_hdl == NULL){
+ LOGE("Handle error : %d", hdl);
+ return -1;
+ }
+ return mbtk_audio_play_stream_new((void *)player_hdl, pData, length,50);
#else
if(!is_running || hdl != play_handle) {
@@ -252,7 +264,12 @@
int Ql_AudPlayer_PlayFrmFile(int hdl, int fd, int offset)
{
#ifdef MBTK_AF_SUPPORT
- return mbtk_audio_play_file_new((void *)hdl, fd, offset);
+ if(hdl != player_hdl_1 || player_hdl == NULL){
+ LOGE("Handle error : %d", hdl);
+ return -1;
+ }
+
+ return mbtk_audio_play_file_new((void *)player_hdl, fd, offset);
#else
if(!is_running || hdl != play_handle) {
@@ -340,8 +357,13 @@
void Ql_AudPlayer_Close(int hdl)
{
#ifdef MBTK_AF_SUPPORT
- mbtk_audio_close_new((void *)hdl);
+ if(hdl != player_hdl_1 || player_hdl == NULL){
+ LOGE("Handle error : %d", hdl);
+ return -1;
+ }
+ mbtk_audio_close_new((void *)player_hdl);
+ player_hdl_1 = 0;
#else
if(!is_running || hdl != play_handle) {
@@ -615,7 +637,7 @@
{
#ifdef MBTK_AF_SUPPORT
int volume =0;
- if(value < -36 || value > 9)
+ if(value < -36 || value > 13)
{
volume = 0;
}