New, also help on dealing with multiple audio streams using gstreamer-rs

Sebastian Dröge sebastian at centricular.com
Thu Dec 17 13:35:55 UTC 2020


On Thu, 2020-12-17 at 12:28 +0000, Michael Johnson wrote:
> As requested a toy example,
> Here we see that the audio-changed emit never activates the connect,
> maybe because it emits before the video has began playing?
> 
> I'm probably doing something very wrong 

Yeah, you're ignoring compiler warnings here that tell you that you're
ignoring potential errors :)

Make sure to at least `unwrap()` `Result`s instead of ignoring them,
then you immediately know if you did something wrong there.
In this case the emitting of the "audio-changed" signal fails because
of the wrong number of arguments.

But that also doesn't matter here: that signal is supposed to be
emitted by playbin whenever something changes, not by you.

After removing that line what I get is

current audio track is -1
number of audio tracks is 1
current audio track is -1
number of audio tracks is 2
current audio track is -1
number of audio tracks is 3

That looks as expected. Every signal emission you're setting the
current audio track to 2, but only the last time there actually is a
3rd (0, 1, 2) audio track available.
So in the end it should use the 3rd audio track.

If you change it for example to set it to 1 then you'll see that during
the last signal emission the current audio track is 1.


For getting state into the signal handler closure, take a look at the
overlay-composition.rs example and what it does with the DrawingContext
inside the Arc<Mutex<_>> there.

-- 
Sebastian Dröge, Centricular Ltd · https://www.centricular.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20201217/e14f3f3f/attachment.htm>


More information about the gstreamer-devel mailing list