Better-adapt extend_timespan to its real use, observe_simpleblock_timecode
This commit is contained in:
parent
0aa2f1cbdd
commit
9c9db1c505
2 changed files with 5 additions and 4 deletions
|
@ -92,7 +92,7 @@ fn create_loop() -> WebmServer {
|
|||
// TODO: this is incorrect, condition needs to also affirm we're the first video block of the cluster
|
||||
chunk.mark_keyframe(true);
|
||||
}
|
||||
chunk.extend_timespan(cluster_timecode + (block.timecode as u64));
|
||||
chunk.observe_simpleblock_timecode(block.timecode);
|
||||
}
|
||||
encode_webm_element(&SimpleBlock(*block), &mut buffer).unwrap();
|
||||
},
|
||||
|
|
|
@ -47,10 +47,11 @@ impl<B: AsRef<[u8]>> Chunk<B> {
|
|||
*bytes_used = cursor.position() as u8;
|
||||
}
|
||||
}
|
||||
pub fn extend_timespan(&mut self, timecode: u64) {
|
||||
pub fn observe_simpleblock_timecode(&mut self, timecode: i16) {
|
||||
if let &mut Chunk::ClusterHead {start, ref mut end, ..} = self {
|
||||
if timecode > start {
|
||||
*end = timecode;
|
||||
let absolute_timecode = start + (timecode as u64);
|
||||
if absolute_timecode > start {
|
||||
*end = absolute_timecode;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue