Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rerun rrd compact: always put blueprints at the start of the recordings #6998

Merged
merged 1 commit into from
Jul 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 23 additions & 7 deletions crates/top/rerun/src/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use itertools::{izip, Itertools};

use re_data_source::DataSource;
use re_log_types::{LogMsg, SetStoreInfo};
use re_sdk::log::Chunk;
use re_sdk::{log::Chunk, StoreKind};
use re_smart_channel::{ReceiveSet, Receiver, SmartMessagePayload};

#[cfg(feature = "web_viewer")]
Expand Down Expand Up @@ -661,16 +661,32 @@ fn run_compact(path_to_input_rrd: &Path, path_to_output_rrd: &Path) -> anyhow::R
let mut rrd_out = std::fs::File::create(path_to_output_rrd)
.with_context(|| format!("{path_to_output_rrd:?}"))?;

let messages: Result<Vec<Vec<LogMsg>>, _> = entity_dbs
.into_values()
let messages_rbl: Result<Vec<Vec<LogMsg>>, _> = entity_dbs
.values()
.filter(|entity_db| entity_db.store_kind() == StoreKind::Blueprint)
.map(|entity_db| entity_db.to_messages(None /* time selection */))
.collect();
let messages = messages?;
let messages = messages.iter().flatten();
let messages_rbl = messages_rbl?;
let messages_rbl = messages_rbl.iter().flatten();

let messages_rrd: Result<Vec<Vec<LogMsg>>, _> = entity_dbs
.values()
.filter(|entity_db| entity_db.store_kind() == StoreKind::Recording)
.map(|entity_db| entity_db.to_messages(None /* time selection */))
.collect();
let messages_rrd = messages_rrd?;
let messages_rrd = messages_rrd.iter().flatten();

let encoding_options = re_log_encoding::EncodingOptions::COMPRESSED;
re_log_encoding::encoder::encode(version, encoding_options, messages, &mut rrd_out)
.context("Message encode")?;
re_log_encoding::encoder::encode(
version,
encoding_options,
// NOTE: We want to make sure all blueprints come first, so that the viewer can immediately
// set up the viewport correctly.
messages_rbl.chain(messages_rrd),
&mut rrd_out,
)
.context("Message encode")?;

let rrd_out_size = rrd_out.metadata().ok().map(|md| md.len());

Expand Down
Loading