diff --git a/crates/muninn-daemon/src/main.rs b/crates/muninn-daemon/src/main.rs index 6263f07..7857ad3 100644 --- a/crates/muninn-daemon/src/main.rs +++ b/crates/muninn-daemon/src/main.rs @@ -1827,7 +1827,14 @@ fn reconcile_move_identity_records( ) -> Result<()> { publish_move_identity_records(node, options, sources)?; publish_bluetooth_move_identity_records(node, options, active)?; + prune_stale_move_identity_records(node, options, sources) +} +fn prune_stale_move_identity_records( + node: &mut cultmesh_rs::CultMeshNode, + options: &Options, + sources: &[MoveStateSource], +) -> Result<()> { let current_ids = current_move_identity_records_from_sources(options, sources)? .into_iter() .map(|identity| identity.identity_id) @@ -14325,7 +14332,8 @@ Device 00:07:04:A8:00:D0 (public) hidraw_path: "windows-psmove://current".to_string(), }]; - reconcile_move_identity_records(&mut node, &options, ¤t, &[]).unwrap(); + publish_move_identity_records(&mut node, &options, ¤t).unwrap(); + prune_stale_move_identity_records(&mut node, &options, ¤t).unwrap(); assert!( node.get::("starfire:move-0006f523e2d1:move-identity") diff --git a/crates/muninn-daemon/src/media_packetizer.rs b/crates/muninn-daemon/src/media_packetizer.rs index 9fe62c5..d814944 100644 --- a/crates/muninn-daemon/src/media_packetizer.rs +++ b/crates/muninn-daemon/src/media_packetizer.rs @@ -688,31 +688,15 @@ pub fn build_video_parity_shards( } fn video_wire_records_with_parity( - records: &[GameCultMediaVideoAccessUnitRecord], + frame_records: &[GameCultMediaVideoAccessUnitRecord], ) -> Result> { - let mut wire_records = Vec::new(); - let mut offset = 0_usize; - while offset < records.len() { - let first = &records[offset]; - let mut end = offset + 1; - while end < records.len() - && records[end].stream_id == first.stream_id - && records[end].session_id == first.session_id - && records[end].frame_id == first.frame_id - { - end += 1; - } - let frame_records = &records[offset..end]; - wire_records.extend( - frame_records - .iter() - .cloned() - .map(GameCultMediaWireRecord::Video), - ); - for parity in build_video_parity_shards(frame_records)? { - wire_records.push(GameCultMediaWireRecord::VideoParity(parity)); - } - offset = end; + let mut wire_records: Vec = frame_records + .iter() + .cloned() + .map(GameCultMediaWireRecord::Video) + .collect(); + for parity in build_video_parity_shards(frame_records)? { + wire_records.push(GameCultMediaWireRecord::VideoParity(parity)); } Ok(wire_records) }