GNOME Bugzilla – Bug 485343
Implement a wait_eos function in basesink
Last modified: 2007-10-10 15:23:14 UTC
for low bitrate audio media for instance, eos can be reached before audio has been consumed by the driver. we need to have a pseudo drain function to be called by the subclass. this is done in basesink to be interruptible while waiting.
Created attachment 96983 [details] [review] patch implementing the wait_eos function
update: replaced: + while ((ret = gst_base_sink_wait_clock(sink, time, jitter)) == + GST_CLOCK_UNSCHEDULED) + gst_base_sink_wait_preroll(sink); by: + while ((ret = gst_base_sink_wait_clock(sink, time, jitter)) == + GST_CLOCK_UNSCHEDULED) + if (gst_base_sink_wait_preroll(sink) != GST_FLOW_OK) + break,
(In reply to comment #2) > update: > > replaced: > + while ((ret = gst_base_sink_wait_clock(sink, time, jitter)) == > + GST_CLOCK_UNSCHEDULED) > + gst_base_sink_wait_preroll(sink); > > by: > + while ((ret = gst_base_sink_wait_clock(sink, time, jitter)) == > + GST_CLOCK_UNSCHEDULED) > + if (gst_base_sink_wait_preroll(sink) != GST_FLOW_OK) > + break, > of course, this is: break; not: break,
I changed it a little like this: - we can only go waiting for preroll when we actually need to (need_preroll) and this needs to be done before syncing against the clock (This method could have been called in PAUSED, when the clock is not running). - return a GstFlowReturn. This is not yet very important right now. - check for BAD_TIME when sync was disabled, check for flushing so that we can return the right GstFlowReturn. - add some docs about whet lock needs to be taken before calling this function. Patch inspired by: Benoit Fouet <benoit dot fouet at purplelabs dot com> * libs/gst/base/gstbasesink.c: (gst_base_sink_wait_eos), (gst_base_sink_event): * libs/gst/base/gstbasesink.h: Add function to wait for EOS, subclasses can use this to correctly wait for devices to drain before performing the EOS logic. Fixes #485343. API: gst_base_sink_wait_eos() Thanks!