I have 2 separate threads injecting live media streams into the 2 appsrc .
The first stream has MKV audio and video stream and the 2nd stream has
The streams contain metadata that allow me to align the injection to the
pipeline so that the buffers carrying the same event in time are assigned
the same timestamps before being injected into the pipeline. The goal is
that the pipeline will mux together and create hls files with the streams
Each thread has this code :
/* Inject stream */
buffer = gst_buffer_new_and_alloc(capture_buffer_size);
GST_BUFFER_TIMESTAMP(buffer) = gstreamer_push_clock;
//gstreamer_push_clock is aligned on both threads
gst_buffer_map(buffer, &map, GST_MAP_WRITE);
memcpy(map.data, capture_buffer, capture_buffer_size);
ret = gst_app_src_push_buffer(GST_APP_SRC(appsrc), buffer);
The problem I'm having is that the hls files produced are not always in
sync. Sometimes the stream on the mkv_appsrc are about 1-2 secs ahead of
the stream from the raw_appsrc.
I also noticed that when I probed the buffer timestamp after the
matroskademux, the buffers don't have the same timestamps that was assigned
to the buffers from the mkv_appsrc, however the timestamps on the buffers
injected from the raw_appsrc were retained. Since timestamp information is
lost with matroskademux, how can I obtain synchronization once the streams
go through mpegtsmux and hlssink.
Any feedback on my approach to this issue will be much appreciated.