Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/WindowsAudioEndPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -229,13 +229,15 @@ public Task PauseAudio()
{
_isPaused = true;
_waveInEvent?.StopRecording();
_waveOutEvent?.Stop();
return Task.CompletedTask;
}

public Task ResumeAudio()
{
_isPaused = false;
_waveInEvent?.StartRecording();
_waveOutEvent?.Play();
return Task.CompletedTask;
}

Expand Down Expand Up @@ -286,15 +288,15 @@ private void LocalAudioSampleAvailable(object sender, WaveInEventArgs args)
/// <param name="pcmSample">Raw PCM sample from remote party.</param>
public void GotAudioSample(byte[] pcmSample)
{
if (_waveProvider != null)
if (_waveProvider != null && !_isPaused)
{
_waveProvider.AddSamples(pcmSample, 0, pcmSample.Length);
}
}

public void GotAudioRtp(IPEndPoint remoteEndPoint, uint ssrc, uint seqnum, uint timestamp, int payloadID, bool marker, byte[] payload)
{
if (_waveProvider != null && _audioEncoder != null)
if (_waveProvider != null && _audioEncoder != null && !_isPaused)
{
var pcmSample = _audioEncoder.DecodeAudio(payload, _audioFormatManager.SelectedFormat);
byte[] pcmBytes = pcmSample.SelectMany(x => BitConverter.GetBytes(x)).ToArray();
Expand Down