From f45b143dcf90970122436d10bd6226f577a9310d Mon Sep 17 00:00:00 2001 From: kartofen Date: Sat, 22 Oct 2022 23:53:29 +0300 Subject: works with alsa and runs at 30 fps --- src/listener.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/listener.c') diff --git a/src/listener.c b/src/listener.c index f819383..1968590 100644 --- a/src/listener.c +++ b/src/listener.c @@ -14,6 +14,8 @@ char cam_data[BUF_CAP] = {0}; unsigned int WIDTH = 1; unsigned int HEIGHT = 1; +audio_handle aud_handle; + void *display_thread(void *arg) { (void)arg; @@ -32,7 +34,7 @@ void on_recv(message *m) HEIGHT = m->HEIGHT; memcpy(cam_data, m->video, WIDTH * HEIGHT * 3); - audio_play(m->audio); + audio_play(&aud_handle, m->audio); } int main(void) @@ -40,6 +42,12 @@ int main(void) pthread_t tid; pthread_create(&tid, NULL, display_thread, NULL); + if(audio_create(&aud_handle, PLAYBACK) != 0) { + err("audio_create: failed\n"); + return 1; + } + + if(listener("4950", &on_recv) != 0) { err("listener: failed"); return 1; -- cgit v1.2.3