Skip to content

Commit

Permalink
Remove restrictions on --channels
Browse files Browse the repository at this point in the history
  • Loading branch information
iizukanao committed Sep 22, 2018
1 parent d4f4df9 commit d7459ea
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -2552,13 +2552,16 @@ static void preconfigure_microphone() {
log_debug("cannot use mono audio; trying stereo\n");
}
audio_channels = 2;
} else {
} else if (audio_channels == 2) {
if (is_audio_channels_specified) {
log_info("cannot use stereo audio; trying mono\n");
} else {
log_debug("cannot use stereo audio; trying mono\n");
}
audio_channels = 1;
} else { // user has specified audio channels
log_info("cannot use %d channels audio; trying mono\n", audio_channels);
audio_channels = 1;
}
err = snd_pcm_hw_params_set_channels(capture_handle, alsa_hw_params, audio_channels);
if (err < 0) {
Expand Down Expand Up @@ -5715,10 +5718,6 @@ int main(int argc, char **argv) {
print_usage();
return EXIT_FAILURE;
}
if (value != 1 && value != 2) {
log_fatal("error: invalid channels: %ld (must be 1 or 2)\n", value);
return EXIT_FAILURE;
}
audio_channels = value;
is_audio_channels_specified = 1;
break;
Expand Down

0 comments on commit d7459ea

Please sign in to comment.