alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: sutar.mounesh@gmail.com
To: patch@alsa-project.org
Cc: alsa-devel@alsa-project.org, Andreas Pape <apape@de.adit-jv.com>,
	mounesh_sutar@mentor.com
Subject: [PATCH] alsa-lib: update linked hw_ptr and appl_ptr
Date: Fri, 25 Nov 2016 15:55:05 +0530	[thread overview]
Message-ID: <1480069505-16668-1-git-send-email-sutar.mounesh@gmail.com> (raw)

From: Andreas Pape <apape@de.adit-jv.com>

Plugin file provides no private hw_ptr and appl_ptr but instead links them to the slave pcm.
If the slave pcm itself changes its hw_ptr or app_prt this needs to be done in file plugin, too.
Plugin 'plug' is such a candidate changing the hw_ptr and app_ptr in hw_params call dependent on the automatically inserted plugins.
ALSA unfortunately has no support for automatically updating chained pointers.
A notification on pointer change seems to be prepared inside the snd_pcm_set_ptr() routine via
rbptr->changed(), but it is not (yet) implemented so that we need to care for it manually.

Signed-off-by: Andreas Pape <apape@de.adit-jv.com>
---
 src/pcm/pcm_file.c |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/pcm/pcm_file.c b/src/pcm/pcm_file.c
index fec76eb..1e3d35b 100644
--- a/src/pcm/pcm_file.c
+++ b/src/pcm/pcm_file.c
@@ -634,6 +634,14 @@ static int snd_pcm_file_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
 			return err;
 		}
 	}
+
+	/* pointer may have changed - e.g if plug is used. */
+	snd_pcm_unlink_hw_ptr(pcm, file->gen.slave);
+	snd_pcm_unlink_appl_ptr(pcm, file->gen.slave);
+
+	snd_pcm_link_hw_ptr(pcm, file->gen.slave);
+	snd_pcm_link_appl_ptr(pcm, file->gen.slave);
+
 	return 0;
 }
 
-- 
1.7.9.5

             reply	other threads:[~2016-11-25 10:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-25 10:25 sutar.mounesh [this message]
2016-11-28 19:16 ` [PATCH] alsa-lib: update linked hw_ptr and appl_ptr Takashi Iwai
2016-12-08 10:56   ` Sutar, Mounesh
2016-12-14 14:45     ` Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1480069505-16668-1-git-send-email-sutar.mounesh@gmail.com \
    --to=sutar.mounesh@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=apape@de.adit-jv.com \
    --cc=mounesh_sutar@mentor.com \
    --cc=patch@alsa-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).