Collapse the video parity wire builder to one frame; test stale-identity pruning without bluetoothctl
video_wire_records_with_parity keeps only its single-frame caller. The stale move-identity prune is split out of reconcile_move_identity_records so its test no longer shells out to the host Bluetooth binary. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
4af6c8fac4
commit
88f9ed7ccd
2 changed files with 17 additions and 25 deletions
|
|
@ -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::<MuninnMoveIdentityRecord>("starfire:move-0006f523e2d1:move-identity")
|
||||
|
|
|
|||
|
|
@ -688,31 +688,15 @@ pub fn build_video_parity_shards(
|
|||
}
|
||||
|
||||
fn video_wire_records_with_parity(
|
||||
records: &[GameCultMediaVideoAccessUnitRecord],
|
||||
frame_records: &[GameCultMediaVideoAccessUnitRecord],
|
||||
) -> Result<Vec<GameCultMediaWireRecord>> {
|
||||
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<GameCultMediaWireRecord> = 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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue