Adds mm_sound_tone_stop for tone-player 41/230641/7 accepted/tizen/unified/20200417.152650 submit/tizen/20200417.044433
authorJaechul Lee <jcsing.lee@samsung.com>
Mon, 13 Apr 2020 06:34:20 +0000 (15:34 +0900)
committerJaechul Lee <jcsing.lee@samsung.com>
Fri, 17 Apr 2020 02:19:09 +0000 (11:19 +0900)
Tone-player and wav-player use mm_sound_stop API for stopping sound. So,
sound-play module in pulseadio received tone-player stop message through
dbus. Another problem was a stream handle that must have under
CLIENT_HANDLE_MAX(256) value. The handle from pulseaudio are increased
every creation.

[Version] 0.12.72
[Issue Type] Bug

Change-Id: I355aaf592413ec94730c0b206ea8d50a190a7281
Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
common/mm_sound_dbus.c
include/mm_sound_intf.h
mm_sound.c
mm_sound_client.c
mm_sound_proxy.c
packaging/libmm-sound.spec
server/mm_sound_mgr_ipc_dbus.c

index 010b9e8..b1d0d60 100644 (file)
@@ -63,6 +63,9 @@ static const mm_sound_dbus_method_info_t g_methods[AUDIO_METHOD_MAX] = {
        [AUDIO_METHOD_SOUND_STOP] = {
                .name = "SoundStop",
        },
+       [AUDIO_METHOD_STOP_TONE] = {
+               .name = "StopTone",
+       },
        [AUDIO_METHOD_PLAY_DTMF_WITH_STREAM_INFO] = {
                .name = "PlayDTMFWithStreamInfo",
        },
index 5fbd64b..6de6154 100644 (file)
@@ -48,6 +48,7 @@ typedef enum audio_method {
        AUDIO_METHOD_TEST,
        AUDIO_METHOD_SOUND_PLAY,
        AUDIO_METHOD_SOUND_STOP,
+       AUDIO_METHOD_STOP_TONE,
        AUDIO_METHOD_PLAY_DTMF_WITH_STREAM_INFO,
        AUDIO_METHOD_GET_BT_A2DP_STATUS,
        AUDIO_METHOD_SET_PATH_FOR_ACTIVE_DEVICE,
index e7fbf34..4ff9ee6 100644 (file)
@@ -314,6 +314,23 @@ int mm_sound_stop_sound(int handle)
        return MM_ERROR_NONE;
 }
 
+EXPORT_API
+int mm_sound_stop_tone(int handle)
+{
+       int err;
+
+       debug_warning("enter : handle=[%d]", handle);
+
+       err = mm_sound_client_stop_tone(handle);
+       if (err < 0) {
+               debug_error("Fail to stop tone. err=0x%x", err);
+               return err;
+       }
+       debug_msg("success : handle=[%d]", handle);
+
+       return MM_ERROR_NONE;
+}
+
 ///////////////////////////////////
 ////     MMSOUND TONE APIs
 ///////////////////////////////////
index 64c5f12..2c2e96f 100644 (file)
@@ -279,7 +279,7 @@ int mm_sound_client_stop_sound(int handle)
        int ret = MM_ERROR_NONE;
        debug_fenter();
 
-       if (handle < 0 || handle > CLIENT_HANDLE_MAX) {
+       if (handle < 0) {
                ret = MM_ERROR_INVALID_ARGUMENT;
                return ret;
        }
@@ -290,6 +290,20 @@ int mm_sound_client_stop_sound(int handle)
        return ret;
 }
 
+int mm_sound_client_stop_tone(int handle)
+{
+       int ret = MM_ERROR_NONE;
+       debug_fenter();
+
+       if (handle < 0 || handle > CLIENT_HANDLE_MAX)
+               return MM_ERROR_INVALID_ARGUMENT;
+
+       ret = mm_sound_proxy_stop_tone(handle);
+
+       debug_fleave();
+       return ret;
+}
+
 static int _mm_sound_client_device_list_dump(GList *device_list)
 {
        int ret = MM_ERROR_NONE;
index f322e28..4361a33 100644 (file)
@@ -994,6 +994,23 @@ int mm_sound_proxy_stop_sound(int handle)
        return ret;
 }
 
+int mm_sound_proxy_stop_tone(int handle)
+{
+       int ret = MM_ERROR_NONE;
+       GVariant *result = NULL;
+
+       debug_fenter();
+
+       if ((ret = mm_sound_dbus_method_call_to(AUDIO_PROVIDER_SOUND_SERVER, AUDIO_METHOD_STOP_TONE, g_variant_new("(i)", handle), &result)) != MM_ERROR_NONE)
+               debug_error("dbus stop file playing failed");
+
+       if (result)
+               g_variant_unref(result);
+
+       debug_fleave();
+       return ret;
+}
+
 int mm_sound_proxy_add_play_sound_end_callback(mm_sound_stop_callback_wrapper_func func, void* userdata, mm_sound_proxy_userdata_free freefunc, unsigned *subs_id)
 {
        int ret = MM_ERROR_NONE;
index a9000a3..18fa4ef 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-sound
 Summary:    MMSound Package contains client lib and sound_server binary
-Version:    0.12.71
+Version:    0.12.72
 Release:    0
 Group:      System/Libraries
 License:    Apache-2.0
index 0992d9c..6dd7032 100644 (file)
@@ -42,7 +42,7 @@ static const gchar introspection_xml[] =
        "      <arg type='i' name='stream_index' direction='in'/>"
        "      <arg type='i' name='handle' direction='out'/>"
        "    </method>"
-       "    <method name='PlayFileStop'>"
+       "    <method name='StopTone'>"
        "      <arg type='i' name='handle' direction='in'/>"
        "    </method>"
        "    <method name='PlayDTMFWithStreamInfo'>"
@@ -78,15 +78,9 @@ static mm_sound_dbus_method_intf_t methods[AUDIO_METHOD_MAX] = {
                },
                .handler = handle_method_test
        },
-       [AUDIO_METHOD_SOUND_PLAY] = {
+       [AUDIO_METHOD_STOP_TONE] = {
                .info = {
-                       .name = "SoundPlay",
-               },
-               .handler = handle_method_play_file_start_with_stream_info
-       },
-       [AUDIO_METHOD_SOUND_STOP] = {
-               .info = {
-                       .name = "SoundStop",
+                       .name = "StopTone",
                },
                .handler = handle_method_play_file_stop
        },