X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=alsa_input.cpp;h=7230abeecd10839c8bcbb84c87a40d9c18115747;hb=d3e48df512d9476d3849227067792a3537bb094e;hp=3b59c00b6139ebe6737e0e2122fab66195b3760a;hpb=f07adb19f0e2571bf4894ec57e6fcfe4a3e5fd95;p=nageru diff --git a/alsa_input.cpp b/alsa_input.cpp index 3b59c00..7230abe 100644 --- a/alsa_input.cpp +++ b/alsa_input.cpp @@ -101,6 +101,7 @@ bool ALSAInput::open_device() default: assert(false); } + audio_format.sample_rate = sample_rate; //printf("num_periods=%u period_size=%u buffer_frames=%u sample_rate=%u bits_per_sample=%d\n", // num_periods, unsigned(period_size), unsigned(buffer_frames), sample_rate, audio_format.bits_per_sample); @@ -183,7 +184,9 @@ void ALSAInput::capture_thread_func() if (should_quit.should_quit()) { // Don't call free_card(); that would be a deadlock. - WARN_ON_ERROR("snd_pcm_close()", snd_pcm_close(pcm_handle)); + if (pcm_handle) { + WARN_ON_ERROR("snd_pcm_close()", snd_pcm_close(pcm_handle)); + } pcm_handle = nullptr; return; }