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 770461 - flacenc: Implement flushing
flacenc: Implement flushing
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
git master
Other Linux
: Normal enhancement
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-08-26 22:24 UTC by GstBlub
Modified: 2018-11-03 15:11 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
flacenc: Implement flushing (4.25 KB, patch)
2016-08-26 22:24 UTC, GstBlub
none Details | Review
flacenc: Implement flushing (4.96 KB, patch)
2016-09-12 14:48 UTC, GstBlub
reviewed Details | Review

Description GstBlub 2016-08-26 22:24:35 UTC
Created attachment 334249 [details] [review]
flacenc: Implement flushing

This allows flacenc to flush its internal state when requested to do so.  This is useful when placed into a pipeline to transcode and a seek is performed on that pipeline.  Currently, a seek would lead to an error (+ assertion) like this:

WARN: gstaudioencoder.c:gst_audio_encoder_finish_frame:1028: error: received more encoded samples 4608 than provided 684 as inputs
Comment 1 GstBlub 2016-09-12 14:48:05 UTC
Created attachment 335367 [details] [review]
flacenc: Implement flushing

Updated patch.
Comment 2 Tim-Philipp Müller 2016-09-13 08:10:00 UTC
Comment on attachment 335367 [details] [review]
flacenc: Implement flushing

>+    case GST_EVENT_FLUSH_START:
>+      flacenc->flushing = TRUE;
>+      ...
>+      break;
>+    case GST_EVENT_FLUSH_STOP:
>+      if (!flacenc->encoding) {
>+        flacenc->flushing = FALSE;
...

Since FLUSH_START will be called from a thread other than the streaming thread, this is not really thread-safe without locking (setting flacenc->flushing in FLUSH_START and reading it in the coder elsewhere).

Ideally you'd do nothing in FLUSH_START and only flush/reset the encoder in FLUSH_STOP I think. Is that possible?
Comment 3 GstBlub 2016-09-13 17:22:55 UTC
Thanks for the feedback.  I'll update the patch with more locking.

The issue I'm seeing is that it is sitting in gst_flac_enc_write_callback() trying to push the buffer, which is called by either FLAC__stream_encoder_process_interleaved() or FLAC__stream_encoder_finish().  However the FLUSH_START can come in when it is sitting there, so from that point on I need to somehow clear the encoder so that it doesn't keep pushing buffers into gst_audio_encoder_finish_frame().  Which is what triggers this warning.  Also, since it is sitting in the FLAC__*() calls, if I didn't remember that a FLUSH_START happened then it could be possible to receive a FLUSH_STOP and not having actually flushed anything.
Comment 4 GStreamer system administrator 2018-11-03 15:11:04 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/issues/293.