sound-file-stream: support fd-passing for sound playback 12/283512/1 accepted/tizen/unified/20221104.082255
authorSeungbae Shin <seungbae.shin@samsung.com>
Fri, 28 Oct 2022 01:44:47 +0000 (10:44 +0900)
committerSeungbae Shin <seungbae.shin@samsung.com>
Fri, 28 Oct 2022 01:44:47 +0000 (10:44 +0900)
[Version] 15.0-11
[Issue Type] Feature

Change-Id: I9c86c0165b61a3c2b66f7e25bc66f8b2a71e9036

packaging/pulseaudio.spec
src/pulsecore/sound-file-stream.c
src/pulsecore/sound-file-stream.h

index de5399d..541e7bb 100644 (file)
@@ -4,7 +4,7 @@
 Name:             pulseaudio
 Summary:          Improved Linux sound server
 Version:          15.0
-Release:          10
+Release:          11
 Group:            Multimedia/Audio
 License:          LGPL-2.1
 URL:              http://pulseaudio.org
index 22d3c61..3a48dd9 100644 (file)
@@ -371,13 +371,13 @@ int pa_play_file_repeat(
         const pa_cvolume *volume,
         pa_proplist *p,
         uint32_t repeat,
+        int fd,
         uint32_t *stream_idx) {
 
     file_stream *u = NULL;
     pa_sample_spec ss;
     pa_channel_map cm;
     pa_sink_input_new_data data;
-    int fd;
     SF_INFO sfi;
     pa_memchunk silence;
 
@@ -394,9 +394,11 @@ int pa_play_file_repeat(
     u->memblockq = NULL;
     u->repeat = (repeat == 0) ? -1 : (int32_t)repeat;
 
-    if ((fd = pa_open_cloexec(fname, O_RDONLY, 0)) < 0) {
-        pa_log("Failed to open file %s: %s", fname, pa_cstrerror(errno));
-        goto fail;
+    if (fd == -1) {
+        if ((fd = pa_open_cloexec(fname, O_RDONLY, 0)) < 0) {
+            pa_log("Failed to open file %s: %s", fname, pa_cstrerror(errno));
+            goto fail;
+        }
     }
 
     /* FIXME: For now we just use posix_fadvise to avoid page faults
index 3d1b986..7ee5607 100644 (file)
@@ -25,7 +25,7 @@
 int pa_play_file(pa_sink *sink, const char *fname, const pa_cvolume *volume);
 #ifdef __TIZEN__
 int pa_play_file_repeat(pa_sink *sink, const char *fname, const pa_cvolume *volume,
-        pa_proplist *p,  uint32_t repeat, uint32_t *stream_idx);
+        pa_proplist *p,  uint32_t repeat, int fd, uint32_t *stream_idx);
 #endif
 
 #endif