Stopping mixing pipeline when shorter input finishes

Vladislav Glinsky cl0ne at mithril.org.ua
Thu Oct 22 21:34:37 UTC 2020


Hello,

I'm trying to find a correct way to stop a pipeline that mixes two
streams of different lengths after the shorter one finished playing. I
encountered this problem while trying to fix an old pygst tutorial that
uses videomixer to overlay a PNG image shown with imagefreeze on a video
file. I see only two approaches to stop the running pipeline when the
video ended:

*a)* change the num-buffers property of imagefreeze to match the video
file length but I see no obvious way to convert video file duration to
the number of buffers

*b)* look for EOS event in the probe on video decoder source pad and
send it down to videomixer from imagefreeze (either with
gst_element_send_event or with gst_pad_push_event from src pad) but I'm
not sure that this doesn't have any synchronization issues

I decided to model use case with two streams of different lengths with
two videotestsrc and approach *b* works perfectly fine. When I replaced
"infinite" videotestsrc with imagefreeze for PNG image I found out that
application doesn't receive EOS message:
gst_element_send_event(imagefreeze, gst_event_new_eos()) returns false
while gst_pad_push_event(gst_element_get_static_pad(imagefreeze, "src"),
gst_event_new_eos()) pad never returns at all. I've attached Python code
that uses approach *b* to stop pipeline with pair of videotestsrc and
with videotestsrc+imagefreeze and PNG file if someone will need to run
the code.

I doubt that this is due to some bug in imagefreeze, so the question is
what I'm doing wrong and how to solve this problem correctly?

-- 
Best regards,
Vladislav Glinsky

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20201023/a6cdd31a/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: stop-looped-video.py
Type: text/x-python
Size: 3004 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20201023/a6cdd31a/attachment-0001.py>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tvlogo.png
Type: image/png
Size: 110072 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20201023/a6cdd31a/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20201023/a6cdd31a/attachment-0001.sig>


More information about the gstreamer-devel mailing list