All of lore.kernel.org
 help / color / mirror / Atom feed
From: Charles Keepax <ckeepax@opensource.cirrus.com>
To: vkoul@kernel.org, tiwai@suse.com
Cc: patches@opensource.cirrus.com, alsa-devel@alsa-project.org
Subject: [PATCH v2 3/4] ALSA: compress: Don't allow paritial drain operations on capture streams
Date: Mon, 22 Jul 2019 10:24:35 +0100	[thread overview]
Message-ID: <20190722092436.651-3-ckeepax@opensource.cirrus.com> (raw)
In-Reply-To: <20190722092436.651-1-ckeepax@opensource.cirrus.com>

Partial drain and next track are intended for gapless playback and
don't really have an obvious interpretation for a capture stream, so
makes sense to not allow those operations on capture streams.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---

Changes since v1:
 - Continue to allow drain on capture streams.

Thanks,
Charles

 sound/core/compress_offload.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c
index 40dae723c59db..6cf5b8440cf30 100644
--- a/sound/core/compress_offload.c
+++ b/sound/core/compress_offload.c
@@ -834,6 +834,10 @@ static int snd_compr_next_track(struct snd_compr_stream *stream)
 	if (stream->runtime->state != SNDRV_PCM_STATE_RUNNING)
 		return -EPERM;
 
+	/* next track doesn't have any meaning for capture streams */
+	if (stream->direction == SND_COMPRESS_CAPTURE)
+		return -EPERM;
+
 	/* you can signal next track if this is intended to be a gapless stream
 	 * and current track metadata is set
 	 */
@@ -861,6 +865,10 @@ static int snd_compr_partial_drain(struct snd_compr_stream *stream)
 		break;
 	}
 
+	/* partial drain doesn't have any meaning for capture streams */
+	if (stream->direction == SND_COMPRESS_CAPTURE)
+		return -EPERM;
+
 	/* stream can be drained only when next track has been signalled */
 	if (stream->next_track == false)
 		return -EPERM;
-- 
2.11.0

  parent reply	other threads:[~2019-07-22  9:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-22  9:24 [PATCH v2 1/4] ALSA: compress: Fix regression on compressed capture streams Charles Keepax
2019-07-22  9:24 ` [PATCH v2 2/4] ALSA: compress: Prevent bypasses of set_params Charles Keepax
2019-07-23 10:08   ` Takashi Iwai
2019-07-22  9:24 ` Charles Keepax [this message]
2019-07-23 10:09   ` [PATCH v2 3/4] ALSA: compress: Don't allow paritial drain operations on capture streams Takashi Iwai
2019-07-22  9:24 ` [PATCH v2 4/4] ALSA: compress: Be more restrictive about when a drain is allowed Charles Keepax
2019-07-23 10:08   ` Takashi Iwai
2019-07-22 10:35 ` [PATCH v2 1/4] ALSA: compress: Fix regression on compressed capture streams Vinod Koul
2019-07-23 10:08 ` 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=20190722092436.651-3-ckeepax@opensource.cirrus.com \
    --to=ckeepax@opensource.cirrus.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=patches@opensource.cirrus.com \
    --cc=tiwai@suse.com \
    --cc=vkoul@kernel.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.