Skip to contentSkip to conversation

cplay: Stop playback stream at the end

PATCH In review Daniel Baluta 2 participants 4 messages Jun 27, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cplay: Stop playback stream at the end

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'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(+)
src/utils/cplay.c +1 -0
index 87863a3..3c48d15 100644
@@ -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);
Signature · 1 line
2.7.4
#1 lore raw
Quoted 5 lines · 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.

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

Quoted 8 lines

---
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

Quoted 4 lines

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

Quoted 24 lines

 src/utils/cplay.c | 1 +
 1 file changed, 1 insertion(+)
src/utils/cplay.c +1 -0
index 87863a3..3c48d15 100644
@@ -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);
Signature · 6 lines
2.7.4

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Signature · 1 line
~Vinod
#2 lore raw
Quoted 25 lines · Vinod
Quoted 6 lines · 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.

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

Quoted 10 lines

---
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

Quoted 4 lines

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.

Quoted 5 lines

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
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#3 lore raw
Quoted 30 lines · Daniel Baluta
Quoted 29 lines · Vinod
Quoted 6 lines · 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.

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

Quoted 10 lines

---
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

Quoted 4 lines

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.

Quoted 8 lines
Quoted 1 line

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

Quoted 2 lines

Thanks we can drop this patch then.

Okay

Signature · 1 line
~Vinod