From owner-freebsd-multimedia@FreeBSD.ORG Wed Oct 31 09:41:14 2012 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F26E3FCC for ; Wed, 31 Oct 2012 09:41:14 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe09.c2i.net [212.247.155.2]) by mx1.freebsd.org (Postfix) with ESMTP id 81A438FC0C for ; Wed, 31 Oct 2012 09:41:14 +0000 (UTC) X-T2-Spam-Status: No, hits=-1.0 required=5.0 tests=ALL_TRUSTED Received: from [176.74.213.204] (account mc467741@c2i.net HELO laptop015.hselasky.homeunix.org) by mailfe09.swip.net (CommuniGate Pro SMTP 5.4.4) with ESMTPA id 164225479; Wed, 31 Oct 2012 10:36:06 +0100 From: Hans Petter Selasky To: sox-devel@lists.sourceforge.net Subject: Re: [SoX-devel] Bug in sox-14.3.2/src/oss.c Date: Wed, 31 Oct 2012 10:37:46 +0100 User-Agent: KMail/1.13.7 (FreeBSD/9.1-PRERELEASE; KDE/4.8.4; amd64; ; ) References: <201210281324.36923.hselasky@c2i.net> <20121031090350.GA8165@dcvr.yhbt.net> In-Reply-To: <20121031090350.GA8165@dcvr.yhbt.net> X-Face: 'mmZ:T{)),Oru^0c+/}w'`gU1$ubmG?lp!=R4Wy\ELYo2)@'UZ24N@d2+AyewRX}mAm; Yp |U[@, _z/([?1bCfM{_"B<.J>mICJCHAzzGHI{y7{%JVz%R~yJHIji`y>Y}k1C4TfysrsUI -%GU9V5]iUZF&nRn9mJ'?&>O MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201210311037.46581.hselasky@c2i.net> Cc: freebsd-multimedia@freebsd.org, Eric Wong X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Oct 2012 09:41:15 -0000 On Wednesday 31 October 2012 10:03:50 Eric Wong wrote: > Hans Petter Selasky wrote: > > Hi, > > > > Line buffering should be off, but this statement leads to SOX reading 1 > > and > > > > one byte from the recording DSP device under FreeBSD: > > /* Change to non-buffered I/O */ > > setvbuf(ft->fp, NULL, _IONBF, sizeof(char) * file->size); > > return(SOX_SUCCESS); > > > > I think this flag should be used instead: > > _IOFBF fully buffered > > > > I've tested this change and it works like expected. > > > > Any comments? > > The code you're changing in src/oss.c no long applies to SoX 14.4.0, > how does 14.4.0 work out-of-the-box for you? > Hi, First observation: oss.c: In function 'ossinit': oss.c:116: warning: dereferencing 'void *' pointer oss.c:116: error: request for member '_file' in something not a structure or union oss.c:124: warning: dereferencing 'void *' pointer oss.c:124: error: request for member '_file' in something not a structure or union oss.c:163: warning: dereferencing 'void *' pointer oss.c:163: error: request for member '_file' in something not a structure or union oss.c:176: warning: dereferencing 'void *' pointer oss.c:176: error: request for member '_file' in something not a structure or union oss.c:186: warning: dereferencing 'void *' pointer oss.c:186: error: request for member '_file' in something not a structure or union oss.c:205: warning: dereferencing 'void *' pointer oss.c:205: error: request for member '_file' in something not a structure or union oss.c:214: warning: dereferencing 'void *' pointer oss.c:214: error: request for member '_file' in something not a structure or union Fixed by renaming fileno( into sox_fileno( and defining this: #define sox_fileno(x) fileno((FILE *)(x)) Second observation: Default audio driver is not OSS. env AUDIODEVICE=/dev/dsp AUDIODRIVER=oss rec test.wav Third observation: GIO syscalls are still used, and the length is 1 byte. 15260 sox RET read 1 15260 sox CALL read(0x3,0x807b2de37,0x1) 15260 sox GIO fd 3 read 1 byte 0x0000 ff Patch needed: /* Change to non-buffered I/O */ setvbuf(ft->fp, NULL, _IONBF, sizeof(char) * file->size); return(SOX_SUCCESS); } Change to: /* Change to non-buffered I/O */ setvbuf(ft->fp, NULL, _IOFBF, sizeof(char) * file->size); return(SOX_SUCCESS); } --HPS