How to dynamically link a sound to audiomixer plugin ?

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

How to dynamically link a sound to audiomixer plugin ?

toub
Hi all,
I'm developing an app which mixes wav streams together, using the audiomixer
plugin.
I got an issue regarding dynamic linking of new filesrc elements to a
playing audiomixer element.

So far, what I do is :
-  start a pipeline with only audiomixer->volume->audioconvert->alsasink
elements and put it in playing mode
- as soon as an event requesting sound streaming raises, I :
  - instantiate new sound elements : filesrc->wavparse->audioconvert->pitch,
gathered in a bin
  - link this bin to audiomixer, with a request pad retrieved by
gst_element_request_pad(audiomixer,
gst_element_class_get_pad_template(GST_ELEMENT_GET_CLASS(audiomixer),
"sink_%u"), NULL, NULL);
  - retrieve running time :
gst_clock_get_time(gst_element_get_clock(pipeline)) -
gst_element_get_base_time(pipeline);
  - apply running time as an offset on mixer sinkpad, so that new sound will
start from its beginning :
g_object_set(mixerSinkPad, "offset", RunningTime, NULL);
  - put sound bin in playing mode

It works fine for first sound (when running time is at 0, no offset is
applied). However, if I trigger a new sound (before previous sound is ended,
hence before EOS is raised on bus), its beginning is truncated. I've tried
to apply a greater offset, with same result. I've also tried to pause
audiomixer or previous sound's bin before adding new sound, it does'nt
change anything.

Any Idea ?




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

Re: How to dynamically link a sound to audiomixer plugin ?

Nicolas Dufresne-5
Le mercredi 10 janvier 2018 à 09:38 -0700, toub a écrit :

> Hi all,
> I'm developing an app which mixes wav streams together, using the audiomixer
> plugin.
> I got an issue regarding dynamic linking of new filesrc elements to a
> playing audiomixer element.
>
> So far, what I do is :
> -  start a pipeline with only audiomixer->volume->audioconvert->alsasink
> elements and put it in playing mode
> - as soon as an event requesting sound streaming raises, I :
>   - instantiate new sound elements : filesrc->wavparse->audioconvert->pitch,
> gathered in a bin
>   - link this bin to audiomixer, with a request pad retrieved by
> gst_element_request_pad(audiomixer,
> gst_element_class_get_pad_template(GST_ELEMENT_GET_CLASS(audiomixer),
> "sink_%u"), NULL, NULL);
>   - retrieve running time :
> gst_clock_get_time(gst_element_get_clock(pipeline)) -
> gst_element_get_base_time(pipeline);
>   - apply running time as an offset on mixer sinkpad, so that new sound will
> start from its beginning :
> g_object_set(mixerSinkPad, "offset", RunningTime, NULL);
>   - put sound bin in playing mode
>
> It works fine for first sound (when running time is at 0, no offset is
> applied). However, if I trigger a new sound (before previous sound is ended,
> hence before EOS is raised on bus), its beginning is truncated. I've tried
> to apply a greater offset, with same result. I've also tried to pause
> audiomixer or previous sound's bin before adding new sound, it does'nt
> change anything.
>
> Any Idea ?
In my own application, I solved this by adding "identify sync=1" after
wave parse. That will turn your filesource into a live source.

>
>
>
>
> --
> Sent from: http://gstreamer-devel.966125.n4.nabble.com/
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (201 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: How to dynamically link a sound to audiomixer plugin ?

toub
Thank for your reply,
I made a try with
  identity = gst_element_factory_make("identity", NULL);
  g_object_set(identity, "sync", 1, NULL);
 and link it right afetr wavparse

but it doesn't solve the issue.



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel