Dynamic Audio through WebRTC

Antonio Morales antonio.morales1990 at gmail.com
Wed Jun 12 18:23:29 UTC 2019


Hi

I'm working on sending prerecorded mp3 files through a WebRTC audio channel
via the webrtcbin element. The time the files are played can't be
determined at start time so the pipeline has to be dynamic. I have a
working example, with the equivalent pipeline description being

audiotestsrc wave=silence ! audio/x-raw,rate=16000 ! audioresample !
input-selector name=selector ! queue ! audioconvert ! audioresample !
opusenc ! rtpopuspay !
appliation/x-rtp,media=audio,encoding-name=OPUS,payload=111,clock-rate=48000
! queue appsrc ! decodebin ! selector.

When it comes to the point the file needs to be played I add the appsrc and
decodebin to the pipeline and change the active pad for the input-selector.
After that I leave the active pad for the input-selector unchanged and
subsequent files pushed through appsrc are played correctly.

The problem with the above approach is that the first 2 files can't be
heard on the receiving end of the WebRTC connection, but the 3rd and
subsequent files do play correctly. I think the problem occurs when
changing the active-pad for the input-selector element, but the active-pad
is only changed once the pad added from decodebin is linked to the
input-selector.

I've tried to remove the use of the audiotestsrc and input-selector by just
"playing" a silent mp3 file through appsrc to get the negotiation working
and be able to link the decodebin to the rest of the pipeline, but when I
do that the pipeline just freezes.

The files we are playing are hosted on AWS S3 so I've also tried to use
souphttpsrc and uridecodebin to just read the file remotely. I set the
"location" (or equivalent) property by changing the source element to the
READY state, change the location property, then set the element state back
to PLAYING. This works for the first file, but as soon as the file is
finished playing the pipeline becomes unresponsive and I'm unable to play
subsequent files.

I can provide more details if necessary, but I would appreciate any ideas
or guidance on how to proceed with this issue.

Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20190612/f45d557e/attachment.html>


More information about the gstreamer-devel mailing list