diff options
author | Seungbae Shin <seungbae.shin@samsung.com> | 2018-09-06 19:05:30 +0900 |
---|---|---|
committer | Seungbae Shin <seungbae.shin@samsung.com> | 2018-09-07 15:11:48 +0900 |
commit | d3a1fdee995a1864268a84a7556c12ed92150dd8 (patch) | |
tree | c1c120b908b6a0d70d170536f4989d7873ae8a04 | |
parent | 2f3a2412f93097091e156227e9dc38fb34e38816 (diff) | |
download | audio-hal-max98090-accepted/tizen_5.0_unified.tar.gz audio-hal-max98090-accepted/tizen_5.0_unified.tar.bz2 audio-hal-max98090-accepted/tizen_5.0_unified.zip |
Fix for audio-hal testcasesubmit/tizen_5.0/20181101.000001submit/tizen/20180907.070151accepted/tizen/unified/20180907.211645accepted/tizen/5.0/unified/20181102.012606tizen_5.0accepted/tizen_5.0_unified
- Fix condition check macro to support multiple expression.
- Init/Deinit mutex control properly.
- Avoid error print out by accessing non-exist volume ini file
[Version] 0.2.26
[Issue Type] Bug
Change-Id: Idd735c2aac0f5416b20fd2b1502710405544f97e
-rw-r--r-- | Makefile.am | 13 | ||||
-rw-r--r-- | packaging/audio-hal-max98090.spec | 2 | ||||
-rw-r--r-- | tizen-audio-ctrl.c | 46 | ||||
-rw-r--r-- | tizen-audio-impl-ctrl.c | 4 | ||||
-rw-r--r-- | tizen-audio-impl-pcm.c | 2 | ||||
-rw-r--r-- | tizen-audio-impl.h | 4 | ||||
-rw-r--r-- | tizen-audio-internal.h | 8 | ||||
-rw-r--r-- | tizen-audio-volume.c | 3 | ||||
-rw-r--r-- | tizen-audio.c | 7 |
9 files changed, 72 insertions, 17 deletions
diff --git a/Makefile.am b/Makefile.am index bdd6761..98494e4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -7,16 +7,15 @@ libtizen_audio_la_SOURCES = tizen-audio.c \ tizen-audio-pcm.c \ tizen-audio-util.c \ tizen-audio-comm.c \ + tizen-audio-ctrl.c \ tizen-audio-impl-pcm.c \ tizen-audio-impl-ucm.c \ tizen-audio-impl-ctrl.c libtizen_audio_la_LDFLAGS = $(AM_LDFLAGS) -disable-static -avoid-version +libtizen_audio_la_LIBADD = $(AM_LDADD) $(ASOUNDLIB_LIBS) $(VCONF_LIBS) $(DLOG_LIBS) $(INIPARSER_LIBS) $(EXPAT_LIBS) +libtizen_audio_la_CFLAGS = $(AM_CFLAGS) $(ASOUNDLIB_CFLAGS) $(VCONF_CFLAGS) $(DLOG_CFLAGS) $(INIPARSER_CFLAGS) $(EXPAT_CFLAGS) -DUSE_DLOG + if USE_TINYALSA -libtizen_audio_la_LIBADD = $(AM_LDADD) $(ASOUNDLIB_LIBS) $(TINYALSA_LIBS) $(VCONF_LIBS) $(DLOG_LIBS) $(INIPARSER_LIBS) -libtizen_audio_la_CFLAGS = $(AM_CFLAGS) $(ASOUNDLIB_CFLAGS) $(TINYALSA_CFLAGS) $(VCONF_CFLAGS) $(DLOG_CFLAGS) $(INIPARSER_CFLAGS) -D__USE_TINYALSA__ -else -libtizen_audio_la_LIBADD = $(AM_LDADD) $(ASOUNDLIB_LIBS) $(VCONF_LIBS) $(DLOG_LIBS) $(INIPARSER_LIBS) -libtizen_audio_la_CFLAGS = $(AM_CFLAGS) $(ASOUNDLIB_CFLAGS) $(VCONF_CFLAGS) $(DLOG_CFLAGS) $(INIPARSER_CFLAGS) +libtizen_audio_la_LIBADD += $(TINYALSA_LIBS) +libtizen_audio_la_CFLAGS += $(TINYALSA_CFLAGS) -D__USE_TINYALSA__ endif -libtizen_audio_la_CFLAGS += -DUSE_DLOG - diff --git a/packaging/audio-hal-max98090.spec b/packaging/audio-hal-max98090.spec index 1489670..1d5df54 100644 --- a/packaging/audio-hal-max98090.spec +++ b/packaging/audio-hal-max98090.spec @@ -1,6 +1,6 @@ Name: audio-hal-max98090 Summary: TIZEN Audio HAL for MAX98090 -Version: 0.2.25 +Version: 0.2.26 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..2b9bacd --- /dev/null +++ b/tizen-audio-ctrl.c @@ -0,0 +1,46 @@ +/* + * audio-hal + * + * Copyright (c) 2018 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" +#include "tizen-audio-impl.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..1c54bc4 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); diff --git a/tizen-audio-impl-pcm.c b/tizen-audio-impl-pcm.c index d5808d8..0763ccf 100644 --- a/tizen-audio-impl-pcm.c +++ b/tizen-audio-impl-pcm.c @@ -250,7 +250,7 @@ audio_return_t _pcm_close(void *pcm_handle) { int err; - AUDIO_LOG_INFO("Try to close PCM handle 0x%x", pcm_handle); + AUDIO_LOG_INFO("Try to close PCM handle %p", pcm_handle); #ifdef __USE_TINYALSA__ if ((err = pcm_close(pcm_handle)) < 0) { diff --git a/tizen-audio-impl.h b/tizen-audio-impl.h index b7ece02..11db856 100644 --- a/tizen-audio-impl.h +++ b/tizen-audio-impl.h @@ -36,8 +36,8 @@ audio_return_t _pcm_set_sw_params(snd_pcm_t *pcm, snd_pcm_uframes_t avail_min, u audio_return_t _pcm_set_hw_params(snd_pcm_t *pcm, audio_pcm_sample_spec_t *sample_spec, uint8_t *use_mmap, snd_pcm_uframes_t *period_size, snd_pcm_uframes_t *buffer_size); /* Control */ -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 7535997..700edc3 100644 --- a/tizen-audio-internal.h +++ b/tizen-audio-internal.h @@ -57,19 +57,19 @@ #endif #define AUDIO_RETURN_IF_FAIL(expr) do { \ - if (!expr) { \ + if (!(expr)) { \ AUDIO_LOG_ERROR("%s failed", #expr); \ return; \ } \ } while (0) #define AUDIO_RETURN_VAL_IF_FAIL(expr, val) do { \ - if (!expr) { \ + if (!(expr)) { \ AUDIO_LOG_ERROR("%s failed", #expr); \ return val; \ } \ } while (0) #define AUDIO_RETURN_NULL_IF_FAIL(expr) do { \ - if (!expr) { \ + if (!(expr)) { \ AUDIO_LOG_ERROR("%s failed", #expr); \ return NULL; \ } \ @@ -249,6 +249,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-volume.c b/tizen-audio-volume.c index 89d5124..287e0b5 100644 --- a/tizen-audio-volume.c +++ b/tizen-audio-volume.c @@ -180,7 +180,8 @@ static audio_return_t __load_volume_value_table_from_ini(audio_hal_t *ah) audio_volume_value_table_t *volume_value_table = ah->volume.volume_value_table; int size = 0; - dict = iniparser_load(VOLUME_INI_TEMP_PATH); + if (access(VOLUME_INI_TEMP_PATH, F_OK) == 0) + dict = iniparser_load(VOLUME_INI_TEMP_PATH); if (!dict) { AUDIO_LOG_DEBUG("Use default volume&gain ini file"); dict = iniparser_load(VOLUME_INI_DEFAULT_PATH); diff --git a/tizen-audio.c b/tizen-audio.c index a6e46e5..c587ee0 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; @@ -76,6 +81,8 @@ audio_return_t audio_deinit(void *audio_handle) _audio_stream_deinit(ah); _audio_pcm_deinit(ah); _audio_comm_deinit(ah); + _audio_ctrl_deinit(ah); + free(ah); ah = NULL; |