improve seek algorithmic complexity O(n) -> O(log(n))
This commit is contained in:
@@ -53,16 +53,16 @@ impl<'a> PlayerWorker<'a>{
|
||||
Instruction::SessionControl(SessionControlInstruction::SetPaused(paused))=>{
|
||||
self.playback_head.set_paused(ins.time,paused);
|
||||
},
|
||||
Instruction::SessionControl(SessionControlInstruction::Restart)=>{
|
||||
self.playback_head.set_time(ins.time,PlaybackTime::ZERO);
|
||||
Instruction::SessionControl(SessionControlInstruction::Restart)=>if let Some(bot)=&self.bot{
|
||||
self.playback_head.set_time(bot,ins.time,PlaybackTime::ZERO);
|
||||
},
|
||||
Instruction::SessionControl(SessionControlInstruction::SkipForward)=>{
|
||||
Instruction::SessionControl(SessionControlInstruction::SkipForward)=>if let Some(bot)=&self.bot{
|
||||
let head_time=self.playback_head.time(ins.time);
|
||||
self.playback_head.set_time(ins.time,head_time+PlaybackTime::from_secs(2));
|
||||
self.playback_head.set_time(bot,ins.time,head_time+PlaybackTime::from_secs(2));
|
||||
},
|
||||
Instruction::SessionControl(SessionControlInstruction::SkipBack)=>{
|
||||
Instruction::SessionControl(SessionControlInstruction::SkipBack)=>if let Some(bot)=&self.bot{
|
||||
let head_time=self.playback_head.time(ins.time);
|
||||
self.playback_head.set_time(ins.time,head_time-PlaybackTime::from_secs(2));
|
||||
self.playback_head.set_time(bot,ins.time,head_time-PlaybackTime::from_secs(2));
|
||||
},
|
||||
Instruction::SessionControl(SessionControlInstruction::DecreaseTimescale)=>{
|
||||
self.playback_speed=self.playback_speed.saturating_sub(1).max(-27);
|
||||
|
||||
Reference in New Issue
Block a user