jackaudio / jack2

jack2 codebase
GNU General Public License v2.0
2.21k stars 373 forks source link

jack_port_get_connections() ignores owned port status #47

Open falkTX opened 10 years ago

falkTX commented 10 years ago

According to the JACK API, jack_port_get_connections() should only return connections if we're the owner of the port. See: http://jackaudio.org/files/docs/html/group__PortFunctions.html#ga4e1bd29a68acb4fb45f75931de0d36b2 (2nd note)

But in JACK2, using that function always returns non-NULL for all ports (like system:* ones). JACK2 should verify if we own the port being passed in the function parameter, and return NULL if not.

related code is at https://github.com/jackaudio/jack2/blob/master/common/JackAPI.cpp#L1097

sletz commented 10 years ago

Le 25 déc. 2013 à 22:55, falkTX notifications@github.com a écrit :

According to the JACK API, jack_port_get_connections() should only return connections if we're the owner of the port. See: http://jackaudio.org/files/docs/html/group__PortFunctions.html#ga4e1bd29a68acb4fb45f75931de0d36b2 (2nd note)

But in JACK2, using that function always returns non-NULL for all ports (like system:* ones). JACK2 should verify if we own the port being passed in the function parameter, and return NULL if not.

related code is at https://github.com/jackaudio/jack2/blob/master/common/JackAPI.cpp#L1097

— Reply to this email directly or view it on GitHub.

How do we know that "we own the port" since jack_port_get_connections does not have a jack_client_t* parameter ?

Stéphane

falkTX commented 10 years ago

afaik "owning the port" refers to the calling process. not sure how jack1 does it, I'll check the code.

EDIT: relevant code is here: https://github.com/jackaudio/jack1/blob/master/libjack/port.c#L345

sletz commented 10 years ago

On Mon, Jan 6, 2014 at 4:21 AM, Stéphane Letz letz@grame.fr wrote:

Le 25 déc. 2013 à 22:55, falkTX notifications@github.com a écrit :

According to the JACK API, jack_port_get_connections() should only return connections if we're the owner of the port. See:

The text reads:

2) You need not be the owner of the port to get information about its connections.

The third word is "NOT"

falkTX commented 10 years ago

Yes, correct.

the _jack_port_get_allconnections function has that info, but perhaps you're missing the context. quoting from http://jackaudio.org/files/docs/html/group__PortFunctions.html#ga4e1bd29a68acb4fb45f75931de0d36b2

const char** jack_port_get_all_connections(....)

This differs from jack_port_get_connections() in two important respects:
2) You need not be the owner of the port to get information about its connections.

This implies that for _jack_port_getconnections() we need to be the owner of the port, while for _jack_port_get_allconnections() we do not.

I was bitten by this because I was using only jack2 and _jack_port_getconnections(). When I tested my app in JACK1 no system connections were shown in my patchbay.

pauldavisthefirst commented 10 years ago

I think that the implication that you read here was not intended, and simply reflects the fact that jack_port_get_connections() requires a jack_port_t* which is hard to have unless you are the owner.

falkTX commented 10 years ago

not sure if this qualifies as "hard"... jack_port_t* port = jack_port_by_name(client, "system:playback_1");

anyway, because JACK1 implementation does returns NULL for ports that are not part of the current process client, my app was not working properly there. JACK2 did return all connections, so I never noticed the issue until I had to use JACK1.

having JACK1 and JACK2 behaving consistently is my target here. thanks

pauldavisthefirst commented 10 years ago

This has been discussed before. JACK2's internal port implementation is wildly different from JACK1's (and weaker, IMO, because of its fixed size design). It allows jack_port_by_name() to work for ports of other clients.

It would have been great if the original "spec" for the function had made the behaviour well-defined, but it didn't.

On Mon, Jan 6, 2014 at 11:22 AM, Filipe Coelho notifications@github.comwrote:

not sure if this qualifies as "hard"... jack_port_t* port = jack_port_by_name(client, "system:playback_1");

anyway, because JACK1 implementation does returns NULL for ports that are not part of the current process client, my app was not working properly there. JACK2 did return all connections, so I never noticed the issue until I had to use JACK1.

having JACK1 and JACK2 behaving consistently is my target here. thanks

— Reply to this email directly or view it on GitHubhttps://github.com/jackaudio/jack2/issues/47#issuecomment-31661309 .

sletz commented 10 years ago

blockquote {padding-left: 1ex; margin: 0px 0px 0px 0.8ex; border-left: #cccccc 1px solid;} p {margin: 0px;padding: 0px;} Dnia Poniedziałek, 6 Stycznia 2014 14:54 Paul Davis paul@linuxaudiosystems.com napisał(a)

On Mon, Jan 6, 2014 at 4:21 AM, Stéphane Letz letz@grame.fr wrote: Le 25 déc. 2013 ŕ 22:55, falkTX notifications@github.com a écrit : > According to the JACK API, jack_port_get_connections() should only return connections if we're the owner of the port. See:   The text reads:   2) You need not be the owner of the port to get information about its connections. The third word is "NOT"  

But this is about jack_port_get_all_connections, while falkTX ask for  jack_port_get_connections.   ;-)

sletz commented 10 years ago

On 6 January 2014 19:33, Pawel xj@wp.pl wrote:

But this is about jack_port_get_all_connections, while falkTX ask for jack_port_get_connections.

Yes, I noticed that, and just because jack_port_get_all_connections says -

"You need not be the owner of the port to get information about its connections."

I wouldn't necessarily read that as jack_port_get_connections meaning -

You need to be the owner of the port to get information about its connections.

I assumed that meant that jack_port_get_connections doesn't guarantee to provide this information for ports you don't own, not that it mustn't.

Best wishes,

Neil

Neil C Smith Artist : Technologist : Adviser http://neilcsmith.net

Praxis LIVE - open-source intermedia development - www.praxislive.org Digital Prisoners - interactive spaces and projections - www.digitalprisoners.co.uk OpenEye - the web, managed - www.openeye.info