alsabat: use variable for thread return value

Use variable instead of 0/1 to indicate the return value of
playback and capture threads.

Signed-off-by: Lu, Han <han.lu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Lu, Han 2016-03-21 19:05:49 +08:00 committed by Takashi Iwai
parent f2f6583ee6
commit 98de9f7905

View file

@ -383,13 +383,13 @@ void *playback_alsa(struct bat *bat)
if (err != 0) { if (err != 0) {
fprintf(bat->err, _("Cannot open PCM playback device: ")); fprintf(bat->err, _("Cannot open PCM playback device: "));
fprintf(bat->err, _("%s(%d)\n"), snd_strerror(err), err); fprintf(bat->err, _("%s(%d)\n"), snd_strerror(err), err);
retval_play = 1; retval_play = err;
goto exit1; goto exit1;
} }
err = set_snd_pcm_params(bat, &sndpcm); err = set_snd_pcm_params(bat, &sndpcm);
if (err != 0) { if (err != 0) {
retval_play = 1; retval_play = err;
goto exit2; goto exit2;
} }
@ -406,20 +406,20 @@ void *playback_alsa(struct bat *bat)
if (bat->fp == NULL) { if (bat->fp == NULL) {
fprintf(bat->err, _("Cannot open file: %s %d\n"), fprintf(bat->err, _("Cannot open file: %s %d\n"),
bat->playback.file, err); bat->playback.file, err);
retval_play = 1; retval_play = err;
goto exit3; goto exit3;
} }
/* Skip header */ /* Skip header */
err = read_wav_header(bat, bat->playback.file, bat->fp, true); err = read_wav_header(bat, bat->playback.file, bat->fp, true);
if (err != 0) { if (err != 0) {
retval_play = 1; retval_play = err;
goto exit4; goto exit4;
} }
} }
err = write_to_pcm_loop(&sndpcm, bat); err = write_to_pcm_loop(&sndpcm, bat);
if (err != 0) { if (err != 0) {
retval_play = 1; retval_play = err;
goto exit4; goto exit4;
} }
@ -533,13 +533,13 @@ void *record_alsa(struct bat *bat)
if (err != 0) { if (err != 0) {
fprintf(bat->err, _("Cannot open PCM capture device: ")); fprintf(bat->err, _("Cannot open PCM capture device: "));
fprintf(bat->err, _("%s(%d)\n"), snd_strerror(err), err); fprintf(bat->err, _("%s(%d)\n"), snd_strerror(err), err);
retval_record = 1; retval_record = err;
goto exit1; goto exit1;
} }
err = set_snd_pcm_params(bat, &sndpcm); err = set_snd_pcm_params(bat, &sndpcm);
if (err != 0) { if (err != 0) {
retval_record = 1; retval_record = err;
goto exit2; goto exit2;
} }
@ -549,7 +549,7 @@ void *record_alsa(struct bat *bat)
if (fp == NULL) { if (fp == NULL) {
fprintf(bat->err, _("Cannot open file: %s %d\n"), fprintf(bat->err, _("Cannot open file: %s %d\n"),
bat->capture.file, err); bat->capture.file, err);
retval_record = 1; retval_record = err;
goto exit3; goto exit3;
} }
@ -563,7 +563,7 @@ void *record_alsa(struct bat *bat)
err = write_wav_header(fp, &wav, bat); err = write_wav_header(fp, &wav, bat);
if (err != 0) { if (err != 0) {
retval_record = 1; retval_record = err;
goto exit4; goto exit4;
} }
@ -571,7 +571,7 @@ void *record_alsa(struct bat *bat)
fprintf(bat->log, _("Recording ...\n")); fprintf(bat->log, _("Recording ...\n"));
err = read_from_pcm_loop(fp, count, &sndpcm, bat); err = read_from_pcm_loop(fp, count, &sndpcm, bat);
if (err != 0) { if (err != 0) {
retval_record = 1; retval_record = err;
goto exit4; goto exit4;
} }