Skip to contentSkip to conversation

allow pause and resume during draining

PATCH Superseded Gyeongtaek Lee 1 participant 1 message Nov 4, 2020 1 message not in the archive

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): CGME20201104030800epcas2p1b74b02554b9174bfafb7ce21accd65f0@epcas2p1.samsung.com

#1 lore raw

v2 cover allow pause and resume during draining

Quoted 16 lines · Takashi Iwai
Quoted 14 lines · Gyeongtaek Lee

With a stream with low bitrate, user can't pause or resume the stream near the end of the stream because current ALSA doesn't allow it. If the stream has very low bitrate enough to store whole stream into the buffer, user can't do anything except stop the stream and then restart it from the first because most of applications call draining after sending last frame to the kernel.
If pause, resume are allowed during draining, user experience can be enhanced.
To prevent malfunction in HW drivers which don't support pause during draining, pause during draining will only work if HW driver enable this feature explicitly by calling snd_compr_use_pause_in_draining().

Quoted 9 lines
Quoted 2 lines

Could you restart the new thread? It's been hanging too deeply and hard to read through.

Since it's the revised patch, please give the revision number (v2 or such) and show what's different from the previous patches.

Ok. I'll send the patch again with [PATCH v2] prefix.

Quoted 18 lines

About the changes:

Review

Quoted 12 lines
(quoted diff) +12 -0
+/**
+ * snd_compr_use_pause_in_draining - Allow pause and resume in draining state
+ * @substream: compress substream to set
+ *
+ * Allow pause and resume in draining state.
+ * Only HW driver supports this transition can call this API.
+ */
+static inline void snd_compr_use_pause_in_draining(
+					struct snd_compr_stream *substream)
+{
+	substream->device->use_pause_in_draining = true;
+}

How to set the flag is an open question. A natural way would be to set it somehow at creating the component object, but currently there seems no way to pass any flags.

Could you explain more about what is your concerning?
For me, calling snd_compr_use_pause_in_draining() in open() callback of snd_compr_ops was good enough.
I've tested it and it worked well on linux 5.4.

Quoted 6 lines

thanks,

Takashi

Gyeongtaek Lee (1):
ALSA: compress: allow pause and resume during draining

 include/sound/compress_driver.h | 17 +++++++++++++
 sound/core/compress_offload.c   | 44 +++++++++++++++++++++++++++------
 2 files changed, 53 insertions(+), 8 deletions(-)

base-commit: 3cea11cd5e3b00d91caf0b4730194039b45c5891

Signature · 1 line
2.21.0