-
Notifications
You must be signed in to change notification settings - Fork 610
Video stream changes to support out of order samples #12277
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
base: main
Are you sure you want to change the base?
Conversation
|
Web viewer built successfully.
View image diff on kitdiff. Note: This comment is updated whenever you push a commit. |
3924ef3 to
86b40da
Compare
|
Since our lints are failing because of Or we could consider moving re_video out of util. Resolved by using tuid instead of chunk id |
Wumpf
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed everything except video_stream_cache.rs changes and feel like I need a break atm. Maybe also better if you talk me through that one.
We should now also be able to remove the chunk store hack for not compacting video stream, right? Grep for RR-3212 to see what I mean.
| let end_video_time = re_video::Time::from_secs(end_time, timescale); | ||
|
|
||
| // Find the GOPs that contain our time range | ||
| let start_gop = video |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
below got renamed to end_keyframe. This is inconsistent now. should rename this as well
| let first_frame_pts = video_descr | ||
| .samples | ||
| .front() | ||
| .and_then(|s| s.sample()) | ||
| .map_or(Time::ZERO, |s| s.presentation_timestamp); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not having a first_frame_pts is fine most of the time but may cause issues. We may want to come up with a different strategy of obtaining that offset 🤔
See large comment block in submit_chunk below why we need it in the first place
| 0 => std::time::Duration::ZERO, | ||
| 1 => { | ||
| let first = self.samples.front()?; | ||
| let first = self.samples.iter().find_map(|s| s.sample())?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
method documentation should point out how we handle absent samples and gaps in sample ranges
| .iter_index_range_clamped(&seg.sample_range) | ||
| .map(|(_idx, sample)| sample.presentation_timestamp) | ||
| .iter() | ||
| .filter_map(|sample| Some(sample.sample()?.presentation_timestamp)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doc string should be updated to mention that reserved-only samples are simply ignored
| .get(*p) | ||
| .map(|s| s.sample()) | ||
| .inspect(|_s| { | ||
| debug_assert!(_s.is_some(), "Keyframes should always be loaded"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
| debug_assert!(_s.is_some(), "Keyframes should always be loaded"); | |
| debug_assert!(_s.is_some(), "Keyframes mentioned in the keyframe lookup list should always be loaded"); |
because otherwise future-me would be confused about what magic is supposed to load all keyframes in existance
| let sample_range = video_description.keyframe_indices[keyframe_idx] | ||
| ..video_description | ||
| .keyframe_indices | ||
| .get(keyframe_idx + 1) | ||
| .copied() | ||
| .unwrap_or_else(|| video_description.samples.next_index()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this "give me the GOP range starting at keyframe_idx X" happens quite a bit, worth considering having a utility for that if only to name the thing we're doing here
| /// The raw buffer this sample is in. | ||
| pub buffer: arrow::buffer::Buffer, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know why we arrived at this, but I don't particularly like having arrow buffer here:
- it increases the ref count for that arrow buffer a lot
- it drags in libarrow dependency, until now re_video didn't need any arrow at all to do its work
- arrow buffer under the hood is already a byte span into a ref counted buffer, that makes the
byte_spanbelow kinda pointless. I.e. if we're using arrow buffers here we might as well only use arrow buffers
It also means that SampleMetadata is no longer really metadata but really forms the actual sample, which is what distinguished it previously from Chunk which had a copy of the data for transfer to the decoder. I figure at that point we might as well rename it to Sample then.
... so either we check again whether we can not depend on arrow here, keeping stable buffer indices around, or we go all in and drop byte_span, rename the thing and at a later point maybe even remove Chunk
| let Some(sample) = sample.sample() else { | ||
| continue; | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we distinguish unloaded here and immediately treat things as live stream if we encounter unloaded samples?
| } | ||
| } | ||
|
|
||
| struct VideoData { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is this struct and why is it needed? Name doesn't really tell me what it is used for
| struct VideoStreamCacheEntry { | ||
| used_this_frame: AtomicBool, | ||
| video_stream: Arc<RwLock<PlayableVideoStream>>, | ||
| known_chunk_offsets: BTreeMap<ChunkId, ChunkSamples>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't this more like chunk sample ranges?
Related
TODO: Maybe more video related issues?
What
Support out of order samples for video streams.
Implementation details