[PATCH] ALSA: compress: allow pause and resume during draining
Vinod Koul
vkoul at kernel.org
Thu Oct 1 12:29:38 CEST 2020
On 29-09-20, 10:54, Takashi Iwai wrote:
> On Tue, 29 Sep 2020 10:40:51 +0200,
> Gyeongtaek Lee wrote:
> >
> > On 9/29/20 04:13 PM, Takashi Iwai wrote:
> > >On Tue, 29 Sep 2020 03:51:35 +0200,
> > >Gyeongtaek Lee wrote:
> > >>
> > >> On 9/28/20 11:35 PM, Pierre-Louis Bossart wrote:
> > >> >On 9/28/20 6:13 AM, Jaroslav Kysela wrote:
> > >> >> Dne 28. 09. 20 v 12:50 Gyeongtaek Lee napsal(a):
> > >> >>> 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.
> > >> >>> If pause and resume is allowed during draining, user experience can be
> > >> >>> enhanced.
> > >> >>
> > >> >> It seems that we need a new state to handle the pause + drain condition for
> > >> >> this case.
> > >> >>
> > >> >> With this proposed change, the pause state in drain is invisible.
> > >> >
> > >> >Indeed it's be much nicer to have a new state, e..g
> > >> >SNDRV_PCM_STATE_DRAINING_PAUSED.
> > >> Ok. I will add the new state.
> > >> >
> > >> >One concern is that states are defined in uapi/sound/asoc.h, so wouldn't
> > >> >this have impacts on userspace as well? We'd change the value of
> > >> >SNDRV_PCM_STATE_LAST.
> > >> >
> > >> I also agree that adding new state and increase LAST value in the header of uapi
> > >> could be dangerous. So, I added it to comress_offload.h for now.
> > >> It could be merged into snd_pcm_state_t in someday with big changes.
> > >> Could you review the fixed patch below?
> > >
> > >Hrm, this resulted in rather more complex changes than the original
> > >patch. It shows that introducing yet another state is no good idea
> > >for this particular case.
> > >
> > >Since the possible application's behavior after this pause is as same
> > >as the normal pause (i.e. either resuming pause or dropping), I find
> > >it OK to take the original approach.
> > Thank you for the review.
> > I think that I should resend the original patch.
>
> Let's wait a bit for other opinions. We may add rather a new flag
> instead of introducing a new state, too, for example.
I was out for a week, back now ;-)
So bigger question is if kernel should handle this change or we ask
userspace to handle this. Userland knows that bit rate is less so small
buffer can be for longer duration so instead of sending dumb X bytes,
should it not scale the buffer based on bit rate?
>From that premise the partial_drain should be invoked only for last
write().
Also, I am bit skeptical for adding changes to states while we are
draining (that too partial one)... is this change driving complex
changes and should we push back to have this implemented better in
userland..?
>
> Also, I'm not sure about any side-effect to drivers that expect the
> pause only during the running state. We might need some check for a
> capability flag?
>
> In anyway, the timing is bad; it's too late for 5.10 to apply such a
> core change. Can we postpone this for 5.11?
Yes this needs more thinking, I am still not convinced kernel should
handle it!
Regards
--
~Vinod
More information about the Alsa-devel
mailing list