Stefan Westerfeld | 2 Oct 2005 23:59
Picon

Jack driver double free fix

   Hi!

While chasing stability problems in beast, I found that the pa_jack
driver of portaudio frees the jack_port_t pointers obtained from the
libjack API (from jack_port_by_name). This causes double-frees, which
cause crashes.

I checked the jack documentation at

  http://jackit.sourceforge.net/docs/reference/html/jack_8h.html

just to be sure whether it is the portaudio drivers responsibilty to
free the jack_port_t's or libjacks responsibility. As the documentation
explicitely indicates when memory should be freed by the client, I
assume what isn't mentioned there should probably not be freed by the
client. I also checked the libjack source, just to be sure.

Both, the documentation and the libjack source say that portaudio is
wrong here. Attached is a diff against Portaudio CVS.

Btw, this mail:

  http://techweb.rfa.org/pipermail/portaudio/2005-July/004648.html

also contains a partial fix for the same problem.

   Cu... Stefan
--

-- 
Stefan Westerfeld, Hamburg/Germany, http://space.twc.de/~stefan
(Continue reading)

Arve Knudsen | 3 Oct 2005 00:29
Picon
Favicon

Re: Jack driver double free fix

Stefan, from the looks of it you're completely right. I'm at a loss as to  
exactly how this snuck in there. The reference says absolutely nothing  
about freeing memory returned from jack_port_by_name, thanks for reporting  
this. I've just committed your fix. I see the mail you linked to refer to  
the same problem, not sure how that evaded my attention :| A possible  
explanation with regards to the latter could be some problems with spam  
filtering I experienced earlier.

Arve

On Sun, 02 Oct 2005 23:59:29 +0200, Stefan Westerfeld  
<stefan <at> space.twc.de> wrote:

>    Hi!
>
> While chasing stability problems in beast, I found that the pa_jack
> driver of portaudio frees the jack_port_t pointers obtained from the
> libjack API (from jack_port_by_name). This causes double-frees, which
> cause crashes.
>
> I checked the jack documentation at
>
>   http://jackit.sourceforge.net/docs/reference/html/jack_8h.html
>
> just to be sure whether it is the portaudio drivers responsibilty to
> free the jack_port_t's or libjacks responsibility. As the documentation
> explicitely indicates when memory should be freed by the client, I
> assume what isn't mentioned there should probably not be freed by the
> client. I also checked the libjack source, just to be sure.
>
(Continue reading)

Bjorn Roche | 5 Oct 2005 15:57
Favicon
Gravatar

core audio mono & seperate in/out dev support

Hey PA folks,

 	there is a note in the pa_mac_core folder which reads in part:

--------------

We do not yet support simultaneous input and output on different
devices. Note that some CoreAudio devices like the Roland UH30 look
like one device but are actually two different CoreAudio devices. The
BuiltIn audio is typically one CoreAudio device.

Mono doesn't work.

--------------

 	I guess I knew this at some point, but I also have a vague memory 
of using my cheap USB mono mike on OS 10.3 some time ago. Anyway, using 
patest_wire today produces a bus error when used with that same cheap USB 
mike on OS 10.4. This is obviously pretty nasty.

 	So.... this is worth something to me to have it fixed. I'd love to 
fix it myself and the code looks managable, but it's been forever 
since I touched PA code and that was on unix.

 	If someone could give me some pointers and maybe chat with me on 
the phone I would really appretiate it. Moreover, if someone wants to 
tackle this, I am willing to offer a token sum as an incentive (I hope it 
is not gauche to make such an offer on this list...).

TIA,
(Continue reading)

Bjorn Roche | 5 Oct 2005 17:55
Favicon
Gravatar

small patch for pa_mac_core.c

Here's a small patch for pa_mac_core.c (attached and copied below).

- replaced some tabs with spaces.
- commented out an unused static function and labeled as such.
- fixed functions that were declared to return a value but did not contain 
a return statement.

It now compiles without warnings.

Also, not sure how, but before, my mono mike reported some large negative 
number of output channels. Now it reports zero, which is correct. (it's 
possible this was due to a change n my code -- I wasn't keeping careful 
track)

Of course, it still bus errors when I try to record.

 	bjorn

-------------
Bjorn Roche
Check out my CD Mastering Software
for Mac OS X : http://www.xowave.com

*** pa_mac_core.c-orig	2005-10-05 11:29:36.000000000 -0400
--- pa_mac_core.c	2005-10-05 11:43:40.000000000 -0400
***************
*** 160,166 ****

       return result;
   }
(Continue reading)

Bjorn Roche | 5 Oct 2005 20:37
Favicon
Gravatar

Re: core audio mono & seperate in/out dev support

On Wed, 5 Oct 2005, Bjorn Roche wrote:

> 	I guess I knew this at some point, but I also have a vague memory of 
> using my cheap USB mono mike on OS 10.3 some time ago. Anyway, using 
> patest_wire today produces a bus error when used with that same cheap USB 
> mike on OS 10.4. This is obviously pretty nasty.

I seem to have done this myself, but the fix was so simple (attached and 
below) I am concerned that I missed something obvious like setting up a 
buffer or something. In fact the code is really no more complex now than 
it was before, so I am thinking the fix could not be this easy....

thoughts/feedback would be much appreciated.

Patch below and attached.

 	bjorn

-------------
Bjorn Roche
Check out my CD Mastering Software
for Mac OS X : http://www.xowave.com

*** pa_mac_core.c-orig	2005-10-05 11:29:36.000000000 -0400
--- pa_mac_core.c	2005-10-05 13:34:02.000000000 -0400
***************
*** 160,166 ****

       return result;
   }
(Continue reading)

Eric Dantan Rzewnicki | 6 Oct 2005 00:10

Re: Jack driver double free fix

On Mon, Oct 03, 2005 at 12:29:02AM +0200, Arve Knudsen wrote:
> Stefan, from the looks of it you're completely right. I'm at a loss as to  
> exactly how this snuck in there. The reference says absolutely nothing  
> about freeing memory returned from jack_port_by_name, thanks for reporting  
> this. I've just committed your fix. I see the mail you linked to refer to  
> the same problem, not sure how that evaded my attention :| A possible  
> explanation with regards to the latter could be some problems with spam  
> filtering I experienced earlier.
> 
> Arve

Arve, Stefan,

are either of you familiar with the reports that audacity's jack support
seems to play incorrectly with jack? connecting and disconnecting from
the graph each time playback is started/stopped.

Could this be the root of that errant behaviour?

--

-- 
Eric Dantan Rzewnicki  |  Systems Administrator
Technical Operations Division  |  Radio Free Asia
2025 M Street, NW  |  Washington, DC 20036  |  202-530-4900
CONFIDENTIAL COMMUNICATION
This e-mail message is intended only for the use of the addressee and
may contain information that is privileged and confidential. Any 
unauthorized dissemination, distribution, or copying is strictly 
prohibited. If you receive this transmission in error, please contact
network <at> rfa.org.
(Continue reading)

SMITH Linton | 6 Oct 2005 00:20

RE: Jack driver double free fix


I asked that exact question quite a while back and got no response from
either the audacity developers or the portaudio developers.  
Can we get an answer this time?

regards

Linton Smith

-----Original Message-----
From: portaudio-admin <at> techweb.rfa.org
[mailto:portaudio-admin <at> techweb.rfa.org] On Behalf Of Eric Dantan
Rzewnicki
Sent: Thursday, 6 October 2005 7:40 AM
To: Arve Knudsen
Cc: Portaudio <at> techweb.rfa.org
Subject: Re: [Portaudio] Jack driver double free fix

On Mon, Oct 03, 2005 at 12:29:02AM +0200, Arve Knudsen wrote:
> Stefan, from the looks of it you're completely right. I'm at a loss as
to  
> exactly how this snuck in there. The reference says absolutely nothing

> about freeing memory returned from jack_port_by_name, thanks for
reporting  
> this. I've just committed your fix. I see the mail you linked to refer
to  
> the same problem, not sure how that evaded my attention :| A possible

> explanation with regards to the latter could be some problems with
(Continue reading)

Arve Knudsen | 6 Oct 2005 01:47
Picon
Favicon

Re: Jack driver double free fix

This behaviour is news to me, but I haven't used Audacity in a while.  
Unless someone comes up with an answer in the meantime, I'll investigate  
the matter once I have the time.

Arve

On Thu, 06 Oct 2005 00:20:09 +0200, SMITH Linton <Linton.SMITH <at> Tenix.com>  
wrote:

>
> I asked that exact question quite a while back and got no response from
> either the audacity developers or the portaudio developers.
> Can we get an answer this time?
>
> regards
>
> Linton Smith
>
> -----Original Message-----
> From: portaudio-admin <at> techweb.rfa.org
> [mailto:portaudio-admin <at> techweb.rfa.org] On Behalf Of Eric Dantan
> Rzewnicki
> Sent: Thursday, 6 October 2005 7:40 AM
> To: Arve Knudsen
> Cc: Portaudio <at> techweb.rfa.org
> Subject: Re: [Portaudio] Jack driver double free fix
>
> On Mon, Oct 03, 2005 at 12:29:02AM +0200, Arve Knudsen wrote:
>> Stefan, from the looks of it you're completely right. I'm at a loss as
> to
(Continue reading)

hs | 6 Oct 2005 15:42
Picon
Favicon

synchronizing microphone and loudspeaker signal on windows


Hi!

I want to use echo cancelation algorithm that I found on openh323 web site.
But it requeries both microphone and loudspeakers signals to be  
synchronized
sample-to-sample. On linux it's easy, because you can set some special  
stereo mode
and have signal recorded from microphone and played on loudspeakers in one  
stereo signal.
So the signals are synchronized.
But on windows using waveIn and waveOut you have two events that returns  
buffers from microphone and loudspeaker that are not synchronized.
Does Portaudio supports this stereo mode on windows? Can I get these two  
signals with portaudio synchronized?

thanks in advance for any help
hs
Hubert Sokołowski | 7 Oct 2005 14:15
Picon
Favicon

ASIO + writing callback funtions


Hi!

I am using portaudio with ASIO on windows in ms vc++ 2003.
The driver is asio4all. My question is whether the callback is called from  
another thread or not? I got strange locks in my app.

I had to declare the callback function static in a file, because  
compilation fails when I declare the callback in a class with error
cannot convert from 'overloaded-function'

I hope someone will read it and reply
regards
hs

Gmane