summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeungbae Shin <seungbae.shin@samsung.com>2018-08-02 10:31:59 +0900
committerSeungbae Shin <seungbae.shin@samsung.com>2018-08-06 16:07:50 +0900
commitc1ab82f1c74e9060446a13121ffd898342dd28e5 (patch)
treeb6cb58fbb9061ebfe75415ebbd2bb9aaa2cd08c7
parent8dab939f22e28efa0524c4115f386723be1560dd (diff)
downloadaudio-hal-sc7727-c1ab82f1c74e9060446a13121ffd898342dd28e5.tar.gz
audio-hal-sc7727-c1ab82f1c74e9060446a13121ffd898342dd28e5.tar.bz2
audio-hal-sc7727-c1ab82f1c74e9060446a13121ffd898342dd28e5.zip
Fix for hal unit testsubmit/tizen/20180806.072201
- Join vbc voice/voip thread properly on the exit. - Init/Deinit mutex control properly. [Version] 0.1.25 [Issue Type] BUG Change-Id: I3fad7b4590fb32ddeb30f3d5c1c2089b1d924ba6
-rw-r--r--packaging/audio-hal-sc7727.spec2
-rw-r--r--tizen-audio-ctrl.c45
-rw-r--r--tizen-audio-impl-ctrl.c6
-rw-r--r--tizen-audio-impl.h4
-rw-r--r--tizen-audio-internal.h2
-rw-r--r--tizen-audio-modem.c12
-rw-r--r--tizen-audio.c9
7 files changed, 71 insertions, 9 deletions
diff --git a/packaging/audio-hal-sc7727.spec b/packaging/audio-hal-sc7727.spec
index cfbc7ad..7771611 100644
--- a/packaging/audio-hal-sc7727.spec
+++ b/packaging/audio-hal-sc7727.spec
@@ -1,6 +1,6 @@
Name: audio-hal-sc7727
Summary: TIZEN Audio HAL for SC7727
-Version: 0.1.24
+Version: 0.1.25
Release: 0
Group: System/Libraries
License: Apache-2.0
diff --git a/tizen-audio-ctrl.c b/tizen-audio-ctrl.c
new file mode 100644
index 0000000..561bd92
--- /dev/null
+++ b/tizen-audio-ctrl.c
@@ -0,0 +1,45 @@
+/*
+ * audio-hal
+ *
+ * Copyright (c) 2015 - 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "tizen-audio-internal.h"
+
+audio_return_t _audio_ctrl_init(audio_hal_t *ah)
+{
+ audio_return_t audio_ret = AUDIO_RET_OK;
+
+ AUDIO_RETURN_VAL_IF_FAIL(ah, AUDIO_ERR_PARAMETER);
+
+ audio_ret = _mixer_control_init(ah);
+
+ return audio_ret;
+}
+
+audio_return_t _audio_ctrl_deinit(audio_hal_t *ah)
+{
+ audio_return_t audio_ret = AUDIO_RET_OK;
+
+ AUDIO_RETURN_VAL_IF_FAIL(ah, AUDIO_ERR_PARAMETER);
+
+ audio_ret = _mixer_control_deinit(ah);
+
+ return audio_ret;
+}
diff --git a/tizen-audio-impl-ctrl.c b/tizen-audio-impl-ctrl.c
index 253eaab..c52715a 100644
--- a/tizen-audio-impl-ctrl.c
+++ b/tizen-audio-impl-ctrl.c
@@ -47,7 +47,7 @@ static void __dump_mixer_param(char *dump, long *param, int size)
}
#endif
-audio_return_t _control_init(audio_hal_t *ah)
+audio_return_t _mixer_control_init(audio_hal_t *ah)
{
AUDIO_RETURN_VAL_IF_FAIL(ah, AUDIO_ERR_PARAMETER);
@@ -55,7 +55,7 @@ audio_return_t _control_init(audio_hal_t *ah)
return AUDIO_RET_OK;
}
-audio_return_t _control_deinit(audio_hal_t *ah)
+audio_return_t _mixer_control_deinit(audio_hal_t *ah)
{
AUDIO_RETURN_VAL_IF_FAIL(ah, AUDIO_ERR_PARAMETER);
@@ -248,4 +248,4 @@ audio_return_t _mixer_control_get_element(audio_hal_t *ah, const char *ctl_name,
/* TODO. */
return AUDIO_RET_OK;
-} \ No newline at end of file
+}
diff --git a/tizen-audio-impl.h b/tizen-audio-impl.h
index 051eb84..c3f8e85 100644
--- a/tizen-audio-impl.h
+++ b/tizen-audio-impl.h
@@ -58,8 +58,8 @@ audio_return_t _pcm_set_hw_params(snd_pcm_t *pcm, audio_pcm_sample_spec_t *sampl
#define MIXER_FMRADIO_L_VOLUME "VBC STR DG Set"
#define MIXER_FMRADIO_R_VOLUME "VBC STL DG Set"
#define MIXER_FMRADIO_MUTE "Digital FM Function"
-audio_return_t _control_init(audio_hal_t *ah);
-audio_return_t _control_deinit(audio_hal_t *ah);
+audio_return_t _mixer_control_init(audio_hal_t *ah);
+audio_return_t _mixer_control_deinit(audio_hal_t *ah);
audio_return_t _mixer_control_set_param(audio_hal_t *ah, const char* ctl_name, snd_ctl_elem_value_t* value, int size);
audio_return_t _mixer_control_set_value(audio_hal_t *ah, const char *ctl_name, int val);
audio_return_t _mixer_control_set_value_string(audio_hal_t *ah, const char* ctl_name, const char* value);
diff --git a/tizen-audio-internal.h b/tizen-audio-internal.h
index 62d4646..8bd6f5a 100644
--- a/tizen-audio-internal.h
+++ b/tizen-audio-internal.h
@@ -318,6 +318,8 @@ typedef struct audio_hal {
audio_hal_comm_t comm;
} audio_hal_t;
+audio_return_t _audio_ctrl_init(audio_hal_t *ah);
+audio_return_t _audio_ctrl_deinit(audio_hal_t *ah);
audio_return_t _audio_volume_init(audio_hal_t *ah);
audio_return_t _audio_volume_deinit(audio_hal_t *ah);
audio_return_t _audio_routing_init(audio_hal_t *ah);
diff --git a/tizen-audio-modem.c b/tizen-audio-modem.c
index 78651bc..54caf4c 100644
--- a/tizen-audio-modem.c
+++ b/tizen-audio-modem.c
@@ -669,12 +669,20 @@ static audio_return_t __vbc_control_open(audio_hal_t *ah)
void __vbc_control_close(audio_hal_t *ah)
{
+ int ret;
/* TODO. Make sure we always receive CLOSE command from modem and then close pcm device */
ah->modem.vbc.exit_vbc_thread = 1;
close(ah->modem.vbc.vbpipe_fd);
- pthread_cancel(ah->modem.vbc.voice_thread_handle);
- pthread_cancel(ah->modem.vbc.voip_thread_handle);
+ ret = pthread_cancel(ah->modem.vbc.voice_thread_handle);
+ AUDIO_LOG_INFO("cancel voice thread : %d", ret);
+ ret = pthread_cancel(ah->modem.vbc.voip_thread_handle);
+ AUDIO_LOG_INFO("cancel voip thread : %d", ret);
+
+ ret = pthread_join(ah->modem.vbc.voice_thread_handle, NULL);
+ AUDIO_LOG_INFO("join voice thread : %d", ret);
+ ret = pthread_join(ah->modem.vbc.voip_thread_handle, NULL);
+ AUDIO_LOG_INFO("join voip thread : %d", ret);
return;
}
diff --git a/tizen-audio.c b/tizen-audio.c
index c7a3098..c61f063 100644
--- a/tizen-audio.c
+++ b/tizen-audio.c
@@ -34,6 +34,11 @@ audio_return_t audio_init(void **audio_handle)
AUDIO_LOG_ERROR("failed to malloc()");
return AUDIO_ERR_RESOURCE;
}
+
+ if ((ret = _audio_ctrl_init(ah))) {
+ AUDIO_LOG_ERROR("failed to _audio_ctrl_init(), ret(0x%x)", ret);
+ goto error_exit;
+ }
if ((ret = _audio_volume_init(ah))) {
AUDIO_LOG_ERROR("failed to _audio_volume_init(), ret(0x%x)", ret);
goto error_exit;
@@ -81,8 +86,10 @@ audio_return_t audio_deinit(void *audio_handle)
_audio_pcm_deinit(ah);
_audio_modem_deinit(ah);
_audio_comm_deinit(ah);
+ _audio_ctrl_deinit(ah);
+
free(ah);
ah = NULL;
return AUDIO_RET_OK;
-} \ No newline at end of file
+}