From patchwork Wed May 6 04:29:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Hordern X-Patchwork-Id: 6346521 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id BB6F69F32E for ; Wed, 6 May 2015 04:29:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B57F92021F for ; Wed, 6 May 2015 04:29:21 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 4F1EC2022A for ; Wed, 6 May 2015 04:29:20 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 92C8B2654F1; Wed, 6 May 2015 06:29:18 +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, 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 51E8C260550; Wed, 6 May 2015 06:29:11 +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 669FC26057D; Wed, 6 May 2015 06:29:09 +0200 (CEST) Received: from mail-yk0-f170.google.com (mail-yk0-f170.google.com [209.85.160.170]) by alsa0.perex.cz (Postfix) with ESMTP id 42FC3260522 for ; Wed, 6 May 2015 06:29:02 +0200 (CEST) Received: by ykec202 with SMTP id c202so48419041yke.2 for ; Tue, 05 May 2015 21:29:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=Cz6OXe9lQ4YpQIm7jcfMIVgN9Q2Bp1pyNBVpAERhQkE=; b=Ms6hENIAoqY1l2Jy3yI5+NEKlrHcQMn7XL5r1SDHe+FzN2qFXYx2UOfHACZahfpv0D IxqZwYh3UeijaAYR7pHOWpz3Az2/oDnHLT06YdefQepXc8Hwc5szJ3Qcx/FcF85nZKr1 VMkzRW1OV9yDqrdVtnCrYUIJcKm6/2hxn8gecMWWY9BcscutO9zTGCbolXv/tDqq3IPY Z91AoJoEnQuCSunHAQgU42zCxpwZdNKBLDKZEHnGlyOq8fz2gtPEwGl8m3vaEdmGVv0b 26MdshD2G+qN3WQVSjs+UQAqxi3DfSL2RQY0IhB/L1Nyofp49EGL9Lq0vF2iDuqaw668 F5IQ== MIME-Version: 1.0 X-Received: by 10.236.20.133 with SMTP id p5mr20535800yhp.181.1430886541110; Tue, 05 May 2015 21:29:01 -0700 (PDT) Received: by 10.13.194.133 with HTTP; Tue, 5 May 2015 21:29:01 -0700 (PDT) Date: Wed, 6 May 2015 14:29:01 +1000 Message-ID: From: Dan Hordern To: alsa-devel@alsa-project.org X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Subject: [alsa-devel] ALSA: dmix: pcm status incomplete 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP I require timestamp information from the soundcard and host for our application. However, I noticed that when using "dmix:0,0" instead of "hw:0,0", the audio timestamp and delay frames are both zero. Looking in to the code, it seems that the 'snd_pcm_dmix_status' function does not populate either of these. In order to expose these, I have modified this function to get this information from the slave pcm; patch below. I was hoping for some feedback on this change. I am not sure if the delay value makes sense as yet, and whether there are consequences of using the hardware trigger timestamp etc. I am guessing the dsnoop and dshare plugins may also have this issue, though I have not checked. Thanks, Dan } diff --git a/src/pcm/pcm_dmix.c b/src/pcm/pcm_dmix.c index babde6a..a4d7fc0 100644 --- a/src/pcm/pcm_dmix.c +++ b/src/pcm/pcm_dmix.c @@ -475,12 +475,12 @@ static int snd_pcm_dmix_status(snd_pcm_t *pcm, snd_pcm_status_t * status) break; } memset(status, 0, sizeof(*status)); + snd_pcm_status(dmix->spcm, status); status->state = snd_pcm_dmix_state(pcm); - status->trigger_tstamp = dmix->trigger_tstamp; - gettimestamp(&status->tstamp, pcm->tstamp_type); status->avail = snd_pcm_mmap_playback_avail(pcm); status->avail_max = status->avail > dmix->avail_max ? status->avail : dmix->avail_max; dmix->avail_max = 0; + status->delay = snd_pcm_mmap_playback_delay(pcm); return 0;