Deadlock in FGameplayMediaEncoder

Hi all, there appears to be a possibility of deadlock when restarting highlight recording, i.e. via FHighlightRecorder::Start specifically when there is not a dedicated audio thread. The two deadlocking threads are as follows:

GameThread:
FHighlightRecorder::Start() calls
FGameplayMediaEncoder::Get()->RegisterListener(this), which takes a scoped lock on
:lock: FGameplayMediaEncoder::ListenersCS. Then it calls (conditionally)
FGameplayMediaEncoder::Start(), which eventually calls
FAudioEncoder::RegisterListener(*this), which takes another lock:
:lock: FAudioEncoder::ListenersMutex

AudioMixerRenderThread:
Run()
FOutputBuffer::MixNextBuffer()
FMixerDevice::OnProcessAudioStream()
FMixerSubmix::ProcessAudio()
FMixerSubmix::SendAudioToSubmixBufferListeners()
FGameplayMediaEncoder::OnNewSubmixBuffer()
FGameplayMediaEncoder::ProcessAudioFrame()
FWmfAudioEncoder::Encode()
FAudioEncoder::OnEncodedAudioFrame(), which locks
:lock: FAudioEncoder::ListenersMutex. In that scope it calls
FGameplayMediaEncoder::OnEncodedAudioFrame() and locks
:lock: FGameplayMediaEncoder::ListenersCS, causing a deadlock with the Game thread

We’ve fixed it for ourselves, using this change: https://github.com/EpicGames/UnrealEngine/pull/12507