This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

DRA72XEVM: failed to play multiple audio simultaneously

Part Number: DRA72XEVM

Hi,

I have a qt app wherein there can be a possibility of playing multiple audio files simultaneously. The app uses gstreamer pipelines to do so. But the app fails to play the audio files at the same time. and returns error

"Failed to connect : Connection refused"

Any help??

  • Hi Sam,
    Are you seeing this error as soon as you start audio playback of second instance?
    Can you share few more details ? What are the property settings for alsasink ?
  • Hi Ram,

    I enabled the GST_DEBUG option and on playing the first audio file through qml

    0:03:49.969773410 1598 0x15402e0 WARN pulse pulsesink.c:615:gst_pulseringbuffer_open_device:<audiosink-actual-sink-pulse> error: Failed to connect: Connection refused
    0:03:49.972984125 1598 0x15402e0 WARN basesrc gstbasesrc.c:3481:gst_base_src_start_complete:<source> pad not activated yet
    0:03:49.974116610 1598 0x15402e0 WARN basesrc gstbasesrc.c:3481:gst_base_src_start_complete:<source> pad not activated yet
    qml: clicked-----------------
    0:03:49.976592234 1598 0xb29e1030 WARN alsa conf.c:4595:parse_args: alsalib error: Unknown parameter AES0
    0:03:49.976662506 1598 0xb29e1030 WARN alsa conf.c:4755:snd_config_expand: alsalib error: Parse arguments error: No such file or directory
    0:03:49.976712607 1598 0xb29e1030 WARN alsa pcm.c:2266:snd_pcm_open_noupdate: alsalib error: Unknown PCM default:{AES0 0x02 AES1 0x82 AES2 0x00 AES3 0x02}
    0:03:50.037797682 1598 0xaf9abac0 WARN alsa pcm_hw.c:1241:snd_pcm_hw_get_chmap: alsalib error: Cannot read Channel Map ctl
    : No such file or directory
    0:03:50.079723063 1598 0x15402e0 FIXME bin gstbin.c:4075:gst_bin_query: implement duration caching in GstBin again
    0:03:50.080129242 1598 0x15402e0 FIXME bin gstbin.c:4075:gst_bin_query: implement duration caching in GstBin again
    0:03:50.080318260 1598 0x15402e0 FIXME bin gstbin.c:4075:gst_bin_query: implement duration caching in GstBin again
    0:03:50.080543716 1598 0x15402e0 FIXME bin gstbin.c:4075:gst_bin_query: implement duration caching in GstBin again
    0:03:50.080817484 1598 0x15402e0 FIXME bin gstbin.c:4075:gst_bin_query: implement duration caching in GstBin again
    0:03:50.083598271 1598 0x15402e0 FIXME bin gstbin.c:4075:gst_bin_query: implement duration caching in GstBin again
    0:03:50.083865858 1598 0x15402e0 FIXME bin gstbin.c:4075:gst_bin_query: implement duration caching in GstBin again
    0:03:50.084145807 1598 0x15402e0 FIXME bin gstbin.c:4075:gst_bin_query: implement duration caching in GstBin again
    0:03:50.084327994 1598 0x15402e0 FIXME bin gstbin.c:4075:gst_bin_query: implement duration caching in GstBin again
    0:03:50.084530026 1598 0x15402e0 FIXME bin gstbin.c:4075:gst_bin_query: implement duration caching in GstBin again



    and on playing the second audio while the first one is still running the following output is observed,

    0:04:38.253074645 1598 0x15402e0 WARN pulse pulsesink.c:615:gst_pulseringbuffer_open_device:<audiosink-actual-sink-pulse> error: Failed to connect: Connection refused
    0:04:38.255316192 1598 0x15402e0 WARN alsa pcm_hw.c:1590:snd_pcm_hw_open: alsalib error: open '/dev/snd/pcmC0D0p' failed (-16): Device or resource busy
    0:04:38.255607365 1598 0x15402e0 WARN alsa gstalsasink.c:846:gst_alsasink_open:<audiosink-actual-sink-alsa> Error -16 (Device or resource busy) calling snd_pcm_open (&alsa->handle, alsa->device, SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK)
    0:04:38.255796546 1598 0x15402e0 WARN alsa gstalsasink.c:858:gst_alsasink_open:<audiosink-actual-sink-alsa> error: Could not open audio device for playback. Device is being used by another application.
    0:04:38.255954821 1598 0x15402e0 WARN alsa gstalsasink.c:858:gst_alsasink_open:<audiosink-actual-sink-alsa> error: Device 'default' is busy
    0:04:38.256423464 1598 0x15402e0 WARN oss gstosssink.c:399:gst_oss_sink_open:<audiosink-actual-sink-oss> error: Could not open audio device for playback.
    0:04:38.256587269 1598 0x15402e0 WARN oss gstosssink.c:399:gst_oss_sink_open:<audiosink-actual-sink-oss> error: system error: No such file or directory
    0:04:38.258492909 1598 0x15402e0 WARN basesrc gstbasesrc.c:3481:gst_base_src_start_complete:<source> pad not activated yet
    0:04:38.259720717 1598 0x15402e0 WARN basesrc gstbasesrc.c:3481:gst_base_src_start_complete:<source> pad not activated yet
    qml: player1.source: file:///home/root/GoodEvening.mp3
    qml: in play triggered
    0:04:38.288671968 1598 0xb1702350 FIXME id3v2 gstid3tag.c:142:gst_tag_from_id3_tag: Cannot map ID3v2 tag 'TLAN' to GStreamer tag
    0:04:38.289176397 1598 0xb1702350 WARN id3v2 id3v2frames.c:261:parse_comment_frame: Failed to decode comment frame
    0:04:38.289332720 1598 0xb1702350 WARN id3v2 id3v2frames.c:306:parse_comment_frame: failed to parse COMM frame
    Warning: "Failed to connect: Connection refused"
    0:04:38.554135346 1598 0x15402e0 FIXME bin gstbin.c:4075:gst_bin_query: implement duration caching in GstBin again
    0:04:38.554242218 1598 0x15402e0 FIXME bin gstbin.c:4075:gst_bin_query: implement duration caching in GstBin again
    0:04:38.554312978 1598 0x15402e0 FIXME bin gstbin.c:4075:gst_bin_query: implement duration caching in GstBin again
    0:04:38.554375279 1598 0x15402e0 FIXME bin gstbin.c:4075:gst_bin_query: implement duration caching in GstBin again
    0:04:38.554421964 1598 0x15402e0 FIXME bin gstbin.c:4075:gst_bin_query: implement duration caching in GstBin again



    So it shows that the device is still busy with the first one, what can be done??


    Regards,
    Sam
  • Hi Sam,
    I am not sure if this is the limitation of alsasink plugin or audio driver. I haven't tried multiple audio playback with gstreamer. Will give a try.
    Does aplay work fine for multiple instances?
  • Hi Ram,

    Aplay also fails to play multiple instances and throws error as resource busy.

  • It's not possible to play multiple audio files at the same time on the same ALSA PCM device (i.e. using aplay command). If the expectation was to have those audio files mixed together before rendering, then you have to use another component in charge of mixing the streams beforehand (i.e. ALSA dmix plugin).

  • Thanks Misael,
    Can you please tell how to use this plugin in our case? Or are there any steps involved to enable this plugin?

    Regards,
    Sam
  • You have to edit your .asoundrc file to create a virtual device, see "1.5 5. The simple approach" here.

    It seems that gstreamer has its own audio mixer but I'm not versed on that topic and can't help there.

  • I created .asoundrc file and edited it as given in the approach but still no luck. It gives the same error.
  • Did you try using the virtual device name that you added in the asound.rc file?

    If you named the virtual device as in the link that I shared, the you should have run "aplay -Ddsp0".
  • Thanks Misael and Ram
    The issue is resolved. I made dsp0 as default. So multiple audio are playing fine. But at the same time it affected the audio in via mic as it cannot handle audio input. So made a small change in my program by setting alsasrc device as sysdefault. And it also worked. Thanks once again.:)