ports/56597: bad startup perfomance of mpg123 with pcm/oss/dsp
Eugene Grosbein
eugen at grosbein.pp.ru
Sat Jan 31 08:30:18 UTC 2004
The following reply was made to PR ports/56597; it has been noted by GNATS.
From: Eugene Grosbein <eugen at grosbein.pp.ru>
To: bug-followup at freebsd.org
Cc: des at des.no
Subject: Re: ports/56597: bad startup perfomance of mpg123 with pcm/oss/dsp
Date: Sat, 31 Jan 2004 15:22:22 +0700
Hi!
I have not obtain a responce from mpg123's author Michael Hipp,
so here is a patch for ports/audio/mpg123
The patch is "no-op" when mpg123 builds with Esound or NAS.
It utilizes the knowledge that all three sets of 120 ioctls
are effectively "no-op" for mpg123 using FreeBSD and /dev/dsp.
So it just skips that loop when command line switch '-r' is not used.
120 cycles are replaced with 2 when '-r' is used for FreeBSD and /dev/dsp
that results in 60 times faster startup time.
How-To-Apply: cd /usr/ports/audio; patch </path/to/patch
diff -Nru mpg123.orig/Makefile mpg123/Makefile
--- mpg123.orig/Makefile Sat Jan 31 14:20:14 2004
+++ mpg123/Makefile Sat Jan 31 14:49:07 2004
@@ -58,6 +58,7 @@
ALL_TARGET= freebsd-nas
.else
ALL_TARGET= freebsd
+CFLAGS+= -DWITH_FREEBSD_DSP_ONLY
.endif
pre-fetch:
diff -Nru mpg123.orig/files/patch-quickstart mpg123/files/patch-quickstart
--- mpg123.orig/files/patch-quickstart Thu Jan 1 07:00:00 1970
+++ mpg123/files/patch-quickstart Sat Jan 31 15:01:57 2004
@@ -0,0 +1,43 @@
+--- audio.c.orig Tue Apr 6 23:53:05 1999
++++ audio.c Sat Jan 31 15:00:06 2004
+@@ -75,7 +75,12 @@
+ return;
+ }
+
++#ifndef WITH_FREEBSD_DSP_ONLY
+ memset(capabilities,0,sizeof(capabilities));
++#else
++ memset(capabilities,1,sizeof(capabilities));
++ j = k1;
++#endif
+ if(param.force_rate) {
+ rates[NUM_RATES-1] = param.force_rate;
+ k1 = NUM_RATES;
+@@ -86,8 +91,13 @@
+ exit(1);
+ }
+
++#ifdef WITH_FREEBSD_DSP_ONLY
++ if(param.force_rate)
++#endif
+ for(i=0;i<NUM_CHANNELS;i++) {
++#ifndef WITH_FREEBSD_DSP_ONLY
+ for(j=0;j<NUM_RATES;j++) {
++#endif
+ ai1.channels = channels[i];
+ ai1.rate = rates[j];
+ fmts = audio_get_formats(&ai1);
+@@ -96,8 +106,13 @@
+ for(k=0;k<NUM_ENCODINGS;k++) {
+ if((fmts & encodings[k]) == encodings[k])
+ capabilities[i][k][j] = 1;
++#ifdef WITH_FREEBSD_DSP_ONLY
++ else capabilities[i][k][j] = 0;
++#endif
+ }
++#ifndef WITH_FREEBSD_DSP_ONLY
+ }
++#endif
+ }
+
+ audio_close(&ai1);
Eugene Grosbein
More information about the freebsd-ports-bugs
mailing list