audioaggregator: Only post QoS messages if the property is enabled
authorSebastian Dröge <sebastian@centricular.com>
Mon, 12 Jul 2021 06:37:24 +0000 (09:37 +0300)
committerSebastian Dröge <sebastian@centricular.com>
Mon, 12 Jul 2021 06:42:39 +0000 (09:42 +0300)
Previously one of the branches did not check for the property value. To
avoid this in the future, check inside the QoS calculation function
instead.

As a side effect this now always prints the debug messages into the logs
when samples are dropped, which is useful information even without the
QoS messages.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1224>

gst-libs/gst/audio/gstaudioaggregator.c

index caebf18..f40975b 100644 (file)
@@ -1671,6 +1671,9 @@ gst_audio_aggregator_pad_enqueue_qos_message (GstAudioAggregatorPad * pad,
   guint64 processed, dropped;
   GstMessage *msg;
 
+  if (!pad->priv->qos_messages)
+    return running_time;
+
   if (GST_AUDIO_AGGREGATOR_PAD_GET_CLASS (pad)->convert_buffer)
     rate_input = GST_AUDIO_INFO_RATE (&srcpad->info);
   else
@@ -1911,7 +1914,7 @@ gst_audio_aggregator_fill_buffer (GstAudioAggregator * aagg,
       }
 
       pad->priv->dropped += MIN (diff, pad->priv->size);
-      if (diff != 0 && pad->priv->qos_messages) {
+      if (diff != 0) {
         GstClockTime rt;
 
         rt = gst_audio_aggregator_pad_enqueue_qos_message (pad, aagg, diff);
@@ -2332,7 +2335,7 @@ gst_audio_aggregator_aggregate (GstAggregator * agg, gboolean timeout)
       if (pad->priv->position + diff > pad->priv->size)
         diff = pad->priv->size - pad->priv->position;
       pad->priv->dropped += diff;
-      if (diff != 0 && pad->priv->qos_messages) {
+      if (diff != 0) {
         GstClockTime rt;
 
         rt = gst_audio_aggregator_pad_enqueue_qos_message (pad, aagg, diff);