From 51662db5e64eb36251f1036b45b934ab956e6a3c Mon Sep 17 00:00:00 2001 From: John Janus Date: Wed, 20 Sep 2017 19:01:56 +0200 Subject: [PATCH] small fix, hopefully no more segfault... --- Makefile | 2 +- mp3player.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index b7fa73d..1697d80 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ CC = gcc -CFLAGS = -std=gnu11 -Wall +CFLAGS = -std=gnu11 -Wall -O2 LDFLAGS = -lpthread -lao -lmpg123 -lwiringPi fakeradio : mp3player.o main.o $(CC) $(CFLAGS) -o fakeradio main.o mp3player.o $(LDFLAGS) diff --git a/mp3player.c b/mp3player.c index 2149e08..ad7b989 100644 --- a/mp3player.c +++ b/mp3player.c @@ -64,6 +64,7 @@ void* playFunc(void* arg) mem->mh = mpg123_new(NULL, &err); buffer_size = mpg123_outblock(mem->mh); mem->buffer = (unsigned char*) malloc(buffer_size * sizeof(unsigned char)); + mem->aodev = ao_open_live(driver, &format, NULL); pthread_cleanup_push(cleanupThread, (void*) mem); do { if (mpg123_open(mem->mh, settings->file) != MPG123_OK) return NULL; @@ -74,7 +75,6 @@ void* playFunc(void* arg) format.channels = channels; format.byte_format = AO_FMT_NATIVE; format.matrix = 0; - mem->aodev = ao_open_live(driver, &format, NULL); -- 2.47.0