<html><head></head><body><div>On Thu, 2020-12-17 at 12:28 +0000, Michael Johnson wrote:</div><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><div dir="auto">As requested a toy example,<div dir="auto">Here we see that the audio-changed emit never activates the connect, maybe because it emits before the video has began playing?</div><div dir="auto"><br></div><div dir="auto">I'm probably doing something very wrong </div></div></blockquote><div><br></div><div>Yeah, you're ignoring compiler warnings here that tell you that you're ignoring potential errors :)</div><div><br></div><div>Make sure to at least `unwrap()` `Result`s instead of ignoring them, then you immediately know if you did something wrong there.</div><div>In this case the emitting of the "audio-changed" signal fails because of the wrong number of arguments.</div><div><br></div><div>But that also doesn't matter here: that signal is supposed to be emitted by playbin whenever something changes, not by you.</div><div><br></div><div>After removing that line what I get is</div><div><br></div><div><font face="monospace">current audio track is -1</font></div><div><font face="monospace">number of audio tracks is 1</font></div><div><font face="monospace">current audio track is -1</font></div><div><font face="monospace">number of audio tracks is 2</font></div><div><font face="monospace">current audio track is -1</font></div><div><font face="monospace">number of audio tracks is 3</font></div><div><br></div><div>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.</div><div>So in the end it should use the 3rd audio track.</div><div><br></div><div>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.</div><div><br></div><div><br></div><div>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.</div><div><br></div><div><span><pre>-- <br></pre><div data-evo-paragraph="" class="" style="width: 71ch;" data-evo-signature-plain-text-mode="">Sebastian Dröge, Centricular Ltd · <a href="http://www.centricular.com">https://www.centricular.com</a></div><div data-evo-paragraph="" class="" style="width: 71ch;"><br></div></span></div></body></html>