How to trigger pipeline that data is availabe in appsrc
John Dunn
John.Dunn at qsc.com
Mon Mar 28 23:28:13 UTC 2022
I have an appsrc that injects KLV data into a mpegtsmux. It seems to be working fine ( ie data that muxed can be demuxed later ) but given this data is asynchronous it's not clear to me what the best way it to inject the data correctly.
As a test I'm trying to inject data every x ms. The need_data callback sleeps for x ms ( which I'm sure is horrible for a number of reasons ). This works when the timeout is 1 second but if I try an reduce the timeout to 300ms I get 3 calls to need_data 300ms apart but then it waits 3.5 seconds before the next call is made.
What is the best way to have the pipeline call need_data whenever data becomes available ( and preferably only when data is available ) from another thread? Ideally I'd like to do something like
std::thread([]()
{
std::this_thread::sleep_for(std:: chrono::milliseconds(300));
// somehow make need_data get called here
});
The end result will be another thread that is receiving data over the network and muxing it into the ts.
John
More information about the gstreamer-devel
mailing list