Fix high cpu usage when started with nohup (backported from upstream git)

Fix audio playback on big-endian machines (from upstream git)
Sanitize CFLAGS
This commit is contained in:
dcoppa 2011-01-05 14:06:51 +00:00
parent f435d6ef56
commit f6e6f5ee26
4 changed files with 44 additions and 7 deletions

View File

@ -1,8 +1,9 @@
# $OpenBSD: Makefile,v 1.9 2010/11/15 00:22:48 espie Exp $
# $OpenBSD: Makefile,v 1.10 2011/01/05 14:06:51 dcoppa Exp $
COMMENT = console client for pandora
DISTNAME = pianobar-2010.11.06
REVISION = 0
EXTRACT_SUFX = .tar.bz2
CATEGORIES = audio

View File

@ -1,12 +1,12 @@
$OpenBSD: patch-Makefile,v 1.3 2010/11/13 12:59:18 dcoppa Exp $
$OpenBSD: patch-Makefile,v 1.4 2011/01/05 14:06:51 dcoppa Exp $
--- Makefile.orig Sat Nov 6 13:38:14 2010
+++ Makefile Sat Nov 13 13:42:35 2010
+++ Makefile Wed Jan 5 14:31:51 2011
@@ -4,7 +4,7 @@ PREFIX:=/usr/local
BINDIR:=${PREFIX}/bin
LIBDIR:=${PREFIX}/lib
MANDIR:=${PREFIX}/share/man
-CFLAGS:=-Wall -g -std=c99 -pedantic
+CFLAGS+=-Wall -g -std=c99 -fgnu89-inline -pedantic
+CFLAGS+=-std=c99 -fgnu89-inline
PIANOBAR_DIR=src
PIANOBAR_SRC=\

View File

@ -0,0 +1,17 @@
$OpenBSD: patch-src_main_c,v 1.1 2011/01/05 14:06:51 dcoppa Exp $
Fix high cpu usage if stdin is /dev/null (i.e. when started with "nohup")
--- src/main.c.orig Sat Nov 6 13:38:14 2010
+++ src/main.c Wed Jan 5 14:46:15 2011
@@ -317,6 +317,10 @@ int main (int argc, char **argv) {
curFd = ctlFd;
}
buf = fgetc (curFd);
+ if (buf == EOF) {
+ /* select() is going wild if fdset contains EOFed fd's */
+ FD_CLR (fileno (curFd), &readSet);
+ }
size_t i;
for (i = 0; i < BAR_KS_COUNT; i++) {

View File

@ -1,9 +1,10 @@
$OpenBSD: patch-src_player_c,v 1.2 2010/05/13 18:35:51 dcoppa Exp $
$OpenBSD: patch-src_player_c,v 1.3 2011/01/05 14:06:51 dcoppa Exp $
Our faad port uses a patched neaacdec.h header
Fix audio playback on big-endian machines
--- src/player.c.orig Tue Mar 16 20:29:34 2010
+++ src/player.c Mon Mar 29 15:44:59 2010
--- src/player.c.orig Sat Nov 6 13:38:14 2010
+++ src/player.c Wed Jan 5 14:30:26 2011
@@ -185,7 +185,7 @@ static WaitressCbReturn_t BarPlayerAACCb (void *ptr, s
/* +1+4 needs to be replaced by <something>! */
player->bufferRead += 1+4;
@ -13,3 +14,21 @@ Our faad port uses a patched neaacdec.h header
&player->channels);
player->bufferRead += 5;
if (err != 0) {
@@ -199,7 +199,7 @@ static WaitressCbReturn_t BarPlayerAACCb (void *ptr, s
format.bits = 16;
format.channels = player->channels;
format.rate = player->samplerate;
- format.byte_format = AO_FMT_LITTLE;
+ format.byte_format = AO_FMT_NATIVE;
if ((player->audioOutDevice = ao_open_live (audioOutDriver,
&format, NULL)) == NULL) {
/* we're not interested in the errno */
@@ -358,7 +358,7 @@ static WaitressCbReturn_t BarPlayerMp3Cb (void *ptr, s
format.bits = 16;
format.channels = player->channels;
format.rate = player->samplerate;
- format.byte_format = AO_FMT_LITTLE;
+ format.byte_format = AO_FMT_NATIVE;
if ((player->audioOutDevice = ao_open_live (audioOutDriver,
&format, NULL)) == NULL) {
player->aoError = 1;