[alsa-devel] [PATCH v1 4/4] alsabat: XRUN injections test criteria

Zhang Keqiao keqiao.zhang at intel.com
Thu Aug 31 15:37:09 CEST 2017


Check if target number of frames can be detected after XRUNs.

Signed-off-by: Zhang Keqiao <keqiao.zhang at intel.com>
---
 bat/analyze.c | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/bat/analyze.c b/bat/analyze.c
index 17fff50..1c48a6b 100644
--- a/bat/analyze.c
+++ b/bat/analyze.c
@@ -471,9 +471,25 @@ int analyze_capture(struct bat *bat)
 		goto exit2;
 
 	items = fread(bat->buf, bat->frame_size, bat->frames, bat->fp);
-	if (items != bat->frames) {
-		err = -EIO;
-		goto exit2;
+
+	/* check the number of frames recorded after XRUNs */
+	if (bat->xarg) {
+		if (items != bat->frames) {
+			fprintf(bat->err, _("\nXRUN injection test FAILED\n"));
+			fprintf(bat->err, _("Target frames number %d, actually got %zu\n"),
+				bat->frames, items);
+			err = -EIO;
+			goto exit2;
+		} else {
+			fprintf(bat->log, _("\nXRUN injection test PASSED\n"));
+			err = 0; /* target frames can be detected after XRUNs */
+			goto exit2;
+		}
+	} else {
+		if (items != bat->frames) {
+			err = -EIO;
+			goto exit2;
+		}
 	}
 
 	err = reorder_data(bat);
-- 
2.9.3



More information about the Alsa-devel mailing list