Skip to content

Commit

Permalink
Fix mixup of composition & decode timestamp, causing video stuttering…
Browse files Browse the repository at this point in the history
… for videos with bframes (rerun-io#7806)

### What

This regressed during a recent refactor.
Renamed chunk.timestamp and document it to avoid future blunders. Todo
for later: always call it composition timestamp.

### Checklist
* [x] I have read and agree to [Contributor
Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and
the [Code of
Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)
* [x] I've included a screenshot or gif (if applicable)
* [x] I have tested the web demo (if applicable):
* Using examples from latest `main` build:
[rerun.io/viewer](https://rerun.io/viewer/pr/7806?manifest_url=https://app.rerun.io/version/main/examples_manifest.json)
* Using full set of examples from `nightly` build:
[rerun.io/viewer](https://rerun.io/viewer/pr/7806?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json)
* [x] The PR title and labels are set such as to maximize their
usefulness for the next release's CHANGELOG
* [x] If applicable, add a new check to the [release
checklist](https://github.com/rerun-io/rerun/blob/main/tests/python/release_checklist)!
* [x] If have noted any breaking changes to the log API in
`CHANGELOG.md` and the migration guide

- [PR Build Summary](https://build.rerun.io/pr/7806)
- [Recent benchmark results](https://build.rerun.io/graphs/crates.html)
- [Wasm size tracking](https://build.rerun.io/graphs/sizes.html)

To run all checks from `main`, comment on the PR with `@rerun-bot
full-check`.
  • Loading branch information
Wumpf authored Oct 17, 2024
1 parent 594bbd4 commit 8b8ee81
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
7 changes: 5 additions & 2 deletions crates/store/re_video/src/decode/av1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,16 @@ impl SyncDav1dDecoder {

fn submit_chunk(&mut self, chunk: Chunk, on_output: &OutputCallback) {
re_tracing::profile_function!();
econtext::econtext_function_data!(format!("chunk timestamp: {:?}", chunk.timestamp));
econtext::econtext_function_data!(format!(
"chunk timestamp: {:?}",
chunk.composition_timestamp
));

re_tracing::profile_scope!("send_data");
match self.decoder.send_data(
chunk.data,
None,
Some(chunk.timestamp.0),
Some(chunk.composition_timestamp.0),
Some(chunk.duration.0),
) {
Ok(()) => {}
Expand Down
6 changes: 5 additions & 1 deletion crates/store/re_video/src/decode/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,11 @@ pub struct Chunk {
pub is_sync: bool,

pub data: Vec<u8>,
pub timestamp: Time,

/// Presentation/composition timestamp for the sample in this chunk.
/// *not* decode timestamp.
pub composition_timestamp: Time,

pub duration: Time,
}

Expand Down
2 changes: 1 addition & 1 deletion crates/store/re_video/src/demux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ impl VideoData {

Some(Chunk {
data: data.to_vec(),
timestamp: sample.decode_timestamp,
composition_timestamp: sample.composition_timestamp,
duration: sample.duration,
is_sync: sample.is_sync,
})
Expand Down
4 changes: 3 additions & 1 deletion crates/viewer/re_renderer/src/video/decoder/web.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,9 @@ impl VideoChunkDecoder for WebVideoDecoder {
};
let web_chunk = EncodedVideoChunkInit::new(
&data,
video_chunk.timestamp.into_micros(self.data.timescale),
video_chunk
.composition_timestamp
.into_micros(self.data.timescale),
type_,
);
web_chunk.set_duration(video_chunk.duration.into_micros(self.data.timescale));
Expand Down

0 comments on commit 8b8ee81

Please sign in to comment.