From patchwork Sat Sep 13 18:30:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Patrakov X-Patchwork-Id: 4899811 X-Patchwork-Delegate: tiwai@suse.de Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6A231BEEA5 for ; Sat, 13 Sep 2014 18:31:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 72FB8201F4 for ; Sat, 13 Sep 2014 18:31:45 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 3059D201F7 for ; Sat, 13 Sep 2014 18:31:44 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 3BD8E2656EF; Sat, 13 Sep 2014 20:31:43 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, NO_DNS_FOR_FROM, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id C962F2650B0; Sat, 13 Sep 2014 20:31:01 +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 07322261ACA; Sat, 13 Sep 2014 20:30:58 +0200 (CEST) Received: from mail-la0-f48.google.com (mail-la0-f48.google.com [209.85.215.48]) by alsa0.perex.cz (Postfix) with ESMTP id DD36A261ACA for ; Sat, 13 Sep 2014 20:30:50 +0200 (CEST) Received: by mail-la0-f48.google.com with SMTP id ty20so2715047lab.35 for ; Sat, 13 Sep 2014 11:30:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=7j9oOwoG1nzSH0SqHOxj1AfHeajiIfYn8o5gXNGUFCo=; b=sx0P63UHlfuJYSvJVASVIMkWndAUKb3iBirgFcrR9p0y392wS+9I1EBdzPfbIKMs65 iihRs+JYAngva9nllztXAh+n/Ppsu78iv3tW5nCDjs6KDrgK0leqVSlhyAdDBG75sUni WYJus7IolpcP/Gh9BMMWrE5WP0/qjjFesDbFn2M3vmQR/CL0b+4fVBoLOjorgJ+wpEho WnyHAMbYQivOl/Vq8owgQWfrFFOh/EQjCak5kHotFv0QhyuDWZ4Si6vS5w6WePo7qWdp 90Y+DuVMymfkbXYBmnI8OYDsMK8kJL+U71TH3yQQlrLrgK1XTgxJuMUw4vf1cgMjUW/n GPUA== X-Received: by 10.112.61.68 with SMTP id n4mr16428951lbr.91.1410633050535; Sat, 13 Sep 2014 11:30:50 -0700 (PDT) Received: from localhost.localdomain (111279190.convex.ru. [82.193.153.141]) by mx.google.com with ESMTPSA id pc2sm2567718lbb.5.2014.09.13.11.30.49 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 13 Sep 2014 11:30:50 -0700 (PDT) From: "Alexander E. Patrakov" To: alsa-devel@alsa-project.org Date: Sun, 14 Sep 2014 00:30:13 +0600 Message-Id: <1410633021-20395-2-git-send-email-patrakov@gmail.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1410633021-20395-1-git-send-email-patrakov@gmail.com> References: <1410633021-20395-1-git-send-email-patrakov@gmail.com> Cc: tiwai@suse.de, clemens@ladisch.de, "Alexander E. Patrakov" Subject: [alsa-devel] [PATCH 1/9] dmix: actually rewind when running or being drained 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 Signed-off-by: Alexander E. Patrakov --- src/pcm/pcm_dmix.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/pcm/pcm_dmix.c b/src/pcm/pcm_dmix.c index 7c53509..73cbe3f 100644 --- a/src/pcm/pcm_dmix.c +++ b/src/pcm/pcm_dmix.c @@ -669,11 +669,15 @@ static snd_pcm_sframes_t snd_pcm_dmix_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t f snd_pcm_direct_t *dmix = pcm->private_data; snd_pcm_uframes_t slave_appl_ptr, slave_size; snd_pcm_uframes_t appl_ptr, size, transfer, result; + int err; const snd_pcm_channel_area_t *src_areas, *dst_areas; if (dmix->state == SND_PCM_STATE_RUNNING || - dmix->state == SND_PCM_STATE_DRAINING) - return snd_pcm_dmix_hwsync(pcm); + dmix->state == SND_PCM_STATE_DRAINING) { + err = snd_pcm_dmix_hwsync(pcm); + if (err < 0) + return err; + } if (dmix->last_appl_ptr < dmix->appl_ptr) size = dmix->appl_ptr - dmix->last_appl_ptr;