From patchwork Mon Feb 27 07:36:32 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: 9592813 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 E6C7D604AB for ; Mon, 27 Feb 2017 07:36:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D754C283C2 for ; Mon, 27 Feb 2017 07:36:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CAA8D283E1; Mon, 27 Feb 2017 07:36:51 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, 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 0FAC6283C2 for ; Mon, 27 Feb 2017 07:36:50 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 45DFB266D49; Mon, 27 Feb 2017 08:36:49 +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 2FFDA266D49; Mon, 27 Feb 2017 08:36:47 +0100 (CET) Received: from mail-pg0-f66.google.com (mail-pg0-f66.google.com [74.125.83.66]) by alsa0.perex.cz (Postfix) with ESMTP id 6DF612669AF; Mon, 27 Feb 2017 08:36:42 +0100 (CET) Received: by mail-pg0-f66.google.com with SMTP id x17so37132pgi.0; Sun, 26 Feb 2017 23:36:42 -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=FCHh83ffME4S/RFT1qj4zLfekngBFFgDx00pW+7M6Q8wkBFifHLJhJQQitlY8HOzTR hRfywdR/c0w9oFSO9Ycc4NBjYUIkg/91mleHo1LGl2QWl+sjMP4o6nZTzvgp7R1DnheQ ERs6yMYGeDhavC7mk3TuaxRugb6vOHoynkYhsGsIK45wcqyrOuIKI68wtWVqXG8k/T0P 9tEPqbU5qI1/PKYOMI8TC1FiFY4w44qqgBhbXxVGqKNgZ3w2IoWtwHS4Un+cRJGZCs8s mYjOEgUzkGYeBE0e5GTk0/wuwBXB/+rKe1D8avpEMY7sfISPgGHBYrD6OVTMZZ6OcYpu cKiw== 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=KbIlW6lbfBTnc9CqOZ7JIMBaQJ5dEHGQDX6sT9QT0i2bwerIKPWNw+y1sEM2sYPhgF I9JkBSLEHQR44tO5IFZ+YuNq77Vep/pqdG5yOe2hQSkyq4TJu3kONowrUVSGuGBYcJEM PFyClf8/Ngdt42fnw7xF6Zycjt9XxM5AMkdQh8+gFwusLbq0ggwok88yraROG1UwG02q 4OGKvZrJQZlufOrzvK5rdQoJ1gd2F874dZ3YiCx7pKJnEIKfJKT/o5tStW1xD+ABYhIt 5CBtDqdX9R494QeIdKX5t8q0yG7CnwuQtiJcToIJniKu2ku1tAG90QJjs4PzdMPcZWZi 43BQ== X-Gm-Message-State: AMke39lHKUvvvyDlf2HVyRzUqJDHGBPwlwDdPhPxYC3avFz8BesOkBC62QEIZ7Gso5L3xA== X-Received: by 10.84.128.74 with SMTP id 68mr16993864pla.111.1488181001106; Sun, 26 Feb 2017 23:36:41 -0800 (PST) Received: from msutar-VirtualBox.inp.mentorg.com ([139.181.35.34]) by smtp.gmail.com with ESMTPSA id m74sm28446910pfk.41.2017.02.26.23.36.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 26 Feb 2017 23:36:40 -0800 (PST) From: sutar.mounesh@gmail.com To: patch@alsa-project.org Date: Mon, 27 Feb 2017 13:06:32 +0530 Message-Id: <1488180992-9180-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 v2 6/6] 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; }