simpleaudio: do not crash on stereo input file
Complain about non-mono input audio files instead of crashing. Thanks goblin@github for the report. GitHub: fixes kamalmostafa/minimodem#1
This commit is contained in:
parent
3c227b516a
commit
3c5ac8819d
|
@ -111,6 +111,13 @@ simpleaudio_open_stream(
|
||||||
backend_device, sa_stream_direction, sa_format,
|
backend_device, sa_stream_direction, sa_format,
|
||||||
rate, channels, app_name, stream_name);
|
rate, channels, app_name, stream_name);
|
||||||
|
|
||||||
|
if ( sa->channels != channels ) {
|
||||||
|
fprintf(stderr, "%s: input stream must be %u-channel (not %u)\n",
|
||||||
|
stream_name, channels, sa->channels);
|
||||||
|
simpleaudio_close(sa);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if ( ok ) {
|
if ( ok ) {
|
||||||
assert( sa->backend_framesize == sa->channels * sa->samplesize );
|
assert( sa->backend_framesize == sa->channels * sa->samplesize );
|
||||||
return sa;
|
return sa;
|
||||||
|
|
Loading…
Reference in New Issue