[alsa-devel] [PATCH 01/10] alsabat: add default device name for playback and capture

Takashi Iwai tiwai at suse.de
Tue Mar 8 11:15:57 CET 2016


On Mon, 07 Mar 2016 02:24:02 +0100,
Lu, Han wrote:
> 
> > -----Original Message-----
> > From: Takashi Iwai [mailto:tiwai at suse.de]
> > Sent: Saturday, March 5, 2016 4:57 AM
> > To: Lu, Han <han.lu at intel.com>
> > Cc: liam.r.girdwood at linux.intel.com; Gautier, Bernard
> > <bernard.gautier at intel.com>; Popescu, Edward C
> > <edward.c.popescu at intel.com>; alsa-devel at alsa-project.org
> > Subject: Re: [PATCH 01/10] alsabat: add default device name for playback
> > and capture
> > 
> > On Wed, 02 Mar 2016 09:53:11 +0100,
> > han.lu at intel.com wrote:
> > >
> > > From: "Lu, Han" <han.lu at intel.com>
> > >
> > > Add default name for the playback and capture devices, in case they
> > > were not set by user through '-D', '-P' or '-C' options.
> > > The patch was tested on Ubuntu and Chrome OS.
> > >
> > > Signed-off-by: Lu, Han <han.lu at intel.com>
> > >
> > > diff --git a/bat/alsa.c b/bat/alsa.c
> > > index 5eaa25b..5775748 100644
> > > --- a/bat/alsa.c
> > > +++ b/bat/alsa.c
> > > @@ -377,12 +377,6 @@ void *playback_alsa(struct bat *bat)
> > >  	retval_play = 0;
> > >  	memset(&sndpcm, 0, sizeof(sndpcm));
> > >
> > > -	if (bat->playback.device == NULL) {
> > > -		fprintf(bat->err, _("No PCM device for playback: exit\n"));
> > > -		retval_play = 1;
> > > -		goto exit1;
> > > -	}
> > > -
> > >  	err = snd_pcm_open(&sndpcm.handle, bat->playback.device,
> > >  			SND_PCM_STREAM_PLAYBACK, 0);
> > >  	if (err != 0) {
> > > @@ -533,12 +527,6 @@ void *record_alsa(struct bat *bat)
> > >  	retval_record = 0;
> > >  	memset(&sndpcm, 0, sizeof(sndpcm));
> > >
> > > -	if (bat->capture.device == NULL) {
> > > -		fprintf(bat->err, _("No PCM device for capture: exit\n"));
> > > -		retval_record = 1;
> > > -		goto exit1;
> > > -	}
> > > -
> > >  	err = snd_pcm_open(&sndpcm.handle, bat->capture.device,
> > >  			SND_PCM_STREAM_CAPTURE, 0);
> > >  	if (err != 0) {
> > > diff --git a/bat/bat.c b/bat/bat.c
> > > index ddb60b7..9c637f2 100644
> > > --- a/bat/bat.c
> > > +++ b/bat/bat.c
> > > @@ -473,6 +473,10 @@ static int bat_init(struct bat *bat)
> > >  			return err;
> > >  	}
> > >
> > > +	/* Set default playback and capture devices */
> > > +	if (bat->playback.device == NULL && bat->capture.device == NULL)
> > > +		bat->playback.device = bat->capture.device =
> > DEFAULT_DEV_NAME;
> > 
> > What if only one of playback and capture is specified?
> > 
> > 
> > Takashi
> 
> If only one of playback and capture is specified, the alsabat shall work on
> single line mode, where only one thread (playback or capture) will be started.
> The testbat.sh covers the test cases of single mode:
> 	feature_test "-P $dev_playback" "single line mode, playback"
> 	feature_test "-C $dev_capture --standalone" "single line mode, capture"
> Previously, if not specify any device, the alsabat will start playback and capture
> Threads, and then quit threads with error text. The patch is intend to make the
> alsabat works in case no device be specified, and the patch does not influence
> the cases of single line mode. 

OK.  But then please add such a detailed comment in the changelog
itself.


thanks,

Takashi


More information about the Alsa-devel mailing list