]> Johnzone git - FakeRadio.git/commitdiff
small fix, hopefully no more segfault...
authorJohn Janus <mail@johnzone.org>
Wed, 20 Sep 2017 17:01:56 +0000 (19:01 +0200)
committerJohn Janus <mail@johnzone.org>
Wed, 20 Sep 2017 17:01:56 +0000 (19:01 +0200)
Makefile
mp3player.c

index b7fa73d46aaf768d19f5023fefcbfebd98490dcc..1697d809adbd3d767531b612c6ee249639cbbe81 100644 (file)
--- 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)
index 2149e0885479ebd9403943bb3f4cf4c0d3f415d2..ad7b9893c4e644881621aefd628727e15bb9f0f3 100644 (file)
@@ -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);