Search code examples
javagstreamerjava-gstreamer

Send video synchronously to AppSink


I'm using gstreamer-java to send data via UDP through a custom AppSink. Here's how it's effectively setup:

fileSrc ! streamTee ! displayQueue ! tsdemux ! demuxQueue ! (mpeg2dec || h264dec) ! videosink

and

streamTee ! sendQueue ! udpSink

I would like to send the data in a way that simulates a live stream. I am assuming that the only way to do this is to synchronize the sending with the playback through the videoSink. That is, send at 1.0x playback speed.

However, Setting the udpSink's sync property doesn't seem to change anything. I have verified that packets get sent out as fast as possible because of the sendQueue.

Do I need to add the streamTee between other elements? Is there something obvious I am missing?


Solution

  • Moving the streamTee to after the displayQueue seems to have solved this problem. The sync property doesn't seem to do anything.

    The UDP packets seem to be sent out a tad ahead of the videoSink's displayed video, but it's consistently .5-1.0s ahead at the end of any video of any length. So it seems like it's sync'd enough.