gst-validate-scenario: Make waits optional in appsrc-push
authorAlicia Boya García <ntrrgc@gmail.com>
Sun, 17 Feb 2019 14:38:53 +0000 (15:38 +0100)
committerAlicia Boya García <ntrrgc@gmail.com>
Sun, 24 Feb 2019 00:23:58 +0000 (01:23 +0100)
commitf0abd316e2aaf42b7d8639a72648794364df5fec
tree9ebb232a77b67e640f0b596997fea6b55201216f
parentaf205f63b7172fcab61e846f354af23888bcf116
gst-validate-scenario: Make waits optional in appsrc-push

While in many cases it's desirable to wait for a buffer to be pushed
downstream when using appsrc-push, in some cases this is not possible as
such pushing action is dependent on following actions that would not be
executed if we wait.

An example for this is prerolling:

    appsrc ! qtdemux ! video/x-h264 ! decodebin name=dec ! %(videosink)s

    description, seek=false, handles-states=true
    appsrc-push, target-element-name=appsrc0, file-name="raw_h264.0.mp4"
    set-state, state=playing
    appsrc-eos, target-element-name=appsrc0

In order for the preroll to occur, both the appsrc needs to push the
buffer and the state needs to reach PLAYING. But `set-state` cannot
finish if the buffer has not been pushed (the state transition does not
finish) and conversely pushing the buffer will not finish until the
state has reached.

Making appsrc-push not wait for the buffer solves this problem. This
patch makes appsrc-push aware of this issue by only waiting for the
buffer to be pushed if the pipeline is in a state that allows buffers to
flow.
validate/gst/validate/gst-validate-scenario.c
validate/gst/validate/gst-validate-scenario.h