notes/gstreamer/basesrc-eos.md

23 lines
1.5 KiB
Markdown

---
title: basesrc eos
---
Decided to look into this issue in the morning.
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/227
At first, got side tracked by the comment pointing to src_event . However, when send_event is invoked on the element, `src_event` isn't where it's received. `ElementImpl`'s `send_event` is where it comes to. Now, `udpsrc` is build upon `basesrc`. Had clearly forgotten how much the base classes hide away. So looking into how EOS is handled by `basesrc` led down a rabbit hole. The handling of EOS for push and pull mode is different. `ts-udpsrc` at least right now only supports push mode, which also makes sense considering that it implements asynchronous Task.
Now, scratching head on how much of this should be applicable to `ts-udpsrc` considering that it doesn't derive from `basesrc`.
[`basesrc` EOS handling](htps://gitlab.freedesktop.org/gstreamer/gstreamer/-/blob/210487b50abac1dbf04e181f0f685690c0863d33/subprojects/gstreamer/libs/gst/base/gstbasesrc.c#L1972)
For example, it's odd that the `base_src_loop` is triggered again to perform some operation asynchronously. On second thought though, guess it makes sense that what's to be done is done synchronously in `send_event`. The buffer pool also needs to be set to flushing?
What has to be done can be seen below.
[`base_src_loop` EOS handling](https://gitlab.freedesktop.org/gstreamer/gstreamer/-/blob/210487b50abac1dbf04e181f0f685690c0863d33/subprojects/gstreamer/libs/gst/base/gstbasesrc.c#L3142)
- Pause task
- Post segment done message
- Push event?