From patchwork Mon Feb 27 07:27:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: sutar.mounesh@gmail.com X-Patchwork-Id: 9592803 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 54487604AB for ; Mon, 27 Feb 2017 07:28:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4544426220 for ; Mon, 27 Feb 2017 07:28:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 39F0A283E1; Mon, 27 Feb 2017 07:28:08 +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.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=no 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 6B95E26220 for ; Mon, 27 Feb 2017 07:28:07 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id E0DCC266D52; Mon, 27 Feb 2017 08:27:58 +0100 (CET) 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 573FA266D46; Mon, 27 Feb 2017 08:27:56 +0100 (CET) Received: from mail-pg0-f65.google.com (mail-pg0-f65.google.com [74.125.83.65]) by alsa0.perex.cz (Postfix) with ESMTP id EFEB72669AF; Mon, 27 Feb 2017 08:27:47 +0100 (CET) Received: by mail-pg0-f65.google.com with SMTP id 1so3820pgz.2; Sun, 26 Feb 2017 23:27:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=q69pdtcJEepbp7Zj/hcFxp0ufzxg0L7IoeWIZm7e+TQ=; b=RzjJWyCBIq7HUYCZJcJC233okeFoliniykg/V0rX4SLAuOmZqQLP9Ltbc/pZIK0B2L EG0dJfu0fqyIhx4x/FASwCmet3szwCmkvsWfNjCS0E4t7kEcNqmeCG0T4wbR9HweJAgF 2tJhdyXf+MatuBZbofOs6YjGjDlv71inrnjjOBmQA0cppREcaZqRVqM1CvKetsSiUvN0 r2gaWt3mdA28S3jerSqj/ygDexxCDB6/rTz9L1t/+rH6Ybyqt5IxeGCidKXvmomG8B40 VKpSybNpi2HT3Sn+HHsB7vkoCw47FK/ckwaqgnqX0EbRIHat6PJ58T/9vPmdQbZiQ7aP uClA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=q69pdtcJEepbp7Zj/hcFxp0ufzxg0L7IoeWIZm7e+TQ=; b=CJ1cPASpaD50CuLFhr8tw1X3F94wvN4CMf7MSj5Dhji2wKwLzDWnfgowLQwS0SoL/9 d3kjh/DXZzQ4Yfby+HWuJ3YzA67zSOPd/m04RrLoU5qhZh21zqYPPBWJTA7YCYgi3p6s KRwzyF9DW7bB5UChsodiB9ss1olqFKbBfL/Vcjg6DN05d+aRZO9E0pvGiWnQceDRSB/L rfDBO8h/P1IbkmXWr5k1q04+MVLHFNtS20bL99/qBDX8pIcK8X+ZVeOexPVz9iOHh83a ypPkqoHkIIrw9Q2KTL4/f4lHtQtKF+fWkPtyPEmIZYnJvWcxJJRlR8U4XwmqLSavJAzI WMgg== X-Gm-Message-State: AMke39nmttDwi2KQZIDaNtWPoehqNALXjyGMX82f111s9tfEE5Y+UXxsyDPPWXqFJy0KyA== X-Received: by 10.84.133.193 with SMTP id f59mr1470485plf.64.1488180467054; Sun, 26 Feb 2017 23:27:47 -0800 (PST) Received: from msutar-VirtualBox.inp.mentorg.com ([139.181.35.34]) by smtp.gmail.com with ESMTPSA id o189sm28544936pga.12.2017.02.26.23.27.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 26 Feb 2017 23:27:46 -0800 (PST) From: sutar.mounesh@gmail.com To: patch@alsa-project.org Date: Mon, 27 Feb 2017 12:57:37 +0530 Message-Id: <1488180457-9063-1-git-send-email-sutar.mounesh@gmail.com> X-Mailer: git-send-email 2.7.4 Cc: Mounesh Sutar , alsa-devel@alsa-project.org, Andreas Pape , mounesh_sutar@mentor.com Subject: [alsa-devel] [PATCH 6/6 V2] pcm:plug: save converter config 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 From: Andreas Pape Passed config is freed after call to open, thus it is invalid when trying to extract the converter name. So config entry is saved for later usage. Signed-off-by: Andreas Pape Signed-off-by: Mounesh Sutar diff --git a/src/pcm/pcm_plug.c b/src/pcm/pcm_plug.c index 266707b..ad0e99e 100644 --- a/src/pcm/pcm_plug.c +++ b/src/pcm/pcm_plug.c @@ -64,6 +64,8 @@ static int snd_pcm_plug_close(snd_pcm_t *pcm) snd_pcm_plug_t *plug = pcm->private_data; int err, result = 0; free(plug->ttable); + if (plug->rate_converter) + snd_config_delete((snd_config_t*)plug->rate_converter); assert(plug->gen.slave == plug->req_slave); if (plug->gen.close_slave) { snd_pcm_unlink_hw_ptr(pcm, plug->req_slave); @@ -1108,7 +1110,13 @@ int snd_pcm_plug_open(snd_pcm_t **pcmp, plug->sformat = sformat; plug->schannels = schannels; plug->srate = srate; - plug->rate_converter = rate_converter; + if (rate_converter) { + if ((err = snd_config_copy((snd_config_t**)&plug->rate_converter, + (snd_config_t *)rate_converter)) < 0) + free(plug); + return err; + } + plug->gen.slave = plug->req_slave = slave; plug->gen.close_slave = close_slave; plug->route_policy = route_policy; @@ -1119,6 +1127,8 @@ int snd_pcm_plug_open(snd_pcm_t **pcmp, err = snd_pcm_new(&pcm, SND_PCM_TYPE_PLUG, name, slave->stream, slave->mode); if (err < 0) { + if (plug->rate_converter) + snd_config_delete((snd_config_t*)plug->rate_converter); free(plug); return err; }