1
0

In audio_destroy() check for a paStreamIsStopped error.

This commit is contained in:
Alexander Andreev 2024-03-30 03:13:17 +04:00
parent fa589f3122
commit 399c060525
Signed by: Arav
GPG Key ID: 25969B23DCB5CA34

View File

@ -71,19 +71,19 @@ int audio_destroy(audio_t *aud) {
return -1; return -1;
} }
if ((pa_err = Pa_CloseStream(aud->stream_in)) != paNoError) { if ((pa_err = Pa_CloseStream(aud->stream_in)) != paNoError && pa_err != paStreamIsStopped) {
fprintf(stderr, "Cannot close an input PortAudio stream: %s\n", Pa_GetErrorText(pa_err)); fprintf(stderr, "Cannot close an input PortAudio stream: %s\n", Pa_GetErrorText(pa_err));
return -1; return -1;
} }
} }
if (aud->stream_out != NULL) { if (aud->stream_out != NULL) {
if ((pa_err = Pa_StopStream(aud->stream_out)) != paNoError) { if ((pa_err = Pa_StopStream(aud->stream_out)) != paNoError && pa_err != paStreamIsStopped) {
fprintf(stderr, "Cannot stop an output PortAudio stream: %s\n", Pa_GetErrorText(pa_err)); fprintf(stderr, "Cannot stop an output PortAudio stream: %s\n", Pa_GetErrorText(pa_err));
return -1; return -1;
} }
if ((pa_err = Pa_CloseStream(aud->stream_out)) != paNoError) { if ((pa_err = Pa_CloseStream(aud->stream_out)) != paNoError && pa_err != paStreamIsStopped) {
fprintf(stderr, "Cannot close an output PortAudio stream: %s\n", Pa_GetErrorText(pa_err)); fprintf(stderr, "Cannot close an output PortAudio stream: %s\n", Pa_GetErrorText(pa_err));
return -1; return -1;
} }