From: "Guedes, Andre" <andre.guedes@intel.com>
To: "o-takashi@sakamocchi.jp" <o-takashi@sakamocchi.jp>,
"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>
Cc: "Girdwood, Liam R" <liam.r.girdwood@intel.com>
Subject: Re: [RFC - AAF PCM plugin 5/5] aaf: Implement Capture mode support
Date: Tue, 21 Aug 2018 23:11:11 +0000 [thread overview]
Message-ID: <1534893070.4547.127.camel@intel.com> (raw)
In-Reply-To: <4cf623b4-ccf1-e67a-7d77-e440d4ae97c3@sakamocchi.jp>
[-- Attachment #1.1: Type: text/plain, Size: 2014 bytes --]
Hi Takashi,
On Tue, 2018-08-21 at 14:17 +0900, Takashi Sakamoto wrote:
> > +static int aaf_mclk_timeout_capture(snd_pcm_aaf_t *aaf)
> > +{
> > + ssize_t n;
> > + uint64_t expirations;
> > +
> > + n = read(aaf->timer_fd, &expirations, sizeof(uint64_t));
> > + if (n < 0) {
> > + SNDERR("Failed to read() timer");
> > + return -errno;
> > + }
> > +
> > + if (expirations != 1)
> > + pr_debug("Missed %llu presentation time(s) ",
> > expirations - 1);
> > +
> > + while (expirations--) {
> > + snd_pcm_sframes_t len;
> > +
> > + aaf_inc_ptr(&aaf->hw_ptr, aaf->frames_per_pkt, aaf-
> > >boundary);
> > +
> > + len = aaf->hw_virt_ptr - aaf->hw_ptr;
> > + if (len < 0)
> > + len += aaf->boundary;
> > + if (len > aaf->buffer_size) {
> > + /* If the distance between hw virtual pointer
> > and hw
> > + * pointer is greater than the buffer size,
> > it means we
> > + * had an overrun error so -EPIPE is
> > returned.
> > + */
> > + return -EPIPE;
> > + }
> > +
> > + aaf->mclk_ticks++;
> > + }
> > +
> > + return 0;
> > +}
>
> In your code, -EPIPE can be returned in a call of
> 'snd_pcm_poll_revents()'. In this case, typical applications follow
> recovery process below:
>
> ->snd_pcm_poll_revents()
> ->snd_pcm_prepare()
> ->snd_pcm_start()
>
> In this case, status of corresponding PCM substream is reset (see
> 'snd_pcm_ioplug_prepare()'). In my opinion, in this case, backend is
> expected to stop data streaming, then initialize hardware and
> restart
> data streaming. In your driver, timer_fd/sk_fd is leaked. It's better
> to
> release them by checking status of PCM substream in .prepare
> callback.
I think you're right. I'll fix it.
Thank you,
Andre
[-- Attachment #1.2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 3262 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
prev parent reply other threads:[~2018-08-21 23:13 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-21 1:06 [RFC - AAF PCM plugin 0/5] Introduce AVTP Audio Format (AAF) plugin Andre Guedes
2018-08-21 1:06 ` [RFC - AAF PCM plugin 1/5] aaf: Introduce plugin skeleton Andre Guedes
2018-08-21 1:06 ` [RFC - AAF PCM plugin 2/5] aaf: Load configuration parameters Andre Guedes
2018-08-21 3:16 ` Pierre-Louis Bossart
2018-08-21 21:57 ` Guedes, Andre
2018-08-21 1:06 ` [RFC - AAF PCM plugin 3/5] aaf: Implement Playback mode support Andre Guedes
2018-08-21 3:37 ` Pierre-Louis Bossart
2018-08-21 21:58 ` Guedes, Andre
2018-08-21 22:51 ` Pierre-Louis Bossart
2018-08-23 0:46 ` Guedes, Andre
2018-08-23 2:25 ` Pierre-Louis Bossart
2018-08-23 18:32 ` Guedes, Andre
2018-08-23 18:51 ` Pierre-Louis Bossart
2018-08-23 21:55 ` Guedes, Andre
2018-08-25 8:13 ` Takashi Sakamoto
2018-08-29 1:00 ` Guedes, Andre
2018-08-31 4:33 ` Takashi Sakamoto
2018-08-31 23:18 ` Guedes, Andre
2018-09-03 1:24 ` Takashi Sakamoto
2018-09-07 1:40 ` Guedes, Andre
2018-09-12 23:45 ` Guedes, Andre
2018-08-21 4:31 ` Takashi Sakamoto
2018-08-21 22:40 ` Guedes, Andre
2018-08-21 1:06 ` [RFC - AAF PCM plugin 4/5] aaf: Prepare for Capture " Andre Guedes
2018-08-21 1:06 ` [RFC - AAF PCM plugin 5/5] aaf: Implement " Andre Guedes
2018-08-21 5:17 ` Takashi Sakamoto
2018-08-21 23:11 ` Guedes, Andre [this message]
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=1534893070.4547.127.camel@intel.com \
--to=andre.guedes@intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=liam.r.girdwood@intel.com \
--cc=o-takashi@sakamocchi.jp \
/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).