Play stream audio has some noise when used USynthComponent


My engine version is 4.27.

The test project is a new blank project created from editor.

I am testing the microphone playback function(UPixelStreamingAudioComponent) of PixelStreaming plug-in.

I found that there was noise when USynthComponent played the audio data obtained from webrtc.

But when I save the audio data locally, load it all and play it in the same way, there will be no noise problem.

Does anyone know the cause of the noise?

I solved this problem.

The reason for this problem is that the audio request is triggered by FAudioPlayoutRequester::Runnable::Run(), and Sleep() is used in this function to ensure that the data is requested once at a fixed time.

But the elapsed time of Sleep () is not accurate. Sleep(10ms) may will wait for 11ms.

So we comment the Sleep(), just keep this thread running while. This will bring more performance consumption, but it is not serious at present.

uint32 FAudioPlayoutRequester::Runnable::Run()
	this->LastAudioRequestTimeMs = rtc::TimeMillis();
	this->bIsRunning = true;

	// Request audio in a loop until this boolean is toggled off.
		int64_t Now = rtc::TimeMillis();
		int64_t DeltaMs = Now - this->LastAudioRequestTimeMs;

		// Check if the 10ms delta has elapsed, if it has not, then sleep the remaining
		if(DeltaMs < FAudioPlayoutRequester::RequestIntervalMs)
            //comment these codes
            //int64_t SleepTimeMs = FAudioPlayoutRequester::RequestIntervalMs - DeltaMs;
			//float SleepTimeSecs = (float)SleepTimeMs / 1000.0f;

		// Update request time to now seeing as the 10ms delta has elapsed
		this->LastAudioRequestTimeMs = Now;

		// Actually request playout

	return 0;