Clean up code for the silent lead-in on a non-syncing back end e.g. a pipe. Clean up pipe creation and initial opening and associated error messages. Fix error with warning/die messages. Tidy up some debug messages.
This commit is contained in:
+14
-2
@@ -51,8 +51,19 @@ static void start(__attribute__((unused)) int sample_rate,
|
||||
// "ENXIO O_NONBLOCK | O_WRONLY is set, the named file is a FIFO, and no process has the FIFO
|
||||
// open for reading."
|
||||
|
||||
fd = try_to_open_pipe_for_writing(pipename);
|
||||
}
|
||||
fd = try_to_open_pipe_for_writing(pipename);
|
||||
// we check that it's not a "real" error. From the "man 2 open" page:
|
||||
// "ENXIO O_NONBLOCK | O_WRONLY is set, the named file is a FIFO, and no process has the FIFO
|
||||
// open for reading." Which is okay.
|
||||
if ((fd == -1) && (errno != ENXIO)) {
|
||||
char errorstring[1024];
|
||||
strerror_r(errno, (char *)errorstring, sizeof(errorstring));
|
||||
debug(1, "audio_pipe start -- error %d (\"%s\") opening pipe: \"%s\".", errno,
|
||||
(char *)errorstring, pipename);
|
||||
warn("can not open audio pipe -- error %d (\"%s\") opening pipe: \"%s\".", errno,
|
||||
(char *)errorstring, pipename);
|
||||
}
|
||||
}
|
||||
|
||||
static int play(void *buf, int samples) {
|
||||
// if the file is not open, try to open it.
|
||||
@@ -74,6 +85,7 @@ static int play(void *buf, int samples) {
|
||||
|
||||
static void stop(void) {
|
||||
// Don't close the pipe just because a play session has stopped.
|
||||
|
||||
}
|
||||
|
||||
static int init(int argc, char **argv) {
|
||||
|
||||
Reference in New Issue
Block a user