summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGilbok Lee <gilbok.lee@samsung.com>2019-07-18 11:17:33 +0900
committerGilbok Lee <gilbok.lee@samsung.com>2019-07-18 11:35:39 +0900
commit2da5251b2a727ee17cdd1988c869195d316d788d (patch)
treea28c1e6ec4dfbee6d2ce0c57942c7107e3b8486c
parentafb640dea119e62254ecf245250b0905c9a7514b (diff)
downloadlibmm-radio-2da5251b2a727ee17cdd1988c869195d316d788d.tar.gz
libmm-radio-2da5251b2a727ee17cdd1988c869195d316d788d.tar.bz2
libmm-radio-2da5251b2a727ee17cdd1988c869195d316d788d.zip
Fix bug that failed to set volume before radio startsubmit/tizen/20190718.054451accepted/tizen/unified/20190719.111652
- sound_manager_set_virtual_stream_volume returned invalid state error. - remove TIZEN_FEATURE_SOUND_VSTREAM define [Version] 0.2.47 [Issue Type] Fix bugs Change-Id: I1e1f133029fcf8e3f53af5aded0c1b4eda4fc3ae
-rwxr-xr-xconfigure.ac18
-rw-r--r--packaging/libmm-radio.spec2
-rwxr-xr-xsrc/Makefile.am9
-rw-r--r--src/include/mm_radio_priv_hal.h6
-rw-r--r--src/mm_radio_priv_hal.c100
-rw-r--r--unittest/Makefile.am9
6 files changed, 44 insertions, 100 deletions
diff --git a/configure.ac b/configure.ac
index 1faaf9f..c7d61c1 100755
--- a/configure.ac
+++ b/configure.ac
@@ -47,6 +47,10 @@ PKG_CHECK_MODULES(DLOG, dlog)
AC_SUBST(DLOG_CFLAGS)
AC_SUBST(DLOG_LIBS)
+PKG_CHECK_MODULES(SOUNDMGR, capi-media-sound-manager)
+AC_SUBST(SOUNDMGR_CFLAGS)
+AC_SUBST(SOUNDMGR_LIBS)
+
AC_ARG_ENABLE(emulator, AC_HELP_STRING([--enable-emulator], [using emulator interface]),
[
case "${enableval}" in
@@ -67,20 +71,6 @@ if test "x$ENABLE_EMULATOR" == "xyes"; then
AC_SUBST(GSTAPP_LIBS)
fi
-AC_ARG_ENABLE(sound-vstream, AC_HELP_STRING([--enable-sound-vstream], [using sound virtual stream]),
-[case "${enableval}" in
- yes) ENABLE_SOUND_VSTREAM=yes ;;
- no) ENABLE_SOUND_VSTREAM=no ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-sound-vstream) ;;
-esac], [ENABLE_SOUND_VSTREAM=no])
-AM_CONDITIONAL(ENABLE_SOUND_VSTREAM, test "x$ENABLE_SOUND_VSTREAM" = "xyes")
-
-if test "x$ENABLE_SOUND_VSTREAM" == "xyes"; then
- PKG_CHECK_MODULES(SOUNDMGR, capi-media-sound-manager)
- AC_SUBST(SOUNDMGR_CFLAGS)
- AC_SUBST(SOUNDMGR_LIBS)
-fi
-
AC_ARG_ENABLE(tests, AC_HELP_STRING([--enable-tests], [unittest build]),
[case "${enableval}" in
yes) IS_TESTS=yes ;;
diff --git a/packaging/libmm-radio.spec b/packaging/libmm-radio.spec
index c76a0bd..f5e8748 100644
--- a/packaging/libmm-radio.spec
+++ b/packaging/libmm-radio.spec
@@ -1,6 +1,6 @@
Name: libmm-radio
Summary: Multimedia Framework Radio Library
-Version: 0.2.46
+Version: 0.2.47
Release: 0
Group: System/Libraries
License: Apache-2.0
diff --git a/src/Makefile.am b/src/Makefile.am
index 9bad76c..c54ffad 100755
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -9,11 +9,13 @@ libmmfradio_la_CFLAGS = -I. -I./include \
$(GTHREAD_CFLAGS) \
$(MMCOMMON_CFLAGS) \
$(MM_RESOURCE_MANAGER_CFLAGS) \
+ $(SOUNDMGR_CFLAGS) \
$(DLOG_CFLAGS)
libmmfradio_la_LIBADD = $(GTHREAD_LIBS) \
$(MMCOMMON_LIBS) \
$(MM_RESOURCE_MANAGER_LIBS) \
+ $(SOUNDMGR_LIBS) \
$(DLOG_LIBS)
@@ -29,10 +31,3 @@ else
libmmfradio_la_SOURCES += mm_radio_priv_hal.c \
radio_hal_interface.c
endif
-
-if ENABLE_SOUND_VSTREAM
-libmmfradio_la_CFLAGS += $(SOUNDMGR_CFLAGS) \
- -DTIZEN_FEATURE_SOUND_VSTREAM
-
-libmmfradio_la_LIBADD += $(SOUNDMGR_LIBS)
-endif
diff --git a/src/include/mm_radio_priv_hal.h b/src/include/mm_radio_priv_hal.h
index 6f011e3..a629ad7 100644
--- a/src/include/mm_radio_priv_hal.h
+++ b/src/include/mm_radio_priv_hal.h
@@ -33,11 +33,8 @@
#include <mm_types.h>
#include <mm_message.h>
#include <media/mm_resource_manager.h>
-
-#ifdef TIZEN_FEATURE_SOUND_VSTREAM
#include <media/sound_manager.h>
#include <media/sound_manager_internal.h>
-#endif
#include "mm_radio.h"
#include "mm_radio_utils.h"
@@ -197,10 +194,9 @@ typedef struct {
MMRadioSeekDirectionType seek_direction;
-#ifdef TIZEN_FEATURE_SOUND_VSTREAM
sound_stream_info_h stream_info;
virtual_sound_stream_h vstream;
-#endif
+
int freq;
/* command lock */
diff --git a/src/mm_radio_priv_hal.c b/src/mm_radio_priv_hal.c
index 67d4a0f..c26be9a 100644
--- a/src/mm_radio_priv_hal.c
+++ b/src/mm_radio_priv_hal.c
@@ -318,7 +318,6 @@ int _mmradio_realize(mm_radio_t *radio)
ret = _mmradio_apply_region(radio, region, update);
-#ifdef TIZEN_FEATURE_SOUND_VSTREAM
ret = sound_manager_create_stream_information_internal(SOUND_STREAM_TYPE_RADIO, NULL, radio, &radio->stream_info);
if (ret != MM_ERROR_NONE) {
MMRADIO_LOG_ERROR("failed to create stream information");
@@ -331,7 +330,7 @@ int _mmradio_realize(mm_radio_t *radio)
MMRADIO_LOG_FLEAVE();
return ret;
}
-#endif
+
MMRADIO_SET_STATE(radio, MM_RADIO_STATE_READY);
MMRADIO_LOG_FLEAVE();
@@ -354,7 +353,6 @@ int _mmradio_unrealize(mm_radio_t *radio)
/*Stop radio if started*/
_mmradio_stop(radio);
-#ifdef TIZEN_FEATURE_SOUND_VSTREAM
if (radio->vstream) {
sound_manager_destroy_virtual_stream(radio->vstream);
radio->vstream = NULL;
@@ -363,7 +361,6 @@ int _mmradio_unrealize(mm_radio_t *radio)
sound_manager_destroy_stream_information(radio->stream_info);
radio->stream_info = NULL;
}
-#endif
MMRADIO_SET_STATE(radio, MM_RADIO_STATE_NULL);
@@ -462,21 +459,13 @@ int _mmradio_get_frequency(mm_radio_t *radio, int *pFreq)
int _mmradio_mute(mm_radio_t *radio)
{
- int ret = MM_ERROR_NONE;
MMRADIO_LOG_FENTER();
MMRADIO_CHECK_INSTANCE(radio);
MMRADIO_CHECK_STATE_RETURN_IF_FAIL(radio, MMRADIO_COMMAND_MUTE);
- ret = radio_hal_mute(radio->hal_inf);
- if (ret) {
- ret = __convert_error_code(ret, (char *)__FUNCTION__);
- if (ret == MM_ERROR_NOT_IMPLEMENTED)
- MMRADIO_LOG_WARNING("radio_hal_mute is not supported");
- else
- MMRADIO_LOG_ERROR("failed to set radio hal mute");
- return ret;
- }
+ if (radio->vstream)
+ sound_manager_set_virtual_stream_volume(radio->vstream, 0);
radio->is_muted = true;
MMRADIO_LOG_INFO("Radio mute state [%d]", radio->is_muted);
@@ -487,21 +476,15 @@ int _mmradio_mute(mm_radio_t *radio)
int _mmradio_unmute(mm_radio_t *radio)
{
- int ret = MM_ERROR_NONE;
MMRADIO_LOG_FENTER();
MMRADIO_CHECK_INSTANCE(radio);
MMRADIO_CHECK_STATE_RETURN_IF_FAIL(radio, MMRADIO_COMMAND_UNMUTE);
- ret = radio_hal_unmute(radio->hal_inf);
- if (ret) {
- ret = __convert_error_code(ret, (char *)__FUNCTION__);
- if (ret == MM_ERROR_NOT_IMPLEMENTED)
- MMRADIO_LOG_WARNING("radio_hal_unmute is not supported");
- else
- MMRADIO_LOG_ERROR("failed to set radio hal unmute");
- return ret;
- }
+ if (radio->vstream)
+ sound_manager_set_virtual_stream_volume(radio->vstream,
+ (double)radio->local_volume);
+
radio->is_muted = false;
MMRADIO_LOG_INFO("Radio mute state [%d]", radio->is_muted);
@@ -619,13 +602,19 @@ int _mmradio_start(mm_radio_t *radio)
goto error1;
}
-#ifdef TIZEN_FEATURE_SOUND_VSTREAM
ret = sound_manager_start_virtual_stream(radio->vstream);
if (ret) {
MMRADIO_LOG_ERROR("failed to start sound manager virtual stream");
goto error1;
}
-#endif
+
+ if (radio->vstream) {
+ double set_volume = 0;
+ if (!radio->is_muted)
+ set_volume = (double)radio->local_volume;
+ sound_manager_set_virtual_stream_volume(radio->vstream,
+ (double)set_volume);
+ }
MMRADIO_SET_STATE(radio, MM_RADIO_STATE_PLAYING);
@@ -652,19 +641,18 @@ int _mmradio_stop(mm_radio_t *radio)
/*cancel if any seek*/
_mmradio_seek_cancel(radio);
-#ifdef TIZEN_FEATURE_SOUND_VSTREAM
+
ret = sound_manager_stop_virtual_stream(radio->vstream);
if (ret != MM_ERROR_NONE) {
MMRADIO_LOG_ERROR("failed to stop virtual_stream");
return ret;
}
-#endif
ret = radio_hal_stop(radio->hal_inf);
if (ret) {
ret = __convert_error_code(ret, (char *)__FUNCTION__);
if (ret == MM_ERROR_NOT_IMPLEMENTED) {
- MMRADIO_LOG_WARNING("radio_hal_unmute is not supported");
+ MMRADIO_LOG_WARNING("radio_hal_stop is not supported");
} else {
MMRADIO_LOG_ERROR("failed to stop radio hal");
return ret;
@@ -740,15 +728,10 @@ int _mmradio_seek(mm_radio_t *radio, MMRadioSeekDirectionType direction)
radio->seek_unmute = false;
if (!radio->is_muted) {
- ret = radio_hal_mute(radio->hal_inf);
+ ret = _mmradio_mute(radio);
if (ret) {
- ret = __convert_error_code(ret, (char *)__FUNCTION__);
- if (ret == MM_ERROR_NOT_IMPLEMENTED) {
- MMRADIO_LOG_WARNING("radio_hal_mute is not supported");
- } else {
- MMRADIO_LOG_ERROR("failed to set radio hal mute");
- return ret;
- }
+ MMRADIO_LOG_ERROR("failed to set radio mute");
+ return ret;
}
radio->seek_unmute = true;
}
@@ -923,15 +906,10 @@ void __mmradio_scan_thread(mm_radio_t *radio)
}
if (radio->old_state == MM_RADIO_STATE_PLAYING) {
- ret = radio_hal_mute(radio->hal_inf);
+ ret = _mmradio_mute(radio);
if (ret) {
- ret = __convert_error_code(ret, (char *)__FUNCTION__);
- if (ret == MM_ERROR_NOT_IMPLEMENTED) {
- MMRADIO_LOG_WARNING("radio_hal_mute is not supported");
- } else {
- MMRADIO_LOG_ERROR("faied to set radio hal mute");
- goto FINISHED;
- }
+ MMRADIO_LOG_ERROR("failed to set radio mute");
+ goto FINISHED;
}
}
@@ -1009,15 +987,10 @@ FINISHED:
MMRADIO_LOG_DEBUG("old state is ready");
} else if (radio->old_state == MM_RADIO_STATE_PLAYING) {
MMRADIO_LOG_DEBUG("old state is playing");
- ret = radio_hal_unmute(radio->hal_inf);
+ ret = _mmradio_unmute(radio);
if (ret) {
- ret = __convert_error_code(ret, (char *)__FUNCTION__);
- if (ret == MM_ERROR_NOT_IMPLEMENTED) {
- MMRADIO_LOG_WARNING("radio_hal_unmute is not supported");
- } else {
- MMRADIO_LOG_ERROR("failed to set radio hal unmute");
- goto FINISHED_ERR;
- }
+ MMRADIO_LOG_ERROR("failed to set radio unmute");
+ goto FINISHED_ERR;
}
ret = radio_hal_set_frequency(radio->hal_inf, prev_freq);
if (ret) {
@@ -1163,15 +1136,10 @@ void __mmradio_seek_thread(mm_radio_t *radio)
* In the case of limit freq, tuner should be unmuted.
* Otherwise, sound can't output even though application set new frequency.
*/
- ret = radio_hal_unmute(radio->hal_inf);
+ ret = _mmradio_unmute(radio);
if (ret) {
- ret = __convert_error_code(ret, (char *)__FUNCTION__);
- if (ret == MM_ERROR_NOT_IMPLEMENTED) {
- MMRADIO_LOG_WARNING("radio_hal_unmute is not supported");
- } else {
- MMRADIO_LOG_ERROR("failed to set radio hal unmute");
- goto SEEK_FAILED;
- }
+ MMRADIO_LOG_ERROR("failed to set radio unmute");
+ goto SEEK_FAILED;
}
radio->seek_unmute = false;
}
@@ -1188,9 +1156,9 @@ SEEK_FAILED:
* In the case of limit freq, tuner should be unmuted.
* Otherwise, sound can't output even though application set new frequency.
*/
- ret = radio_hal_unmute(radio->hal_inf);
+ ret = _mmradio_unmute(radio);
if (ret)
- MMRADIO_LOG_ERROR("failed to set unmute radio hal");
+ MMRADIO_LOG_ERROR("failed to set radio unmute");
radio->seek_unmute = false;
}
p_thread->is_running = false;
@@ -1464,10 +1432,10 @@ int _mmradio_set_volume(mm_radio_t *radio, float volume)
MMRADIO_VOLUME_LOCK(radio);
radio->local_volume = volume;
-#ifdef TIZEN_FEATURE_SOUND_VSTREAM
if (radio->vstream)
- ret = sound_manager_set_virtual_stream_volume(radio->vstream, (double)radio->local_volume);
-#endif
+ sound_manager_set_virtual_stream_volume(radio->vstream,
+ (double)radio->local_volume);
+
MMRADIO_VOLUME_UNLOCK(radio);
MMRADIO_LOG_FLEAVE();
diff --git a/unittest/Makefile.am b/unittest/Makefile.am
index 841d81f..d7e451a 100644
--- a/unittest/Makefile.am
+++ b/unittest/Makefile.am
@@ -9,6 +9,7 @@ gtest_libmm_radio_CXXFLAGS = -I$(top_srcdir)/src/include \
$(MM_RESOURCE_MANAGER_CFLAGS) \
$(DLOG_CFLAGS) \
$(GTESTS_CFLAGS) \
+ $(SOUNDMGR_CFLAGS) \
-Werror -Wno-deprecated -Wno-deprecated-declarations -Wno-cpp
gtest_libmm_radio_DEPENDENCIES = $(top_srcdir)/src/.libs/libmmfradio.la
@@ -18,6 +19,7 @@ gtest_libmm_radio_LDADD = $(GTHREAD_LIBS) \
$(MM_RESOURCE_MANAGER_LIBS) \
$(DLOG_LIBS) \
$(GTESTS_LIBS) \
+ $(SOUNDMGR_LIBS) \
$(top_srcdir)/src/.libs/libmmfradio.la
if ENABLE_EMULATOR
@@ -27,10 +29,3 @@ gtest_libmm_radio_CXXFLAGS += $(GST_CFLAGS) \
gtest_libmm_radio_LDADD += $(GST_LIBS) \
$(GSTAPP_LIBS)
endif
-
-if ENABLE_SOUND_VSTREAM
-gtest_libmm_radio_CXXFLAGS += $(SOUNDMGR_CFLAGS) \
- -DTIZEN_FEATURE_SOUND_VSTREAM
-
-gtest_libmm_radio_LDADD += $(SOUNDMGR_LIBS)
-endif