From f873e8df5ce2600a6766a852ad41e3be3049dea5 Mon Sep 17 00:00:00 2001 From: Seungbae Shin Date: Fri, 28 Oct 2022 10:44:47 +0900 Subject: [PATCH] sound-file-stream: support fd-passing for sound playback [Version] 15.0-11 [Issue Type] Feature Change-Id: I9c86c0165b61a3c2b66f7e25bc66f8b2a71e9036 --- packaging/pulseaudio.spec | 2 +- src/pulsecore/sound-file-stream.c | 10 ++++++---- src/pulsecore/sound-file-stream.h | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/packaging/pulseaudio.spec b/packaging/pulseaudio.spec index de5399d..541e7bb 100644 --- a/packaging/pulseaudio.spec +++ b/packaging/pulseaudio.spec @@ -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 diff --git a/src/pulsecore/sound-file-stream.c b/src/pulsecore/sound-file-stream.c index 22d3c61..3a48dd9 100644 --- a/src/pulsecore/sound-file-stream.c +++ b/src/pulsecore/sound-file-stream.c @@ -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 diff --git a/src/pulsecore/sound-file-stream.h b/src/pulsecore/sound-file-stream.h index 3d1b986..7ee5607 100644 --- a/src/pulsecore/sound-file-stream.h +++ b/src/pulsecore/sound-file-stream.h @@ -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 -- 2.7.4