All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH tinycompress] cplay: Stop playback stream at the end
@ 2018-06-27  7:48 Daniel Baluta
  2018-06-27 10:24 ` Vinod
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Baluta @ 2018-06-27  7:48 UTC (permalink / raw)
  To: alsa-devel, vinod.koul, vkoul; +Cc: shengjiu.wang, Daniel Baluta

Each compress_start should have a corresponding compress_stop
at the end.

Also, this gives user a change to cleanup resources that might
have been allocated in compress_start.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
---
I'm implementing codec library dynamic loading at runtime and I'm exploring
using:
	* SNDRV_COMPRESS_START -> to load the library
	* SNDRV_COMPRESS_STOP  -> to unload the library

This might not be the best idea becasue for example loading
the library might introduce some delays, anyhow i still think
this that compress_stop is correct thing to add at the end of
playback.


 src/utils/cplay.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/utils/cplay.c b/src/utils/cplay.c
index 87863a3..3c48d15 100644
--- a/src/utils/cplay.c
+++ b/src/utils/cplay.c
@@ -403,6 +403,7 @@ void play_samples(char *name, unsigned int card, unsigned int device,
 		printf("%s: exit success\n", __func__);
 	/* issue drain if it supports */
 	compress_drain(compress);
+	compress_stop(compress);
 	free(buffer);
 	fclose(file);
 	compress_close(compress);
-- 
2.7.4

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

* Re: [PATCH tinycompress] cplay: Stop playback stream at the end
  2018-06-27  7:48 [PATCH tinycompress] cplay: Stop playback stream at the end Daniel Baluta
@ 2018-06-27 10:24 ` Vinod
  2018-06-27 11:15   ` Daniel Baluta
  0 siblings, 1 reply; 4+ messages in thread
From: Vinod @ 2018-06-27 10:24 UTC (permalink / raw)
  To: Daniel Baluta; +Cc: alsa-devel, shengjiu.wang

On 27-06-18, 10:48, Daniel Baluta wrote:
> Each compress_start should have a corresponding compress_stop
> at the end.
> 
> Also, this gives user a change to cleanup resources that might
> have been allocated in compress_start.

I think the assumptions are not quite correct here, resources should be
allocated in .open and cleanup in .free for driver callback.

> 
> Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
> ---
> I'm implementing codec library dynamic loading at runtime and I'm exploring
> using:
> 	* SNDRV_COMPRESS_START -> to load the library
> 	* SNDRV_COMPRESS_STOP  -> to unload the library
> 
> This might not be the best idea becasue for example loading
> the library might introduce some delays, anyhow i still think
> this that compress_stop is correct thing to add at the end of
> playback.

I think you should tie the library load to much earlier in path. Not in
start.

Also, we invoke drain and hence there is no need of stop

> 
> 
>  src/utils/cplay.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/utils/cplay.c b/src/utils/cplay.c
> index 87863a3..3c48d15 100644
> --- a/src/utils/cplay.c
> +++ b/src/utils/cplay.c
> @@ -403,6 +403,7 @@ void play_samples(char *name, unsigned int card, unsigned int device,
>  		printf("%s: exit success\n", __func__);
>  	/* issue drain if it supports */
>  	compress_drain(compress);
> +	compress_stop(compress);
>  	free(buffer);
>  	fclose(file);
>  	compress_close(compress);
> -- 
> 2.7.4
> 
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

-- 
~Vinod

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

* Re: [PATCH tinycompress] cplay: Stop playback stream at the end
  2018-06-27 10:24 ` Vinod
@ 2018-06-27 11:15   ` Daniel Baluta
  2018-06-27 11:51     ` Vinod
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Baluta @ 2018-06-27 11:15 UTC (permalink / raw)
  To: vkoul; +Cc: S.j. Wang, alsa-devel, liam.r.girdwood

On Mi, 2018-06-27 at 15:54 +0530, Vinod wrote:
> On 27-06-18, 10:48, Daniel Baluta wrote:
> > 
> > Each compress_start should have a corresponding compress_stop
> > at the end.
> > 
> > Also, this gives user a change to cleanup resources that might
> > have been allocated in compress_start.
> I think the assumptions are not quite correct here, resources should
> be
> allocated in .open and cleanup in .free for driver callback.
> 
> > 
> > 
> > Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
> > ---
> > I'm implementing codec library dynamic loading at runtime and I'm
> > exploring
> > using:
> > 	* SNDRV_COMPRESS_START -> to load the library
> > 	* SNDRV_COMPRESS_STOP  -> to unload the library
> > 
> > This might not be the best idea becasue for example loading
> > the library might introduce some delays, anyhow i still think
> > this that compress_stop is correct thing to add at the end of
> > playback.
> I think you should tie the library load to much earlier in path. Not
> in
> start.
> 
> Also, we invoke drain and hence there is no need of stop

Got your point here. 

Perhaps,

 - use .hw_params to load the codec library.
 - add .hw_free (as Liam suggested in a separate email) to unload the      codec library.

Thanks we can drop this patch then.

Daniel.
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* Re: [PATCH tinycompress] cplay: Stop playback stream at the end
  2018-06-27 11:15   ` Daniel Baluta
@ 2018-06-27 11:51     ` Vinod
  0 siblings, 0 replies; 4+ messages in thread
From: Vinod @ 2018-06-27 11:51 UTC (permalink / raw)
  To: Daniel Baluta; +Cc: S.j. Wang, alsa-devel, liam.r.girdwood

On 27-06-18, 11:15, Daniel Baluta wrote:
> On Mi, 2018-06-27 at 15:54 +0530, Vinod wrote:
> > On 27-06-18, 10:48, Daniel Baluta wrote:
> > > 
> > > Each compress_start should have a corresponding compress_stop
> > > at the end.
> > > 
> > > Also, this gives user a change to cleanup resources that might
> > > have been allocated in compress_start.
> > I think the assumptions are not quite correct here, resources should
> > be
> > allocated in .open and cleanup in .free for driver callback.
> > 
> > > 
> > > 
> > > Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
> > > ---
> > > I'm implementing codec library dynamic loading at runtime and I'm
> > > exploring
> > > using:
> > > 	* SNDRV_COMPRESS_START -> to load the library
> > > 	* SNDRV_COMPRESS_STOP  -> to unload the library
> > > 
> > > This might not be the best idea becasue for example loading
> > > the library might introduce some delays, anyhow i still think
> > > this that compress_stop is correct thing to add at the end of
> > > playback.
> > I think you should tie the library load to much earlier in path. Not
> > in
> > start.
> > 
> > Also, we invoke drain and hence there is no need of stop
> 
> Got your point here. 
> 
> Perhaps,
> 
>  - use .hw_params to load the codec library.
>  - add .hw_free (as Liam suggested in a separate email) to unload the      codec library.

Sure, sounds better design to me

> 
> Thanks we can drop this patch then.

Okay

-- 
~Vinod

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

end of thread, other threads:[~2018-06-27 11:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-27  7:48 [PATCH tinycompress] cplay: Stop playback stream at the end Daniel Baluta
2018-06-27 10:24 ` Vinod
2018-06-27 11:15   ` Daniel Baluta
2018-06-27 11:51     ` Vinod

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.