Let us clarify the contract between GStreamer and each element in the pipeline.
Source elements (or parsers of formats that provide notion of time, such as MPEG, as explained above) must place a timestamp in each buffer that they deliver. The origin of the time used is arbitrary, but it must match the time delivered in the discontinous event (see below). However, it is expected that the origin is the origin of the media stream.
In order to initialize the element time of the rest of the pipeline, a source element must send a discontinous event before starting to play. In addition, after seeking, a discontinious event must be sent, because the timestamp of the next element does not match the element time of the rest of the pipeline.
If the element is intended to emit samples at a specific time (real time
playing), the element should require a clock, and thus implement the
method set_clock
.
In addition, before playing each sample, if the current element time is
less than the timestamp in the sample, it wait until the current time
arrives should call gst_element_wait()
[1]
[1] |
With some schedulers, |