From patchwork Thu Aug 31 13:37:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: keqiao.zhang@intel.com X-Patchwork-Id: 9932203 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E4614602F0 for ; Thu, 31 Aug 2017 13:41:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D671428955 for ; Thu, 31 Aug 2017 13:41:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CA98528972; Thu, 31 Aug 2017 13:41:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3FEB228955 for ; Thu, 31 Aug 2017 13:41:47 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 804B62673C4; Thu, 31 Aug 2017 15:40:51 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id E98AF2673EC; Thu, 31 Aug 2017 15:40:48 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by alsa0.perex.cz (Postfix) with ESMTP id BA8EE2673C4 for ; Thu, 31 Aug 2017 15:40:43 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 31 Aug 2017 06:40:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.41,453,1498546800"; d="scan'208"; a="1212993076" Received: from zkq-optiplex-9020.sh.intel.com ([10.239.13.132]) by fmsmga002.fm.intel.com with ESMTP; 31 Aug 2017 06:40:42 -0700 From: Zhang Keqiao To: alsa-devel@alsa-project.org Date: Thu, 31 Aug 2017 21:37:09 +0800 Message-Id: <20170831133709.25537-5-keqiao.zhang@intel.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170831133709.25537-1-keqiao.zhang@intel.com> References: <20170831133709.25537-1-keqiao.zhang@intel.com> Cc: keqiao.zhang@intel.com Subject: [alsa-devel] [PATCH v1 4/4] alsabat: XRUN injections test criteria X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Check if target number of frames can be detected after XRUNs. Signed-off-by: Zhang Keqiao --- 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);