Skip to content

Commit af3d8ec

Browse files
committed
Optimize clear
1 parent 5f71c75 commit af3d8ec

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Runtime/Scripts/RtcAudioSource.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,10 @@ private void OnAudioRead(float[] data, int channels, int sampleRate)
106106
}
107107
// Don't play the audio locally, to avoid echo.
108108
if (_sourceType == RtcAudioSourceType.AudioSourceMicrophone)
109-
Array.Clear(data, 0, data.Length);
109+
{
110+
Span<float> span = data;
111+
span.Clear();
112+
}
110113
}
111114

112115
private void Capture(AudioFrame frame)

0 commit comments

Comments
 (0)