Commit e227596c authored by Max Kellermann's avatar Max Kellermann

test/run_output: pass FileDescriptor to run_output()

parent ec76583c
...@@ -113,7 +113,8 @@ LoadAudioOutput(const ConfigData &config, EventLoop &event_loop, ...@@ -113,7 +113,8 @@ LoadAudioOutput(const ConfigData &config, EventLoop &event_loop,
} }
static void static void
run_output(AudioOutput &ao, AudioFormat audio_format) RunOutput(AudioOutput &ao, AudioFormat audio_format,
FileDescriptor in_fd)
{ {
/* open the audio output */ /* open the audio output */
...@@ -134,8 +135,8 @@ run_output(AudioOutput &ao, AudioFormat audio_format) ...@@ -134,8 +135,8 @@ run_output(AudioOutput &ao, AudioFormat audio_format)
char buffer[4096]; char buffer[4096];
while (true) { while (true) {
if (length < sizeof(buffer)) { if (length < sizeof(buffer)) {
ssize_t nbytes = read(0, buffer + length, ssize_t nbytes = in_fd.Read(buffer + length,
sizeof(buffer) - length); sizeof(buffer) - length);
if (nbytes <= 0) if (nbytes <= 0)
break; break;
...@@ -174,7 +175,7 @@ try { ...@@ -174,7 +175,7 @@ try {
/* do it */ /* do it */
run_output(*ao, c.audio_format); RunOutput(*ao, c.audio_format, FileDescriptor(STDIN_FILENO));
/* cleanup and exit */ /* cleanup and exit */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment