sound-player: Adds error return for not supported media type 32/230132/5 accepted/tizen/unified/20200417.152647 submit/tizen/20200417.044433
authorJaechul Lee <jcsing.lee@samsung.com>
Wed, 8 Apr 2020 06:06:48 +0000 (15:06 +0900)
committerJaechul Lee <jcsing.lee@samsung.com>
Mon, 13 Apr 2020 02:20:58 +0000 (11:20 +0900)
added checking not support media type error and checking invalid handle
in sound_stop function. in this case, sound_server returns
org.tizen.multimedia.audio.InvalidState and it changes to INVALID_OPERATION

[Version] 13.0.12
[Issue Type] Add

Change-Id: I35db85891d6c54f6af09449668e09ea01c09ff7a
Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
packaging/pulseaudio-modules-tizen.spec
src/module-sound-player.c

index c465e25..e71fd06 100644 (file)
@@ -1,6 +1,6 @@
 Name:             pulseaudio-modules-tizen
 Summary:          Pulseaudio modules for Tizen
-Version:          13.0.11
+Version:          13.0.12
 Release:          0
 Group:            Multimedia/Audio
 License:          LGPL-2.1+
index f23eed1..a1fe61b 100644 (file)
@@ -491,22 +491,26 @@ static void handle_sound_play(DBusConnection *conn, DBusMessage *msg, void *user
     ret = pa_play_file_repeat(pa_namereg_get(u->module->core, NULL, PA_NAMEREG_SINK),
                                         filename, NULL, p, repeat, &stream_idx);
     if (ret != 0) {
-        pa_log_error("pa_play_file_repeat failed.\n");
+        pa_dbus_send_error(conn, msg, DBUS_ERROR_NOT_SUPPORTED, "%s",
+                            "org.tizen.multimedia.audio.UnsupportedMediaType");
         goto exit;
     }
 
     pa_idxset_put(u->stream_idxs, pa_xmemdup(&stream_idx, sizeof(stream_idx)), NULL);
     result = (dbus_int32_t)stream_idx;
 
+    pa_dbus_send_basic_value_reply(conn, msg, DBUS_TYPE_INT32, &result);
+
 exit:
     pa_proplist_free(p);
-    pa_dbus_send_basic_value_reply(conn, msg, DBUS_TYPE_INT32, &result);
 }
 
 static void handle_sound_stop(DBusConnection *conn, DBusMessage *msg, void *userdata) {
     pa_sink_input *si;
     uint32_t stream_idx;
     struct userdata *u = (struct userdata *)userdata;
+    int32_t *i;
+    uint32_t idx;
 
     pa_assert(conn);
     pa_assert(msg);
@@ -517,18 +521,19 @@ static void handle_sound_stop(DBusConnection *conn, DBusMessage *msg, void *user
                                        DBUS_TYPE_INVALID));
 
     si = pa_idxset_get_by_index(u->module->core->sink_inputs, stream_idx);
-    if (si != NULL) {
-        int32_t *i = NULL;
-        uint32_t idx = 0;
-
-        PA_IDXSET_FOREACH(i, u->stream_idxs, idx) {
-            if (*i == stream_idx) {
-                pa_idxset_remove_by_data(u->stream_idxs, i, NULL);
-                pa_xfree(i);
-            }
+    if (!si) {
+        pa_dbus_send_error(conn, msg, DBUS_ERROR_FAILED, "%s",
+                            "org.tizen.multimedia.audio.InvalidState");
+        return;
+    }
+
+    PA_IDXSET_FOREACH(i, u->stream_idxs, idx) {
+        if (*i == stream_idx) {
+            pa_idxset_remove_by_data(u->stream_idxs, i, NULL);
+            pa_xfree(i);
         }
-        pa_sink_input_unlink(si);
     }
+    pa_sink_input_unlink(si);
 
     pa_dbus_send_empty_reply(conn, msg);
 }