Date: Fri, 17 Feb 2012 20:20:20 +0200 (EET) From: Andriy Gapon <avg@icyb.net.ua> To: FreeBSD-gnats-submit@FreeBSD.org Cc: aragon@phat.za.net Subject: ports/165247: [PATCH] audio/alsa-plugins: remove parts of FreeBSD-specific patch Message-ID: <201202171820.q1HIKKWm070382@odyssey.starpoint.kiev.ua> Resent-Message-ID: <201202171840.q1HIe9cr029053@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 165247 >Category: ports >Synopsis: [PATCH] audio/alsa-plugins: remove parts of FreeBSD-specific patch >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Fri Feb 17 18:40:08 UTC 2012 >Closed-Date: >Last-Modified: >Originator: Andriy Gapon >Release: FreeBSD 10.0-CURRENT amd64 >Organization: >Environment: System: FreeBSD 10.0-CURRENT amd64 >Description: [DESCRIBE CHANGES] Since r221388 and its MFCes SNDCTL_DSP_GETIPTR should work correctly on FreeBSD and should not require any quirks/workarounds. In fact they seem to be harmful now and result in sound outages. Port maintainer (aragon@phat.za.net) is cc'd. Generated with FreeBSD Port Tools 0.99 >How-To-Repeat: >Fix: --- alsa-plugins-1.0.23_2.patch begins here --- diff -ruN --exclude=CVS /usr/ports/audio/alsa-plugins.orig/files/patch-alsa-plugins /usr/ports/audio/alsa-plugins/files/patch-alsa-plugins --- /usr/ports/audio/alsa-plugins.orig/files/patch-alsa-plugins 2010-06-05 15:46:16.000000000 +0300 +++ /usr/ports/audio/alsa-plugins/files/patch-alsa-plugins 2012-02-14 19:36:44.250936916 +0200 @@ -64,9 +64,9 @@ oss->ext.poll_fd = -1; oss->ext.callback = &oss_ext_callback; oss->ext.private_data = oss; ---- oss/pcm_oss.c.orig 2009-08-31 21:09:41.000000000 +0800 -+++ oss/pcm_oss.c 2009-09-28 14:54:12.000000000 +0800 -@@ -22,17 +22,57 @@ +--- oss/pcm_oss.c.orig 2010-04-16 14:11:10.000000000 +0300 ++++ oss/pcm_oss.c 2012-02-14 19:27:15.833934348 +0200 +@@ -22,17 +22,55 @@ #include <sys/ioctl.h> #include <alsa/asoundlib.h> #include <alsa/pcm_external.h> @@ -80,10 +80,8 @@ +#define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x))) + +#ifdef __FreeBSD__ -+/* #define FREEBSD_OSS_USE_IO_PTR 1 */ +/* #define FREEBSD_OSS_BLKCNT_P2 1 */ +/* #define FREEBSD_OSS_DEBUG_VERBOSE 1 */ -+#undef FREEBSD_OSS_USE_IO_PTR /* _IPTR is buggy ... Grr... */ +#undef FREEBSD_OSS_BLKCNT_P2 +#undef FREEBSD_OSS_DEBUG_VERBOSE + @@ -124,7 +122,7 @@ unsigned int frame_bytes; } snd_pcm_oss_t; -@@ -49,8 +89,13 @@ +@@ -49,8 +87,13 @@ buf = (char *)areas->addr + (areas->first + areas->step * offset) / 8; size *= oss->frame_bytes; result = write(oss->fd, buf, size); @@ -138,7 +136,7 @@ return result / oss->frame_bytes; } -@@ -67,13 +112,79 @@ +@@ -67,8 +110,13 @@ buf = (char *)areas->addr + (areas->first + areas->step * offset) / 8; size *= oss->frame_bytes; result = read(oss->fd, buf, size); @@ -152,88 +150,7 @@ return result / oss->frame_bytes; } - static snd_pcm_sframes_t oss_pointer(snd_pcm_ioplug_t *io) - { -+#ifdef __FreeBSD__ -+ snd_pcm_oss_t *oss = io->private_data; -+#ifdef FREEBSD_OSS_USE_IO_PTR -+ struct count_info ci; -+#endif -+ audio_buf_info bi; -+ -+ if (io->state != SND_PCM_STATE_RUNNING) -+ return 0; -+ -+ if (io->state == SND_PCM_STATE_XRUN) -+ return -EPIPE; -+ -+#ifdef FREEBSD_OSS_USE_IO_PTR -+ if (ioctl(oss->fd, (io->stream == SND_PCM_STREAM_PLAYBACK) ? -+ SNDCTL_DSP_GETOPTR : SNDCTL_DSP_GETIPTR, &ci) < 0) -+ return -EINVAL; -+ -+ if (ci.ptr == oss->last_bytes && -+ ((ioctl(oss->fd, (io->stream == SND_PCM_STREAM_PLAYBACK) ? -+ SNDCTL_DSP_GETOSPACE : SNDCTL_DSP_GETISPACE, &bi) < 0) || -+ bi.bytes == oss->bufsz)) -+ return -EPIPE; -+ -+ if (ci.ptr < oss->last_bytes) -+ oss->ptr += oss->bufsz; -+ -+ oss->ptr += ci.ptr; -+ oss->ptr -= oss->last_bytes; -+ oss->ptr %= oss->ptr_align; -+ -+ oss->last_bytes = ci.ptr; -+#else /* !FREEBSD_OSS_USE_IO_PTR */ -+ if (ioctl(oss->fd, (io->stream == SND_PCM_STREAM_PLAYBACK) ? -+ SNDCTL_DSP_GETOSPACE : SNDCTL_DSP_GETISPACE, &bi) < 0) -+ return -EINVAL; -+ -+ if (bi.bytes == oss->bufsz && bi.bytes == oss->last_bytes) { -+#if 0 -+#ifdef SNDCTL_DSP_GETERROR -+ audio_errinfo ei; -+ if (ioctl(oss->fd, SNDCTL_DSP_GETERROR, &ei) < 0 || -+ (io->stream == SND_PCM_STREAM_PLAYBACK && -+ ei.play_underruns != 0) || -+ (io->stream == SND_PCM_STREAM_CAPTURE && -+ ei.rec_overruns != 0)) -+#endif -+#endif -+ return -EPIPE; -+ } -+ -+ if (bi.bytes > oss->last_bytes) { -+ oss->ptr += bi.bytes - oss->last_bytes; -+ oss->ptr %= oss->ptr_align; -+ } -+ -+ oss->last_bytes = bi.bytes; -+#endif /* FREEBSD_OSS_USE_IO_PTR */ -+ -+ return snd_pcm_bytes_to_frames(io->pcm, oss->ptr); -+#else - snd_pcm_oss_t *oss = io->private_data; - struct count_info info; - int ptr; -@@ -85,20 +196,59 @@ - } - ptr = snd_pcm_bytes_to_frames(io->pcm, info.ptr); - return ptr; -+#endif - } - - static int oss_start(snd_pcm_ioplug_t *io) - { - snd_pcm_oss_t *oss = io->private_data; -+#ifdef __FreeBSD__ -+ audio_buf_info bi; -+#ifdef FREEBSD_OSS_USE_IO_PTR -+ struct count_info ci; -+#endif -+#endif +@@ -93,12 +141,21 @@ int tmp = io->stream == SND_PCM_STREAM_PLAYBACK ? PCM_ENABLE_OUTPUT : PCM_ENABLE_INPUT; @@ -252,33 +169,10 @@ +#endif } + -+#ifdef __FreeBSD__ -+ if (ioctl(oss->fd, (io->stream == SND_PCM_STREAM_PLAYBACK) ? -+ SNDCTL_DSP_GETOSPACE : SNDCTL_DSP_GETISPACE, &bi) < 0) -+ return -EINVAL; -+ -+ if (oss->bufsz != (bi.fragsize * bi.fragstotal)) { -+ fprintf(stderr, "%s(): WARNING - bufsz changed! %d -> %d\n", -+ __func__, oss->bufsz, bi.fragsize * bi.fragstotal); -+ oss->bufsz = bi.fragsize * bi.fragstotal; -+ } -+ -+#ifdef FREEBSD_OSS_USE_IO_PTR -+ if (ioctl(oss->fd, (io->stream == SND_PCM_STREAM_PLAYBACK) ? -+ SNDCTL_DSP_GETOPTR : SNDCTL_DSP_GETIPTR, &ci) < 0) -+ return -EINVAL; -+ -+ oss->last_bytes = ci.ptr; -+#else -+ oss->last_bytes = bi.bytes; -+#endif -+ oss->ptr = 0; -+#endif -+ return 0; } -@@ -107,6 +257,10 @@ +@@ -107,6 +164,10 @@ snd_pcm_oss_t *oss = io->private_data; int tmp = 0; @@ -289,7 +183,7 @@ ioctl(oss->fd, SNDCTL_DSP_SETTRIGGER, &tmp); return 0; } -@@ -115,16 +269,25 @@ +@@ -115,16 +176,25 @@ { snd_pcm_oss_t *oss = io->private_data; @@ -315,7 +209,7 @@ ioctl(oss->fd, SNDCTL_DSP_RESET); tmp = io->channels; -@@ -145,16 +308,75 @@ +@@ -145,16 +215,75 @@ } return 0; } @@ -391,7 +285,7 @@ switch (io->format) { case SND_PCM_FORMAT_U8: oss->format = AFMT_U8; -@@ -166,9 +388,87 @@ +@@ -166,9 +295,87 @@ oss->format = AFMT_S16_BE; break; default: @@ -479,7 +373,7 @@ period_bytes = io->period_size * oss->frame_bytes; oss->period_shift = 0; for (i = 31; i >= 4; i--) { -@@ -209,6 +509,7 @@ +@@ -209,6 +416,7 @@ goto _retry; } oss->fragment_set = 1; @@ -487,7 +381,7 @@ if ((flags = fcntl(oss->fd, F_GETFL)) < 0) { err = -errno; -@@ -229,10 +530,128 @@ +@@ -229,10 +437,128 @@ return 0; } @@ -618,7 +512,7 @@ snd_pcm_ioplug_t *io = &oss->io; static const snd_pcm_access_t access_list[] = { SND_PCM_ACCESS_RW_INTERLEAVED, -@@ -317,6 +736,7 @@ +@@ -317,6 +643,7 @@ return err; return 0; @@ -626,7 +520,7 @@ } -@@ -324,6 +744,10 @@ +@@ -324,6 +651,10 @@ { snd_pcm_oss_t *oss = io->private_data; @@ -637,7 +531,7 @@ close(oss->fd); free(oss->device); free(oss); -@@ -337,7 +761,9 @@ +@@ -337,7 +668,9 @@ .pointer = oss_pointer, .close = oss_close, .hw_params = oss_hw_params, @@ -647,7 +541,7 @@ .drain = oss_drain, }; -@@ -348,7 +774,9 @@ +@@ -348,7 +681,9 @@ .pointer = oss_pointer, .close = oss_close, .hw_params = oss_hw_params, @@ -657,7 +551,7 @@ .drain = oss_drain, }; -@@ -360,6 +788,10 @@ +@@ -360,6 +695,10 @@ int err; snd_pcm_oss_t *oss; --- alsa-plugins-1.0.23_2.patch ends here --- >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201202171820.q1HIKKWm070382>