After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 485343 - Implement a wait_eos function in basesink
Implement a wait_eos function in basesink
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
0.10.14
Other Linux
: Normal enhancement
: 0.10.15
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2007-10-10 10:26 UTC by Benoit Fouet
Modified: 2007-10-10 15:23 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch implementing the wait_eos function (1.55 KB, patch)
2007-10-10 10:27 UTC, Benoit Fouet
reviewed Details | Review

Description Benoit Fouet 2007-10-10 10:26:30 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.
Comment 1 Benoit Fouet 2007-10-10 10:27:38 UTC
Created attachment 96983 [details] [review]
patch implementing the wait_eos function
Comment 2 Benoit Fouet 2007-10-10 12:41:03 UTC
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,
Comment 3 Benoit Fouet 2007-10-10 14:24:33 UTC
(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,
Comment 4 Wim Taymans 2007-10-10 15:23:14 UTC
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!