<div dir="ltr"><div><div><div><div><div><div><div><div><div>Hi,<br></div><br></div></div></div></div></div></div></div>I wanna query a lot of sound files duration in a loop efficiently, so instead of waiting in a sub-loop with a sleep method until the query succeeds for each given file - I wanna go for the second approach by processing the GST_MESSAGE_ASYNC_DONE message on the bus, thus bypassing the potential need to do (several) sleep(s) for each sound file.<br>
<br></div><div>How do I do it properly?<br></div><div>The only thing I can think about is launching the files query loop in a different thread, from there for each file block on a condition variable until I get the async event on the bus on the main thread which would fire pthread_cond_signal() to unblock the querying thread to query the corresponding file and move on to the next sound file in the loop.<br>
<br></div><div>Is there a better way to implement this non-sleep approach?<br><br></div><div>How do I know that GST_MESSAGE_ASYNC_DONE isn't fired by some other source since gstreamer is multi-threaded and can work with many sound sources in parallel so the events on the bus might be rather random, right?<br>
</div><div><br><br><div><div><div><div><div><div><div><br><div><div><br></div></div></div></div></div></div></div></div></div></div></div>