From 41ce36150a27aa5bae9fb6844229bd5f50b2d13a Mon Sep 17 00:00:00 2001 From: Seungbae Shin Date: Tue, 25 Oct 2022 21:29:40 +0900 Subject: [PATCH] sound-player: support fd-passing for supporting container playback [Version] 15.0.33 [Issue Type] Feature Change-Id: I34f8c474a9ac9e5d882d4616bd9de9d1e49ab5a8 --- packaging/pulseaudio-modules-tizen.spec | 2 +- src/module-sound-player.c | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/packaging/pulseaudio-modules-tizen.spec b/packaging/pulseaudio-modules-tizen.spec index d24a56e..74c31ae 100644 --- a/packaging/pulseaudio-modules-tizen.spec +++ b/packaging/pulseaudio-modules-tizen.spec @@ -2,7 +2,7 @@ Name: pulseaudio-modules-tizen Summary: Pulseaudio modules for Tizen -Version: 15.0.32 +Version: 15.0.33 Release: 0 Group: Multimedia/Audio License: LGPL-2.1+ diff --git a/src/module-sound-player.c b/src/module-sound-player.c index 229501d..5773c47 100644 --- a/src/module-sound-player.c +++ b/src/module-sound-player.c @@ -104,9 +104,10 @@ static pa_dbus_arg_info sound_play_args[] = { { "filename", "s", "in" }, { "client_pid", "i", "in" }, { "role", "s", "in" }, { "parent_id", "i", "in" }, - { "stop_others", "b", "in" } }; + { "stop_others", "b", "in" }, + { "fd", "h", "in" }}; static pa_dbus_arg_info sound_stop_args[] = { { "stream_idx", "i", "in" } }; -static const char* signature_args_for_in[] = { "sss", "s", NULL, "sss", "siisib", "i" }; +static const char* signature_args_for_in[] = { "sss", "s", NULL, "sss", "siisibh", "i" }; static pa_dbus_method_handler method_handlers[METHOD_HANDLER_MAX] = { [METHOD_HANDLER_SIMPLE_PLAY] = { @@ -181,6 +182,7 @@ static pa_dbus_interface_info sound_player_interface_info = { " " \ " " \ " " \ + " " \ " " \ " " \ " " \ @@ -499,6 +501,7 @@ static void handle_sound_play(DBusConnection *conn, DBusMessage *msg, void *user uint32_t stream_idx; dbus_bool_t stop_others = false; pa_proplist *p; + int fd = -1; pa_assert_se(dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &filename, @@ -507,6 +510,7 @@ static void handle_sound_play(DBusConnection *conn, DBusMessage *msg, void *user DBUS_TYPE_STRING, &role, DBUS_TYPE_INT32, &parent_id, DBUS_TYPE_BOOLEAN, &stop_others, + DBUS_TYPE_UNIX_FD, &fd, DBUS_TYPE_INVALID)); if (stop_others) { @@ -515,13 +519,16 @@ static void handle_sound_play(DBusConnection *conn, DBusMessage *msg, void *user pa_log_info("stop done, ready to play the requested one"); } + pa_log_info("message contains unix fds(%s), received fd(%d)", + pa_yes_no(dbus_message_contains_unix_fds(msg)), fd); + p = pa_proplist_new(); pa_proplist_sets(p, PA_PROP_MEDIA_ROLE, role); pa_proplist_setf(p, PA_PROP_APPLICATION_PROCESS_ID_ORIGIN, "%d", client_pid); pa_proplist_setf(p, PA_PROP_MEDIA_PARENT_ID, "%d", parent_id); ret = pa_play_file_repeat(pa_namereg_get(u->module->core, NULL, PA_NAMEREG_SINK), - filename, NULL, p, repeat, &stream_idx); + filename, NULL, p, repeat, fd, &stream_idx); if (ret != 0) { pa_dbus_send_error(conn, msg, DBUS_ERROR_NOT_SUPPORTED, "%s", "org.tizen.multimedia.audio.UnsupportedMediaType"); -- 2.34.1