flacenc: never ever pass values >36bits to _set_total_samples_estimate()
authorTim-Philipp Müller <tim.muller@collabora.co.uk>
Mon, 1 Jun 2009 23:37:15 +0000 (00:37 +0100)
committerTim-Philipp Müller <tim.muller@collabora.co.uk>
Mon, 1 Jun 2009 23:46:42 +0000 (00:46 +0100)
Let's be paranoid and make sure we never pass a number that takes up
more than 36 bits to _set_total_samples_estimate(), since libFLAC
expects all the other bits to be zero, and if this is not the case
neighbouring fields in the global stream info header may get messed
up inadvertently, so that flac -d refuses to decode the stream.
See #584455.

ext/flac/gstflacenc.c

index cf5afcd..6eab536 100644 (file)
@@ -633,7 +633,7 @@ gst_flac_enc_sink_setcaps (GstPad * pad, GstCaps * caps)
 
   if (total_samples != GST_CLOCK_TIME_NONE)
     FLAC__stream_encoder_set_total_samples_estimate (flacenc->encoder,
-        total_samples);
+        MIN (total_samples, G_GUINT64_CONSTANT (0x0FFFFFFFFF)));
 
   gst_flac_enc_set_metadata (flacenc);