centricular / gstcefsrc

A simple gstreamer wrapper around Chromium Embedded Framework
83 stars 45 forks source link

[Q] what is the purpose of the audiotestsrc ? #74

Closed amotzte closed 11 months ago

amotzte commented 12 months ago

Hi @philn, @MathieuDuponchelle Thanks for giving us this great plugin! I've being playing around with it, using appsink for video only.

cefsrc name=cefsrc ! videoconvert ! x264enc name=encode pass=17 tune=zerolatency bitrate=2000 speed-preset=superfast ! appsink name=video sync=false

Lately I've being trying to add audio but with no luck. cefsrc name=cefsrc ! cefdemux name=d d.video ! queue max-size-bytes=0 max-size-buffers=0 max-size-time=3000000000 ! videoconvert ! x264enc name=encode pass=17 tune=zerolatency bitrate=2000 speed-preset=superfast appsink name=video sync=false audiotestsrc do-timestamp=true is-live=true volume=0.00 ! audiomixer name=mix ! queue max-size-bytes=0 max-size-buffers=0 max-size-time=3000000000 ! audioconvert ! appsink name=audio sync=false d.audio ! mix.'

I'm running into all sort of issues, like stream get stuck, audio is noise etc... I'm trying to debug it... got curious about the use audiotestsrc. Why is it required? and what does it do ? Aren't we creating the buffer of the audio buffer in OnAudioStreamPacket and then just push it down stream via the demux so why do we need the audiotestsrc? To be fair Im not a gstreamer expect, but do have some experience with it.

MathieuDuponchelle commented 11 months ago

The purpose of the audiotestsrc is to turn the audiomixer branch into a live one. These days you might be able to use audiomixer force-live=true instead :)

amotzte commented 11 months ago

Thanks @MathieuDuponchelle for the replay. Sorry for nagging, maybe I'm missing something but why do we need the mixer at all? AFAIU, the audio mixer supposed to mix/blend 2 audio source, in our case there is only one audio source which is coming from the cefsrc. I would expect the pipeline to look something like this.

cefsrc name=cefsrc ! cefdemux name=d d.video ! queue max-size-bytes=0 max-size-buffers=0 max-size-time=3000000000 ! videoconvert ! x264enc name=encode pass=17 tune=zerolatency bitrate=2000 speed-preset=superfast appsink name=video sync=false d.audio ! queue max-size-bytes=0 max-size-buffers=0 max-size-time=3000000000 ! audioconvert ! appsink name=audio sync=false

Does this make sense?

MathieuDuponchelle commented 11 months ago

CEF may expose audio streams at any time, not necessarily at start up. In order for the pipeline to preroll something needs to feed the audio branch. Note that you're quoting your own system with an appsink, I can't comment on whether you actually need the mixer in your situation.

amotzte commented 11 months ago

Interesting... thanks @MathieuDuponchelle, really appreciate your support 😄