All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH - ALSA JACK plugin 1/2] jack: Replacing jack->channels with jack->num_ports
@ 2019-01-11  5:15 laxmi.devi
  2019-01-11  5:15 ` [PATCH - ALSA JACK plugin 2/2] jack: Removing snd_pcm_jack_format_t as it is not used laxmi.devi
  2019-01-11  7:53 ` [PATCH - ALSA JACK plugin 1/2] jack: Replacing jack->channels with jack->num_ports Jaroslav Kysela
  0 siblings, 2 replies; 4+ messages in thread
From: laxmi.devi @ 2019-01-11  5:15 UTC (permalink / raw)
  To: patch; +Cc: twischer, alsa-devel, Laxmi Devi

From: Laxmi Devi <Laxmi.Devi@in.bosch.com>

As jack->num_ports and jack->channels hold the same values,
jack->channels is redundant and hence removed.

Sanity check is added in prepare, to check if io->Channels is
same as jack->num_ports.

Signed-off-by: Laxmi Devi <Laxmi.Devi@in.bosch.com>

diff --git a/jack/pcm_jack.c b/jack/pcm_jack.c
index af2136e..d723b17 100644
--- a/jack/pcm_jack.c
+++ b/jack/pcm_jack.c
@@ -48,7 +48,6 @@ typedef struct {
 	unsigned int sample_bits;
 	snd_pcm_uframes_t min_avail;
 
-	unsigned int channels;
 	snd_pcm_channel_area_t *areas;
 
 	jack_port_t **ports;
@@ -263,6 +262,12 @@ static int snd_pcm_jack_prepare(snd_pcm_ioplug_t *io)
 	snd_pcm_sw_params_t *swparams;
 	int err;
 
+	if (io->channels != jack->num_ports) {
+		SNDERR("Channel count %d not equal to no. of ports %d in JACK",
+		       io->channels, jack->num_ports);
+		return -EINVAL;
+	}
+
 	jack->hw_ptr = 0;
 	jack->xrun_detected = false;
 
@@ -381,7 +386,7 @@ static int jack_set_hw_constraint(snd_pcm_jack_t *jack)
 	unsigned int psize_list[MAX_PERIODS_MULTIPLE];
 	unsigned int nframes = jack_get_buffer_size(jack->client);
 	unsigned int jack_buffer_bytes = (snd_pcm_format_size(format, nframes) *
-					  jack->channels);
+					  jack->num_ports);
 	unsigned int i;
 	int err;
 
@@ -398,7 +403,7 @@ static int jack_set_hw_constraint(snd_pcm_jack_t *jack)
 	    (err = snd_pcm_ioplug_set_param_list(&jack->io, SND_PCM_IOPLUG_HW_FORMAT,
 						 1, &format)) < 0 ||
 	    (err = snd_pcm_ioplug_set_param_minmax(&jack->io, SND_PCM_IOPLUG_HW_CHANNELS,
-						   jack->channels, jack->channels)) < 0 ||
+						   jack->num_ports, jack->num_ports)) < 0 ||
 	    (err = snd_pcm_ioplug_set_param_minmax(&jack->io, SND_PCM_IOPLUG_HW_RATE,
 						   rate, rate)) < 0 ||
 	    (err = snd_pcm_ioplug_set_param_list(&jack->io, SND_PCM_IOPLUG_HW_PERIOD_BYTES,
@@ -485,8 +490,7 @@ static int snd_pcm_jack_open(snd_pcm_t **pcmp, const char *name,
 		return err;
 	}
 
-	jack->channels = jack->num_ports;
-	if (jack->channels == 0) {
+	if (jack->num_ports == 0) {
 		SNDERR("define the %s_ports section",
 		       stream == SND_PCM_STREAM_PLAYBACK ? "playback" : "capture");
 		snd_pcm_jack_free(jack);
@@ -514,7 +518,7 @@ static int snd_pcm_jack_open(snd_pcm_t **pcmp, const char *name,
 		return -ENOENT;
 	}
 
-	jack->areas = calloc(jack->channels, sizeof(snd_pcm_channel_area_t));
+	jack->areas = calloc(jack->num_ports, sizeof(snd_pcm_channel_area_t));
 	if (! jack->areas) {
 		snd_pcm_jack_free(jack);
 		return -ENOMEM;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH - ALSA JACK plugin 2/2] jack: Removing snd_pcm_jack_format_t as it is not used
  2019-01-11  5:15 [PATCH - ALSA JACK plugin 1/2] jack: Replacing jack->channels with jack->num_ports laxmi.devi
@ 2019-01-11  5:15 ` laxmi.devi
  2019-01-11  7:53 ` [PATCH - ALSA JACK plugin 1/2] jack: Replacing jack->channels with jack->num_ports Jaroslav Kysela
  1 sibling, 0 replies; 4+ messages in thread
From: laxmi.devi @ 2019-01-11  5:15 UTC (permalink / raw)
  To: patch; +Cc: twischer, alsa-devel, Laxmi Devi

From: Laxmi Devi <Laxmi.Devi@in.bosch.com>

Signed-off-by: Laxmi Devi <Laxmi.Devi@in.bosch.com>

diff --git a/jack/pcm_jack.c b/jack/pcm_jack.c
index d723b17..b2bc213 100644
--- a/jack/pcm_jack.c
+++ b/jack/pcm_jack.c
@@ -31,10 +31,6 @@
 
 #define MAX_PERIODS_MULTIPLE 64
 
-typedef enum _jack_format {
-	SND_PCM_JACK_FORMAT_RAW
-} snd_pcm_jack_format_t;
-
 typedef struct {
 	snd_pcm_ioplug_t io;
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH - ALSA JACK plugin 1/2] jack: Replacing jack->channels with jack->num_ports
  2019-01-11  5:15 [PATCH - ALSA JACK plugin 1/2] jack: Replacing jack->channels with jack->num_ports laxmi.devi
  2019-01-11  5:15 ` [PATCH - ALSA JACK plugin 2/2] jack: Removing snd_pcm_jack_format_t as it is not used laxmi.devi
@ 2019-01-11  7:53 ` Jaroslav Kysela
  1 sibling, 0 replies; 4+ messages in thread
From: Jaroslav Kysela @ 2019-01-11  7:53 UTC (permalink / raw)
  To: laxmi.devi, patch; +Cc: twischer, alsa-devel

Dne 11.1.2019 v 06:15 laxmi.devi@in.bosch.com napsal(a):
> From: Laxmi Devi <Laxmi.Devi@in.bosch.com>
> 
> As jack->num_ports and jack->channels hold the same values,
> jack->channels is redundant and hence removed.
> 
> Sanity check is added in prepare, to check if io->Channels is
> same as jack->num_ports.

I applied both patches to the plugins repo. Thanks.

					Jaroslav

-- 
Jaroslav Kysela <perex@perex.cz>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH - ALSA JACK plugin 2/2] jack: Removing snd_pcm_jack_format_t as it is not used
  2019-01-11  4:49 laxmi.devi
@ 2019-01-11  4:49 ` laxmi.devi
  0 siblings, 0 replies; 4+ messages in thread
From: laxmi.devi @ 2019-01-11  4:49 UTC (permalink / raw)
  To: patch; +Cc: twischer, alsa-devel, Laxmi Devi

From: Laxmi Devi <Laxmi.Devi@in.bosch.com>

Signed-off-by: Laxmi Devi <Laxmi.Devi@in.bosch.com>

diff --git a/jack/pcm_jack.c b/jack/pcm_jack.c
index d723b17..b2bc213 100644
--- a/jack/pcm_jack.c
+++ b/jack/pcm_jack.c
@@ -31,10 +31,6 @@
 
 #define MAX_PERIODS_MULTIPLE 64
 
-typedef enum _jack_format {
-	SND_PCM_JACK_FORMAT_RAW
-} snd_pcm_jack_format_t;
-
 typedef struct {
 	snd_pcm_ioplug_t io;
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-01-11  7:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-11  5:15 [PATCH - ALSA JACK plugin 1/2] jack: Replacing jack->channels with jack->num_ports laxmi.devi
2019-01-11  5:15 ` [PATCH - ALSA JACK plugin 2/2] jack: Removing snd_pcm_jack_format_t as it is not used laxmi.devi
2019-01-11  7:53 ` [PATCH - ALSA JACK plugin 1/2] jack: Replacing jack->channels with jack->num_ports Jaroslav Kysela
  -- strict thread matches above, loose matches on Subject: below --
2019-01-11  4:49 laxmi.devi
2019-01-11  4:49 ` [PATCH - ALSA JACK plugin 2/2] jack: Removing snd_pcm_jack_format_t as it is not used laxmi.devi

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.