Merge pull request #62135 from madmiraal/fix-60712-3.x

This commit is contained in:
Rémi Verschelde 2022-06-17 12:20:44 +02:00 committed by GitHub
commit db5550a3b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 10 deletions

View file

@ -66,8 +66,6 @@ bool AudioEffectRecordInstance::process_silence() const {
} }
void AudioEffectRecordInstance::_io_thread_process() { void AudioEffectRecordInstance::_io_thread_process() {
thread_active = true;
while (is_recording) { while (is_recording) {
//Check: The current recording has been requested to stop //Check: The current recording has been requested to stop
if (!base->recording_active) { if (!base->recording_active) {
@ -81,8 +79,6 @@ void AudioEffectRecordInstance::_io_thread_process() {
OS::get_singleton()->delay_usec(500); OS::get_singleton()->delay_usec(500);
} }
} }
thread_active = false;
} }
void AudioEffectRecordInstance::_io_store_buffer() { void AudioEffectRecordInstance::_io_store_buffer() {
@ -126,9 +122,7 @@ void AudioEffectRecordInstance::finish() {
#ifdef NO_THREADS #ifdef NO_THREADS
AudioServer::get_singleton()->remove_update_callback(&AudioEffectRecordInstance::_update, this); AudioServer::get_singleton()->remove_update_callback(&AudioEffectRecordInstance::_update, this);
#else #else
if (thread_active) { io_thread.wait_to_finish();
io_thread.wait_to_finish();
}
#endif #endif
} }

View file

@ -49,7 +49,6 @@ class AudioEffectRecordInstance : public AudioEffectInstance {
bool is_recording; bool is_recording;
Thread io_thread; Thread io_thread;
bool thread_active;
Vector<AudioFrame> ring_buffer; Vector<AudioFrame> ring_buffer;
Vector<float> recording_data; Vector<float> recording_data;
@ -70,8 +69,7 @@ public:
virtual void process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count); virtual void process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count);
virtual bool process_silence() const; virtual bool process_silence() const;
AudioEffectRecordInstance() : AudioEffectRecordInstance() {}
thread_active(false) {}
~AudioEffectRecordInstance(); ~AudioEffectRecordInstance();
}; };