pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/audio portaudio: Fix recording with the OSS backend on...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/ddcbe78235d1
branches:  trunk
changeset: 418319:ddcbe78235d1
user:      nia <nia%pkgsrc.org@localhost>
date:      Sun Nov 24 13:15:15 2019 +0000

description:
portaudio: Fix recording with the OSS backend on NetBSD.

This is trying to open /dev/audioX in non-blocking mode and poll() it.

This basically never works as expected, and is especially pointless with
the short reads PortAudio is doing. So don't do it.

It is also asserting some values to be returned from ioctls which the
emulation layer doesn't provide. This is also nearly entirely pointless,
so don't do it.

Recording now works in audacity.

Bump portaudio's PKGREVISION.

diffstat:

 audio/audacity/Makefile                                       |   4 +-
 audio/portaudio/Makefile                                      |   4 +-
 audio/portaudio/distinfo                                      |   4 +-
 audio/portaudio/patches/patch-src_hostapi_oss_pa__unix__oss.c |  70 ++++++++++-
 4 files changed, 71 insertions(+), 11 deletions(-)

diffs (144 lines):

diff -r 823480127dc8 -r ddcbe78235d1 audio/audacity/Makefile
--- a/audio/audacity/Makefile   Sun Nov 24 12:31:37 2019 +0000
+++ b/audio/audacity/Makefile   Sun Nov 24 13:15:15 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.127 2019/11/24 00:47:34 nia Exp $
+# $NetBSD: Makefile,v 1.128 2019/11/24 13:15:16 nia Exp $
 
 DISTNAME=      audacity-2.3.3
 CATEGORIES=    audio
@@ -8,7 +8,7 @@
 
 MAINTAINER=    pkgsrc-users%NetBSD.org@localhost
 HOMEPAGE=      https://www.audacityteam.org/
-COMMENT=       Audio editor
+COMMENT=       Multi-track audio editor and recorder
 LICENSE=       gnu-gpl-v2 # AND cc-by-v3.0-license
 
 WRKSRC=                ${WRKDIR}/audacity-${GITHUB_PROJECT}-${PKGVERSION_NOREV}
diff -r 823480127dc8 -r ddcbe78235d1 audio/portaudio/Makefile
--- a/audio/portaudio/Makefile  Sun Nov 24 12:31:37 2019 +0000
+++ b/audio/portaudio/Makefile  Sun Nov 24 13:15:15 2019 +0000
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.25 2019/10/26 17:22:07 nia Exp $
+# $NetBSD: Makefile,v 1.26 2019/11/24 13:15:15 nia Exp $
 
 DISTNAME=      pa_stable_v190600_20161030
 PKGNAME=       ${DISTNAME:S/^pa_stable_v/portaudio-/1:S/_/./g}
-PKGREVISION=   1
+PKGREVISION=   2
 CATEGORIES=    audio
 MASTER_SITES=  http://www.portaudio.com/archives/
 EXTRACT_SUFX=  .tgz
diff -r 823480127dc8 -r ddcbe78235d1 audio/portaudio/distinfo
--- a/audio/portaudio/distinfo  Sun Nov 24 12:31:37 2019 +0000
+++ b/audio/portaudio/distinfo  Sun Nov 24 13:15:15 2019 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.19 2019/10/28 15:32:24 nia Exp $
+$NetBSD: distinfo,v 1.20 2019/11/24 13:15:15 nia Exp $
 
 SHA1 (pa_stable_v190600_20161030.tgz) = 56c596bba820d90df7d057d8f6a0ec6bf9ab82e8
 RMD160 (pa_stable_v190600_20161030.tgz) = e6e5cd3f3cb7469aa17549c189e445d573567e13
@@ -11,4 +11,4 @@
 SHA1 (patch-src_common_pa__stream.c) = 58e6ab2a61957208973a59be2f1140abc922f360
 SHA1 (patch-src_common_pa__stream.h) = 94781a9ae79ea1340eea8caadc106416c019cf74
 SHA1 (patch-src_hostapi_alsa_pa__linux__alsa.c) = 6ddbeca36be30153f9c6c316c2fb78c06bbbf05d
-SHA1 (patch-src_hostapi_oss_pa__unix__oss.c) = 5652426814a3fc82ed802d8082a74aa460c822ca
+SHA1 (patch-src_hostapi_oss_pa__unix__oss.c) = 47678cab04dfd5c221bd15e2c8af741bca2d843c
diff -r 823480127dc8 -r ddcbe78235d1 audio/portaudio/patches/patch-src_hostapi_oss_pa__unix__oss.c
--- a/audio/portaudio/patches/patch-src_hostapi_oss_pa__unix__oss.c     Sun Nov 24 12:31:37 2019 +0000
+++ b/audio/portaudio/patches/patch-src_hostapi_oss_pa__unix__oss.c     Sun Nov 24 13:15:15 2019 +0000
@@ -1,12 +1,40 @@
-$NetBSD: patch-src_hostapi_oss_pa__unix__oss.c,v 1.2 2019/10/26 17:22:08 nia Exp $
+$NetBSD: patch-src_hostapi_oss_pa__unix__oss.c,v 1.3 2019/11/24 13:15:15 nia Exp $
 
-Don't write an endless stream of silence when preparing the stream.
+Remove some rather pointless assertions that are incompatible with NetBSD's OSS
+emulation layer.
+
+Don't write an endless stream of silence when preparing the stream and don't try to
+use OSS in non-blocking mode or poll it on NetBSD, this is unsupported.
 
 Add features needed to make portmixer work with audacity.
 
 --- src/hostapi/oss/pa_unix_oss.c.orig 2016-10-30 01:23:04.000000000 +0000
 +++ src/hostapi/oss/pa_unix_oss.c
-@@ -1477,6 +1477,7 @@ static PaError PaOssStream_Prepare( PaOs
+@@ -1040,23 +1040,13 @@ static PaError PaOssStreamComponent_Conf
+         PA_ENSURE( Pa2OssFormat( hostFormat, &temp ) );
+         nativeFormat = temp;
+         ENSURE_( ioctl( component->fd, SNDCTL_DSP_SETFMT, &temp ), paUnanticipatedHostError );
+-        PA_UNLESS( temp == nativeFormat, paInternalError );
+ 
+         /* try to set the number of channels */
+         ENSURE_( ioctl( component->fd, SNDCTL_DSP_CHANNELS, &chans ), paSampleFormatNotSupported );   /* XXX: Should be paInvalidChannelCount? */
+-        /* It's possible that the minimum number of host channels is greater than what the user requested */
+-        PA_UNLESS( chans >= component->userChannelCount, paInvalidChannelCount );
+ 
+         /* try to set the sample rate */
+         ENSURE_( ioctl( component->fd, SNDCTL_DSP_SPEED, &sr ), paInvalidSampleRate );
+ 
+-        /* reject if there's no sample rate within 1% of the one requested */
+-        if( (fabs( sampleRate - sr ) / sampleRate) > 0.01 )
+-        {
+-            PA_DEBUG(("%s: Wanted %f, closest sample rate was %d\n", __FUNCTION__, sampleRate, sr ));
+-            PA_ENSURE( paInvalidSampleRate );
+-        }
+-
+         ENSURE_( ioctl( component->fd, streamMode == StreamMode_In ? SNDCTL_DSP_GETISPACE : SNDCTL_DSP_GETOSPACE, &bufInfo ),
+                 paUnanticipatedHostError );
+         component->numBufs = bufInfo.fragstotal;
+@@ -1477,6 +1467,7 @@ static PaError PaOssStream_Prepare( PaOs
          size_t bufSz = PaOssStreamComponent_BufferSize( stream->playback );
          memset( stream->playback->buffer, 0, bufSz );
  
@@ -14,7 +42,7 @@
          /* Looks like we have to turn off blocking before we try this, but if we don't fill the buffer
           * OSS will complain. */
          PA_ENSURE( ModifyBlocking( stream->playback->fd, 0 ) );
-@@ -1486,6 +1487,7 @@ static PaError PaOssStream_Prepare( PaOs
+@@ -1486,6 +1477,7 @@ static PaError PaOssStream_Prepare( PaOs
                  break;
          }
          PA_ENSURE( ModifyBlocking( stream->playback->fd, 1 ) );
@@ -22,7 +50,39 @@
      }
  
      if( stream->sharedDevice )
-@@ -2043,3 +2045,26 @@ error:
+@@ -1652,6 +1644,7 @@ static void *PaOSS_AudioThreadProc( void
+             callbackResult = paComplete;
+         }
+ 
++#ifndef __NetBSD__
+         /* Aspect StreamState: Because of the messy OSS scheme we can't explicitly trigger device start unless
+          * the stream has been recently started, we will have to go right ahead and read/write in blocking
+          * fashion to trigger operation. Therefore we begin with processing one host buffer before we switch
+@@ -1667,6 +1660,9 @@ static void *PaOSS_AudioThreadProc( void
+         {
+             framesAvail = stream->framesPerHostBuffer;
+         }
++#else
++        framesAvail = stream->framesPerHostBuffer;
++#endif
+ 
+         while( framesAvail > 0 )
+         {
+@@ -1749,11 +1745,13 @@ static void *PaOSS_AudioThreadProc( void
+ 
+         if( initiateProcessing || !triggered )
+         {
++#ifndef __NetBSD__
+             /* Non-blocking */
+             if( stream->capture )
+                 PA_ENSURE( ModifyBlocking( stream->capture->fd, 0 ) );
+             if( stream->playback && !stream->sharedDevice )
+                 PA_ENSURE( ModifyBlocking( stream->playback->fd, 0 ) );
++#endif
+ 
+             initiateProcessing = 0;
+             sem_post( &stream->semaphore );
+@@ -2043,3 +2041,26 @@ error:
  #endif
  }
  



Home | Main Index | Thread Index | Old Index