Synchronization in Audiosink

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

Synchronization in Audiosink

Stefan Ulbrich
Hello

I need help with a custom audiosink plugin for wrapping an device from
which I cannot the #samples queued (an IP camera). As a result the
signal of

gst-launch-1.0 audiotestsrc ! mulawenc ! myaudiosink

is very distorted. I can improve the situation by adding g_usleep in
the write function.

adding is-live=true to audiotestsrc makes it worse.

How can I achieve a "real-time" synchronization to prevent sending
data too fast?

Thank you and best wishes
Stefan
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Synchronization in Audiosink

Gst-Geek
Which base class have you used for "myaudiosink" plugin development ??

If element is written on top of GstBaseSink, use sync property.

https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-libs/html/GstBaseSink.html#gst-base-sink-set-sync



--
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: Synchronization in Audiosink

Stefan Ulbrich
Thanks for your answer.
I created the class with `gst-element-maker my_audio_sink audiosink`
from plugins-bad.

Now I tried to activate the synchronozation in gst_my_audio_sink_init()

  GstBaseSink *basesink = GST_BASE_SINK(myaudiosink);
  gst_base_sink_set_sync(basesink, TRUE);

But I get only a cracking at the device (I removed the g_usleep that
helped earlier)

Do I have to set the rate somewhere? Do I need the `is-live` in the
audio test source?


On Sun, Jul 22, 2018 at 5:26 PM ShilVin <[hidden email]> wrote:

>
> Which base class have you used for "myaudiosink" plugin development ??
>
> If element is written on top of GstBaseSink, use sync property.
>
> https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-libs/html/GstBaseSink.html#gst-base-sink-set-sync
>
>
>
> --
> 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
Reply | Threaded
Open this post in threaded view
|

Re: Synchronization in Audiosink

Stefan Ulbrich
I noticed that gst-inspect returns:

Clock interaction:
     element is supposed to provide a clock but returned NULL

Do I have to manually instantiate the clock?

On Mon, Jul 23, 2018 at 2:53 PM Stefan Ulbrich <[hidden email]> wrote:
Thanks for your answer.
I created the class with `gst-element-maker my_audio_sink audiosink`
from plugins-bad.

Now I tried to activate the synchronozation in gst_my_audio_sink_init()

  GstBaseSink *basesink = GST_BASE_SINK(myaudiosink);
  gst_base_sink_set_sync(basesink, TRUE);

But I get only a cracking at the device (I removed the g_usleep that
helped earlier)

Do I have to set the rate somewhere? Do I need the `is-live` in the
audio test source?


On Sun, Jul 22, 2018 at 5:26 PM ShilVin <[hidden email]> wrote:
>
> Which base class have you used for "myaudiosink" plugin development ??
>
> If element is written on top of GstBaseSink, use sync property.
>
> https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-libs/html/GstBaseSink.html#gst-base-sink-set-sync
>
>
>
> --
> 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
Reply | Threaded
Open this post in threaded view
|

Re: Synchronization in Audiosink

Olivier Crête-3
Hi,

Are you using GstAudioBaseSink? If you're not, you should be. That means implementing a ringbuffer, etc. Maybe you want to look at the code for pulsesink as a pretty complete (and complex) example.

Olivier


On Mon, 2018-07-23 at 14:57 +0200, Stefan Ulbrich wrote:
I noticed that gst-inspect returns:

Clock interaction:
     element is supposed to provide a clock but returned NULL

Do I have to manually instantiate the clock?

On Mon, Jul 23, 2018 at 2:53 PM Stefan Ulbrich <[hidden email]> wrote:
Thanks for your answer.
I created the class with `gst-element-maker my_audio_sink audiosink`
from plugins-bad.

Now I tried to activate the synchronozation in gst_my_audio_sink_init()

  GstBaseSink *basesink = GST_BASE_SINK(myaudiosink);
  gst_base_sink_set_sync(basesink, TRUE);

But I get only a cracking at the device (I removed the g_usleep that
helped earlier)

Do I have to set the rate somewhere? Do I need the `is-live` in the
audio test source?


On Sun, Jul 22, 2018 at 5:26 PM ShilVin <[hidden email]> wrote:
>
> Which base class have you used for "myaudiosink" plugin development ??
>
> If element is written on top of GstBaseSink, use sync property.
>
> https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-libs/html/GstBaseSink.html#gst-base-sink-set-sync
>
>
>
> --
> 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

-- 
Olivier Crête [hidden email]

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

Re: Synchronization in Audiosink

Stefan Ulbrich
Hi Olivier

I first used GstAudioSink. The problem is that I will not get back any information on the state of the buffer of the remote device (delay()) and I could only get (crackling sound) by adding sleeps in the _write() function.
 On IRC, I've been told that a ring buffer would not be the best approach for this case but that I rather should drive from BaseSink and activate synchronization and overwrite _get_times().

I did that and now I'm stuck with a buffer in _render() that has size 1024-while I expect a multiple of 80 (g711 encoding). Also I'm still searching for examples to get the data similarly to the previous _write () function.

Any advice/suggestions? Any help would be much appreciated :-)

Best
Stefan




On Mon, Jul 23, 2018, 11:51 PM Olivier Crête <[hidden email]> wrote:
Hi,

Are you using GstAudioBaseSink? If you're not, you should be. That means implementing a ringbuffer, etc. Maybe you want to look at the code for pulsesink as a pretty complete (and complex) example.

Olivier

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel