Skip to content

Commit

Permalink
Revert "Send silence frames upon connection (Fix #301)"
Browse files Browse the repository at this point in the history
This reverts commit 83a0c85.

This makes voice sending work again.
  • Loading branch information
Zeyla Hellyer committed Aug 12, 2018
1 parent 8bec4af commit 0bbe5f5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
1 change: 0 additions & 1 deletion src/voice/audio.rs
Expand Up @@ -6,7 +6,6 @@ use std::{

pub const HEADER_LEN: usize = 12;
pub const SAMPLE_RATE: u32 = 48_000;
pub static SILENT_FRAME: [u8; 3] = [0xf8, 0xff, 0xfe];

/// A readable audio source.
pub trait AudioSource: Send {
Expand Down
7 changes: 3 additions & 4 deletions src/voice/connection.rs
Expand Up @@ -45,7 +45,7 @@ use std::{
},
time::Duration
};
use super::audio::{AudioReceiver, AudioType, LockedAudio, HEADER_LEN, SAMPLE_RATE, SILENT_FRAME};
use super::audio::{AudioReceiver, AudioType, HEADER_LEN, SAMPLE_RATE, LockedAudio};
use super::connection_info::ConnectionInfo;
use super::{payload, VoiceError, CRYPTO_MODE};
use websocket::{
Expand Down Expand Up @@ -200,8 +200,7 @@ impl Connection {
keepalive_timer: Timer::new(temp_heartbeat),
udp,
sequence: 0,
// We need to send some frames to receive any audio.
silence_frames: 100,
silence_frames: 0,
soft_clip,
speaking: false,
ssrc: hello.ssrc,
Expand Down Expand Up @@ -393,7 +392,7 @@ impl Connection {
self.silence_frames -= 1;

// Explicit "Silence" frame.
opus_frame.extend_from_slice(&SILENT_FRAME);
opus_frame.extend_from_slice(&[0xf8, 0xff, 0xfe]);
} else {
// Per official guidelines, send 5x silence BEFORE we stop speaking.
self.set_speaking(false)?;
Expand Down

0 comments on commit 0bbe5f5

Please sign in to comment.