GNOME Bugzilla – Bug 340699
[flacdec] should not send EOS when doing segment seeking
Last modified: 2006-05-06 09:02:13 UTC
When doing segment seeking in a FLAC file (the segment stop point is set exactly to the duration of the file), flacdec does not send SEGMENT_DONE message when reaching the stop point, but sends EOS message instead. While it may seem right to send EOS, because there's EOS after the last nanosecond, the more right behaviour, I think, would be to send SEGMENT_DONE message. Besides, some plugins react exactly that way, i. e. oggdemux: gst-plugins-base/ext/ogg/gstoggdemux.c (2681): eos: { ret = GST_FLOW_OK; /* segment playback just posts a segment end message instead of * pushing out EOS. */ ogg->segment_running = FALSE; if (ogg->segment.flags & GST_SEEK_FLAG_SEGMENT) { gint64 stop; if ((stop = ogg->segment.stop) == -1) stop = ogg->segment.duration; GST_LOG_OBJECT (ogg, "Sending segment done, at end of segment"); gst_element_post_message (GST_ELEMENT (ogg), gst_message_new_segment_done (GST_OBJECT (ogg), GST_FORMAT_TIME, stop)); } else { GST_LOG_OBJECT (ogg, "Sending EOS, at end of stream"); gst_ogg_demux_send_event (ogg, gst_event_new_eos ()); } goto pause; } Unfortunately, I do not fully understand flacdec source to write a patch myself, but I hope this information may be useful to the developers.
You mean you wrongly get an EOS when you do a segment seek and the stop point is the end of the file, but everything's fine as long as the stop point is somewhere in the middle of the fil, right?
Created attachment 64856 [details] [review] patch Does this patch fix it for you?
normally the EOS detection code can be identical with a simple if() on the seek flags.
I didn't want to make any assumptions about the exact behaviour of the libFLAC seekable stream decoder interface.
With the patch everything works just as expected, thanks!
Thanks for testing, committed to CVS: 2006-05-06 Tim-Philipp Müller <tim at centricular dot net> * ext/flac/gstflacdec.c: (gst_flac_dec_loop): * ext/flac/gstflacdec.h: Handle segment seeks that include the end of the file as stop point properly: when the decoder hits EOS we want to send a SEGMENT_DONE message instead of an EOS event in case we're in segment seek mode (fixes #340699).