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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Signed-off-by: Zhang Keqiao <keqiao.zhang@xxxxxxxxx>
---
 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

_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux