From: Sebastian Dröge Date: Thu, 2 Jul 2020 06:15:08 +0000 (+0300) Subject: flacenc: Pass audio info from set_format() to query_total_samples() explicitly X-Git-Tag: 1.19.3~509^2~501 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c194390ce9f77adc33231243909e9e59885c1ba0;p=platform%2Fupstream%2Fgstreamer.git flacenc: Pass audio info from set_format() to query_total_samples() explicitly This fixes writing of the seek table header. gst_audio_encoder_get_audio_info() will still return old/unset audio info until set_format() has actually returned, which then results in query_total_samples() to always return 0. Thanks to Jacob Kauffmann for debugging this and finding the main cause. Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues/756 Part-of: --- diff --git a/ext/flac/gstflacenc.c b/ext/flac/gstflacenc.c index 9d230ea..7c0016e 100644 --- a/ext/flac/gstflacenc.c +++ b/ext/flac/gstflacenc.c @@ -811,11 +811,10 @@ gst_flac_enc_getcaps (GstAudioEncoder * enc, GstCaps * filter) } static guint64 -gst_flac_enc_peer_query_total_samples (GstFlacEnc * flacenc, GstPad * pad) +gst_flac_enc_peer_query_total_samples (GstFlacEnc * flacenc, GstPad * pad, + GstAudioInfo * info) { gint64 duration; - GstAudioInfo *info = - gst_audio_encoder_get_audio_info (GST_AUDIO_ENCODER (flacenc)); GST_DEBUG_OBJECT (flacenc, "querying peer for DEFAULT format duration"); if (gst_pad_peer_query_duration (pad, GST_FORMAT_DEFAULT, &duration) @@ -884,7 +883,7 @@ gst_flac_enc_set_format (GstAudioEncoder * enc, GstAudioInfo * info) flacenc->channel_reorder_map); total_samples = gst_flac_enc_peer_query_total_samples (flacenc, - GST_AUDIO_ENCODER_SINK_PAD (enc)); + GST_AUDIO_ENCODER_SINK_PAD (enc), info); FLAC__stream_encoder_set_bits_per_sample (flacenc->encoder, GST_AUDIO_INFO_DEPTH (info));