summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--audio/out/push.c12
-rw-r--r--player/client.c7
2 files changed, 11 insertions, 8 deletions
diff --git a/audio/out/push.c b/audio/out/push.c
index 0ecba19da7..0fb6cb3e29 100644
--- a/audio/out/push.c
+++ b/audio/out/push.c
@@ -364,17 +364,19 @@ static int init(struct ao *ao)
pthread_mutex_init(&p->lock, NULL);
pthread_cond_init(&p->wakeup, NULL);
pthread_cond_init(&p->wakeup_drain, NULL);
- mp_make_wakeup_pipe(p->wakeup_pipe);
+ if (mp_make_wakeup_pipe(p->wakeup_pipe) < 0)
+ goto err;
p->buffer = mp_audio_buffer_create(ao);
mp_audio_buffer_reinit_fmt(p->buffer, ao->format,
&ao->channels, ao->samplerate);
mp_audio_buffer_preallocate_min(p->buffer, ao->buffer);
- if (pthread_create(&p->thread, NULL, playthread, ao)) {
- ao->driver->uninit(ao);
- return -1;
- }
+ if (pthread_create(&p->thread, NULL, playthread, ao))
+ goto err;
return 0;
+err:
+ ao->driver->uninit(ao);
+ return -1;
}
const struct ao_driver ao_api_push = {
diff --git a/player/client.c b/player/client.c
index e7a993dd0e..0a64dd855d 100644
--- a/player/client.c
+++ b/player/client.c
@@ -1331,11 +1331,12 @@ int mpv_get_wakeup_pipe(mpv_handle *ctx)
{
pthread_mutex_lock(&ctx->wakeup_lock);
if (ctx->wakeup_pipe[0] == -1) {
- mp_make_wakeup_pipe(ctx->wakeup_pipe);
- write(ctx->wakeup_pipe[1], &(char){0}, 1);
+ if (mp_make_wakeup_pipe(ctx->wakeup_pipe) >= 0)
+ write(ctx->wakeup_pipe[1], &(char){0}, 1);
}
+ int fd = ctx->wakeup_pipe[0];
pthread_mutex_unlock(&ctx->wakeup_lock);
- return ctx->wakeup_pipe[0];
+ return fd;
}
unsigned long mpv_client_api_version(void)