Re: Getting pcm_usb_stream plugin to know its limits.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



michael@xxxxxxxxxxxxx (Michaël Cadilhac) writes:

> --- pcm_usb_stream.c	2008-11-21 18:08:16.000000000 -0500
> +++ pcm_usb_stream.c	2009-12-30 12:36:00.654452577 -0500
> @@ -258,7 +258,7 @@
>  	snd_pcm_us_t *us = io->private_data;
>  	VDBG("%u", us->uus->s->periods_done);
>  
> -	if (io->stream == SND_PCM_STREAM_PLAYBACK)
> +	if (io->stream == SND_PCM_STREAM_PLAYBACK && us->uus->s)
>  		memset(us->uus->write_area, 0, us->uus->s->write_size);
>  
>  	return 0;

Just noticed that it would be better phrased as:
--- /dd/alsa-plugins/usb_stream/pcm_usb_stream.c	2008-11-21 18:08:16.000000000 -0500
+++ pcm_usb_stream.c	2009-12-30 12:57:13.779349630 -0500
@@ -256,7 +256,10 @@
 static int snd_pcm_us_stop(snd_pcm_ioplug_t *io)
 {
 	snd_pcm_us_t *us = io->private_data;
-	VDBG("%u", us->uus->s->periods_done);
 
+	if (!us->uus->s)
+	  return 0;
+
+	VDBG("%u", us->uus->s->periods_done);
 	if (io->stream == SND_PCM_STREAM_PLAYBACK)
 		memset(us->uus->write_area, 0, us->uus->s->write_size);
-- 
Michaël `Micha' Cadilhac (LITQ, U. de Montréal) -- http://michael.cadilhac.name
	|| Un certain Blaise Pascal
	||   etc... etc...
	|| -- Prévert (Les paris stupides)
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux