simultaneous sound as many users

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

simultaneous sound as many users

Roman Gorelov
My sndio configuration is default, OBSD 5.9.
When I run a media file in e.g. mpv, and pause it without closing, and
try to listen to smth in chrome _as another user_, there is no sound:

[12530:2084997376:0402/012418:ERROR:sndio_output.cc(65)] Couldn't open audio device.

Reverse is true, if I listened to anything in chrome first, mpv as
another user fails to play audio:

 (+) Video --vid=1 (mpeg4)
 (+) Audio --aid=1 (ac3)
[ao/sndio] can't open sndio default
[ao] Failed to initialize audio driver 'sndio'
Could not open/initialize audio device -> no sound.
Audio: no audio

Doing this as a same user works, but is there a way to do it as many
users at once?

Reply | Threaded
Open this post in threaded view
|

Re: simultaneous sound as many users

Nils Reuße-4
On 04/01/2016 08:42 PM, Roman Gorelov wrote:
> My sndio configuration is default, OBSD 5.9.
> When I run a media file in e.g. mpv, and pause it without closing, and
> try to listen to smth in chrome _as another user_, there is no sound:
>

Hi Roman,

you need to share your sndio session cookie between the two users.  I
got it working previously (the same problem arises with mpd, where the
daemon runs as a separate user).  There should be a file called
`~/.aucat_cookie` in your home-dir, and if i remember correctly, you
just need to copy this file to the second users home dir.  Will check
later when i'm back at home.

 From sndio(7):

AUTHENTICATION

   If a shared sndiod(8) server is running, for privacy reasons only one
   user may have connections to it at a given time (though the same user
   could have multiple connections to it).  Users are identified by their
   session cookie, which is automatically generated by audio or MIDI
   applications upon the first connection to the server.  The cookie is
   stored in $HOME/.aucat_cookie and contains 128 bits of raw random
   data.

   If a session needs to be shared between multiple users, they can
   connect to the server using the same cookie.


Hope that helps
Nils

Reply | Threaded
Open this post in threaded view
|

Re: simultaneous sound as many users

Benjamin Baier
In reply to this post by Roman Gorelov
On Sat, 2 Apr 2016 01:42:03 +0700
Roman Gorelov <[hidden email]> wrote:

> My sndio configuration is default, OBSD 5.9.
> When I run a media file in e.g. mpv, and pause it without closing, and
> try to listen to smth in chrome _as another user_, there is no sound:

You need to share the .aucat_cookie with all the users that are allowed
to play sound at the same time.
Permissions and uid are important, too. Don't try to share with a
symlink.

$ ls -lah /home/*en*/.aucat_cookie
-rw-------  1 ben   ben    16B Aug 18  2015 /home/ben/.aucat_cookie
-rw-------  1 enc   ben    16B Aug 18  2015 /home/enc/.aucat_cookie
-rw-------  1 enc1  ben    16B Sep 24  2015 /home/enc1/.aucat_cookie
-rw-------  1 enc2  ben    16B Aug 23  2015 /home/enc2/.aucat_cookie

Greetings Ben

Reply | Threaded
Open this post in threaded view
|

Re: simultaneous sound as many users

Roman Gorelov
On Sat, Apr 02, 2016 at 11:24:47AM +0200, Benjamin Baier wrote:

> On Sat, 2 Apr 2016 01:42:03 +0700
> Roman Gorelov <[hidden email]> wrote:
>
> > My sndio configuration is default, OBSD 5.9.
> > When I run a media file in e.g. mpv, and pause it without closing, and
> > try to listen to smth in chrome _as another user_, there is no sound:
>
> You need to share the .aucat_cookie with all the users that are allowed
> to play sound at the same time.
> Permissions and uid are important, too. Don't try to share with a
> symlink.

Thank you for the answer.
It could very well be "RTFM sndio, section AUTHENTICATION"...

Reply | Threaded
Open this post in threaded view
|

Re: simultaneous sound as many users

Marc Espie-2
In reply to this post by Nils Reuße-4
On Sat, Apr 02, 2016 at 09:26:40AM +0200, Nils Reuße wrote:

> On 04/01/2016 08:42 PM, Roman Gorelov wrote:
> >My sndio configuration is default, OBSD 5.9.
> >When I run a media file in e.g. mpv, and pause it without closing, and
> >try to listen to smth in chrome _as another user_, there is no sound:
> >
>
> Hi Roman,
>
> you need to share your sndio session cookie between the two users.  I got it
> working previously (the same problem arises with mpd, where the daemon runs
> as a separate user).  There should be a file called `~/.aucat_cookie` in
> your home-dir, and if i remember correctly, you just need to copy this file
> to the second users home dir.  Will check later when i'm back at home.
>
> From sndio(7):
>
> AUTHENTICATION
>
>   If a shared sndiod(8) server is running, for privacy reasons only one
>   user may have connections to it at a given time (though the same user
>   could have multiple connections to it).  Users are identified by their
>   session cookie, which is automatically generated by audio or MIDI
>   applications upon the first connection to the server.  The cookie is
>   stored in $HOME/.aucat_cookie and contains 128 bits of raw random
>   data.
>
>   If a session needs to be shared between multiple users, they can
>   connect to the server using the same cookie.

This looks slightly bogus to me.   Using sndio in record mode, I understand
the privacy concerns. But for playing ?....

Reply | Threaded
Open this post in threaded view
|

Re: simultaneous sound as many users

Nils Reuße-4
In reply to this post by Roman Gorelov
As a remark, to simultaneously listen to mpds music and the sound of a
youtube video in Firefox (running under your user), you have to copy
your cookie to /var/empty/ (_mpds home dir).

$ doas ls -l .aucat_cookie /var/empty/.aucat_cookie
-rw-------  1 nils  nils  16 May 29  2015 .aucat_cookie
-rw-------  1 _mpd  _mpd  16 May 29  2015 /var/empty/.aucat_cookie

$ doas sha1 -r .aucat_cookie /var/empty/.aucat_cookie
e8d33a71594c0ba7816e075d17afa81e0ba220ce .aucat_cookie
e8d33a71594c0ba7816e075d17afa81e0ba220ce /var/empty/.aucat_cookie

Reply | Threaded
Open this post in threaded view
|

Re: simultaneous sound as many users

Alexandre Ratchov-2
In reply to this post by Marc Espie-2
On Sat, Apr 02, 2016 at 05:50:33PM +0200, Marc Espie wrote:

> On Sat, Apr 02, 2016 at 09:26:40AM +0200, Nils Reuße wrote:
> > On 04/01/2016 08:42 PM, Roman Gorelov wrote:
> > >My sndio configuration is default, OBSD 5.9.
> > >When I run a media file in e.g. mpv, and pause it without closing, and
> > >try to listen to smth in chrome _as another user_, there is no sound:
> > >
> >
> > Hi Roman,
> >
> > you need to share your sndio session cookie between the two users.  I got it
> > working previously (the same problem arises with mpd, where the daemon runs
> > as a separate user).  There should be a file called `~/.aucat_cookie` in
> > your home-dir, and if i remember correctly, you just need to copy this file
> > to the second users home dir.  Will check later when i'm back at home.
> >
> > From sndio(7):
> >
> > AUTHENTICATION
> >
> >   If a shared sndiod(8) server is running, for privacy reasons only one
> >   user may have connections to it at a given time (though the same user
> >   could have multiple connections to it).  Users are identified by their
> >   session cookie, which is automatically generated by audio or MIDI
> >   applications upon the first connection to the server.  The cookie is
> >   stored in $HOME/.aucat_cookie and contains 128 bits of raw random
> >   data.
> >
> >   If a session needs to be shared between multiple users, they can
> >   connect to the server using the same cookie.
>
> This looks slightly bogus to me.   Using sndio in record mode, I understand
> the privacy concerns. But for playing ?....

For instance, we don't want other users to play sounds during VoIP
calls.