From: "Wischer, Timo (ADITG/ESB)" <twischer@de.adit-jv.com>
To: "patch@alsa-project.org" <patch@alsa-project.org>
Cc: "alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>
Subject: Re: [PATCH - JACK PCM plugin] jack: Write only valid values to the internal hw_ptr
Date: Thu, 8 Feb 2018 08:49:53 +0000 [thread overview]
Message-ID: <B0FB33DC1499054591F62C0EF1E013D7684F7A01@HI2EXCH01.adit-jv.com> (raw)
In-Reply-To: <1516610240-7772-1-git-send-email-twischer@de.adit-jv.com>
Hello all,
any comments so far?
It would be great if someone could have a look
because I have some further fixes pending.
Best regards
Timo Wischer
Advanced Driver Information Technology GmbH
Engineering Software Base (ADITG/ESB)
Robert-Bosch-Str. 200
31139 Hildesheim
Germany
Tel. +49 5121 49 6938
Fax +49 5121 49 6999
twischer@de.adit-jv.com
ADIT is a joint venture company of Robert Bosch GmbH/Robert Bosch Car Multimedia GmbH and DENSO Corporation
Sitz: Hildesheim, Registergericht: Amtsgericht Hildesheim HRB 3438
Geschäftsführung: Wilhelm Grabow, Ken Yaguchi
________________________________________
From: Wischer, Timo (ADITG/ESB)
Sent: Monday, January 22, 2018 9:37 AM
To: patch@alsa-project.org
Cc: alsa-devel@alsa-project.org; Wischer, Timo (ADITG/ESB)
Subject: [PATCH - JACK PCM plugin] jack: Write only valid values to the internal hw_ptr
From: Timo Wischer <twischer@de.adit-jv.com>
Otherwise the ALSA thread could for example read a hw_ptr >
buffer_size
Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
diff --git a/jack/pcm_jack.c b/jack/pcm_jack.c
index 4468ede..3aed332 100644
--- a/jack/pcm_jack.c
+++ b/jack/pcm_jack.c
@@ -137,6 +137,7 @@ static int
snd_pcm_jack_process_cb(jack_nframes_t nframes, snd_pcm_ioplug_t *io)
{
snd_pcm_jack_t *jack = io->private_data;
+ snd_pcm_uframes_t hw_ptr;
const snd_pcm_channel_area_t *areas;
snd_pcm_uframes_t xfer = 0;
unsigned int channel;
@@ -155,12 +156,13 @@ snd_pcm_jack_process_cb(jack_nframes_t nframes, snd_pcm_ioplug_t *io)
return 0;
}
}
-
+
+ hw_ptr = jack->hw_ptr;
areas = snd_pcm_ioplug_mmap_areas(io);
while (xfer < nframes) {
snd_pcm_uframes_t frames = nframes - xfer;
- snd_pcm_uframes_t offset = jack->hw_ptr;
+ snd_pcm_uframes_t offset = hw_ptr;
snd_pcm_uframes_t cont = io->buffer_size - offset;
if (cont < frames)
@@ -173,10 +175,11 @@ snd_pcm_jack_process_cb(jack_nframes_t nframes, snd_pcm_ioplug_t *io)
snd_pcm_area_copy(&areas[channel], offset, &jack->areas[channel], xfer, frames, io->format);
}
- jack->hw_ptr += frames;
- jack->hw_ptr %= io->buffer_size;
+ hw_ptr += frames;
+ hw_ptr %= io->buffer_size;
xfer += frames;
}
+ jack->hw_ptr = hw_ptr;
pcm_poll_unblock_check(io); /* unblock socket for polling if needed */
--
2.7.4
next prev parent reply other threads:[~2018-02-08 8:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-22 8:37 [PATCH - JACK PCM plugin] jack: Write only valid values to the internal hw_ptr twischer
2018-02-08 8:49 ` Wischer, Timo (ADITG/ESB) [this message]
2018-02-08 10:54 ` Jaroslav Kysela
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=B0FB33DC1499054591F62C0EF1E013D7684F7A01@HI2EXCH01.adit-jv.com \
--to=twischer@de.adit-jv.com \
--cc=alsa-devel@alsa-project.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.