[Alsasrc] System hang once disconnect the device, while pipeline is alive

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

[Alsasrc] System hang once disconnect the device, while pipeline is alive

pawan.ec
Hi All,

I am gettign this behaviour:

1. Create pipeline containing the AlsaSrc, Caps, and alsasink.
2. set state to Playing
3. disconnect device (i.e. alsasrc, which is something like hw:2,0)

Now if i get the sound card removal event in time i set the pipeline state to null and everything works fine.
But if it is delayed then my app hangs (at the gst_element_set_state(m_AudioPipeline, GST_STATE_NULL)) and below is the continuous error which i am getting after that.

SNDRV_PCM_IOCTL_PREPARE failed (-19): No such device

Please help, i am very much new to audio so not getting the clear idea.
Reply | Threaded
Open this post in threaded view
|

Re: [Alsasrc] System hang once disconnect the device, while pipeline is alive

pawan.ec
have i posted at the right place?
Reply | Threaded
Open this post in threaded view
|

Re: [Alsasrc] System hang once disconnect the device, while pipeline is alive

Tim-Philipp Müller-2
In reply to this post by pawan.ec
On Sun, 2012-12-09 at 22:15 -0800, pawan.ec wrote:

Hi,

> I am gettign this behaviour:
>
> 1. Create pipeline containing the AlsaSrc, Caps, and alsasink.
> 2. set state to Playing
> 3. disconnect device (i.e. alsasrc, which is something like hw:2,0)
>
> Now if i get the sound card removal event in time i set the pipeline state
> to null and everything works fine.
> But if it is delayed then my app hangs (at the
> gst_element_set_state(m_AudioPipeline, GST_STATE_NULL)) and below is the
> continuous error which i am getting after that.
>
> SNDRV_PCM_IOCTL_PREPARE failed (-19): No such device
>
> Please help, i am very much new to audio so not getting the clear idea.

It was a bug in alsasrc/GstAudio*Src. It's fixed now in git master.
Thanks for filing a bug about it in bugzilla (assuming it was you, I
don't remember).

 Cheers
  -Tim

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: [Alsasrc] System hang once disconnect the device, while pipeline is alive

Ralph
> Now if i get the sound card removal event in time i set the pipeline state
> to null and everything works fine.

Can I ask what is this "sound card removal event"?  I have a similar problem on Windows (my question) - when I disconnect the audio device, the pipeline stalls and it is not possible to play it again.
How can I detect situations when an audiosink's device has been disabled or disconnected?  I will have no problem reconfiguring the pipeline to allow playback, but I need to know when it happens.
Reply | Threaded
Open this post in threaded view
|

Re: [Alsasrc] System hang once disconnect the device, while pipeline is alive

Tim-Philipp Müller-2
On Thu, 2012-12-20 at 04:58 -0800, Ralph wrote:

> > Now if i get the sound card removal event in time i set the pipeline state
> > to null and everything works fine.
>
> Can I ask what is this "sound card removal event"?  I have a similar problem
> on Windows ( my question
> <http://gstreamer-devel.966125.n4.nabble.com/How-to-handle-disconnecting-the-headphones-td4657352.html>
> ) - when I disconnect the audio device, the pipeline stalls and it is not
> possible to play it again.
> How can I detect situations when an audiosink's device has been disabled or
> disconnected?  I will have no problem reconfiguring the pipeline to allow
> playback, but I need to know when it happens.

In this case it was an USB audio device.

The various alsa functions would just return an error with a ENODEV
error code if I yank the cable during recording/playback, but I assume
there's some kind of event notification in upper layers (usb/udev/device
manager) as well.

Cheers
 -Tim

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: [Alsasrc] System hang once disconnect the device, while pipeline is alive

pawan.ec
In reply to this post by Ralph

Yes udev snd can notify u for remove event

On Dec 20, 2012 9:58 PM, "Ralph [via GStreamer-devel]" <[hidden email]> wrote:
> Now if i get the sound card removal event in time i set the pipeline state
> to null and everything works fine.

Can I ask what is this "sound card removal event"?  I have a similar problem on Windows (my question) - when I disconnect the audio device, the pipeline stalls and it is not possible to play it again.
How can I detect situations when an audiosink's device has been disabled or disconnected?  I will have no problem reconfiguring the pipeline to allow playback, but I need to know when it happens.


To unsubscribe from [Alsasrc] System hang once disconnect the device, while pipeline is alive, click here.
NAML
Reply | Threaded
Open this post in threaded view
|

Re: [Alsasrc] System hang once disconnect the device, while pipeline is alive

Ralph
I am not able to receive any special events when I disconnect the audio device.
I'm listening to events on autoaudiosink's sink pad.  The code below is in C#:

audioSink.SinkPads.Cast<Gst.Pad>().First().EventFunction = PadEventFunction;

private bool PadEventFunction(Gst.Pad pad, Gst.Event evnt)
{
    if (evnt.Type == Gst.EventType.<?which type?>)
    {
        //do something
        return true;
    }

    return pad.EventDefault(evnt);
}


All I can receive are NewSegment, FlushStart or other standard events, nothing happens when I disconnect the audio device.