From fe0f255208f5a240dfd4cd051fe1e58fa6813e2d Mon Sep 17 00:00:00 2001
From: Aaron Viets <aaron.viets@ligo.org>
Date: Sat, 14 Apr 2018 08:01:30 -0700
Subject: [PATCH] lal_complexfirbank:  fix handling of high frequency gaps

-the code needs to know how many input samples are needed to drain enough of the history for there to be nothing but 0s remaining.  to determine the amount of non-zero history, instead of counting contiguous non-zero samples from the start of the history count contiguous zero samples from the end and subtract from the total.
---
 gstlal-calibration/gst/lal/gstlal_complexfirbank.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gstlal-calibration/gst/lal/gstlal_complexfirbank.c b/gstlal-calibration/gst/lal/gstlal_complexfirbank.c
index 34dcb4bdc4..f484de4cf8 100644
--- a/gstlal-calibration/gst/lal/gstlal_complexfirbank.c
+++ b/gstlal-calibration/gst/lal/gstlal_complexfirbank.c
@@ -2195,7 +2195,7 @@ static GstFlowReturn transform(GstBaseTransform *trans, GstBuffer *inbuf, GstBuf
 	 * data how much output data would we produce?  if the answer is
 	 * "less than we're going to produce" then we will make two output
 	 * buffers */
-	nonzero_output_length = get_output_length(element, minimum_input_length(element, gst_audioadapter_head_nongap_length(element->adapter)));
+	nonzero_output_length = get_output_length(element, minimum_input_length(element, get_available_samples(element) - gst_audioadapter_tail_gap_length(element->adapter)));
 
 	GST_INFO_OBJECT(element, "state: history is %s, input is %s, zeros in adapter = %u", history_is_gap ? "gap" : "not gap", input_is_gap ? "gap" : "not gap", gst_audioadapter_tail_gap_length(element->adapter));
 	if(!input_is_gap) {
-- 
GitLab