Safer way of avoiding the race condition in

audio_driver_sample/audio_driver_sample_batch - we can check
is_display_mode_switching to see if we're doing a fs/windowed toggle
(full teardown/setup), no audio should be processed at this point in
time
This commit is contained in:
twinaphex 2021-08-30 04:52:28 +02:00
parent d45945cda2
commit d429ecf304

View File

@ -28244,6 +28244,8 @@ static void audio_driver_sample(int16_t left, int16_t right)
/* If this returns false, it's probably a good time to bail */
if (!p_rarch->audio_driver_output_samples_conv_buf)
return;
if (p_rarch->rarch_is_switching_display_mode)
return;
p_rarch->audio_driver_output_samples_conv_buf[p_rarch->audio_driver_data_ptr++] = left;
p_rarch->audio_driver_output_samples_conv_buf[p_rarch->audio_driver_data_ptr++] = right;
@ -28356,7 +28358,7 @@ static size_t audio_driver_sample_batch(const int16_t *data, size_t frames)
if (frames > (AUDIO_CHUNK_SIZE_NONBLOCKING >> 1))
frames = AUDIO_CHUNK_SIZE_NONBLOCKING >> 1;
if (p_rarch->audio_suspended)
if (p_rarch->audio_suspended || p_rarch->rarch_is_switching_display_mode)
return frames;
if ( p_rarch->recording_data &&