Driver: Remove spin_sleep in Mixer::march_deadline (#124)
* Remove spin_sleep * Remove comment
This commit is contained in:
@@ -77,10 +77,6 @@ features = ["voice", "gateway"]
|
|||||||
optional = true
|
optional = true
|
||||||
version = "0.1"
|
version = "0.1"
|
||||||
|
|
||||||
[dependencies.spin_sleep]
|
|
||||||
optional = true
|
|
||||||
version = "1"
|
|
||||||
|
|
||||||
[dependencies.streamcatcher]
|
[dependencies.streamcatcher]
|
||||||
optional = true
|
optional = true
|
||||||
version = "1"
|
version = "1"
|
||||||
@@ -161,7 +157,6 @@ driver-core = [
|
|||||||
"parking_lot",
|
"parking_lot",
|
||||||
"rand",
|
"rand",
|
||||||
"serenity-voice-model",
|
"serenity-voice-model",
|
||||||
"spin_sleep",
|
|
||||||
"streamcatcher",
|
"streamcatcher",
|
||||||
"typemap_rev",
|
"typemap_rev",
|
||||||
"url",
|
"url",
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ use discortp::{
|
|||||||
};
|
};
|
||||||
use flume::{Receiver, Sender, TryRecvError};
|
use flume::{Receiver, Sender, TryRecvError};
|
||||||
use rand::random;
|
use rand::random;
|
||||||
use spin_sleep::SpinSleeper;
|
|
||||||
use std::time::Instant;
|
use std::time::Instant;
|
||||||
use tokio::runtime::Handle;
|
use tokio::runtime::Handle;
|
||||||
use tracing::{debug, error, instrument};
|
use tracing::{debug, error, instrument};
|
||||||
@@ -38,7 +37,6 @@ pub struct Mixer {
|
|||||||
pub prevent_events: bool,
|
pub prevent_events: bool,
|
||||||
pub silence_frames: u8,
|
pub silence_frames: u8,
|
||||||
pub skip_sleep: bool,
|
pub skip_sleep: bool,
|
||||||
pub sleeper: SpinSleeper,
|
|
||||||
pub soft_clip: SoftClip,
|
pub soft_clip: SoftClip,
|
||||||
pub tracks: Vec<Track>,
|
pub tracks: Vec<Track>,
|
||||||
pub ws: Option<Sender<WsMessage>>,
|
pub ws: Option<Sender<WsMessage>>,
|
||||||
@@ -95,7 +93,6 @@ impl Mixer {
|
|||||||
prevent_events: false,
|
prevent_events: false,
|
||||||
silence_frames: 0,
|
silence_frames: 0,
|
||||||
skip_sleep: false,
|
skip_sleep: false,
|
||||||
sleeper: Default::default(),
|
|
||||||
soft_clip,
|
soft_clip,
|
||||||
tracks,
|
tracks,
|
||||||
ws: None,
|
ws: None,
|
||||||
@@ -402,9 +399,7 @@ impl Mixer {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: make choice of spin-sleep/imprecise sleep optional in next breaking.
|
std::thread::sleep(self.deadline.saturating_duration_since(Instant::now()));
|
||||||
self.sleeper
|
|
||||||
.sleep(self.deadline.saturating_duration_since(Instant::now()));
|
|
||||||
self.deadline += TIMESTEP_LENGTH;
|
self.deadline += TIMESTEP_LENGTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user