diff --git a/crates/store/re_types/src/archetypes/asset_video_ext.rs b/crates/store/re_types/src/archetypes/asset_video_ext.rs index 144cd7d6b341..9d1e0d73202b 100644 --- a/crates/store/re_types/src/archetypes/asset_video_ext.rs +++ b/crates/store/re_types/src/archetypes/asset_video_ext.rs @@ -44,6 +44,8 @@ impl AssetVideo { /// Returned timestamps are in nanoseconds since start and are guaranteed to be monotonically increasing. #[cfg(feature = "video")] pub fn read_frame_timestamps_ns(&self) -> Result, re_video::VideoLoadError> { + re_tracing::profile_function!(); + let Some(media_type) = self .media_type .clone() diff --git a/crates/store/re_video/src/decode/ffmpeg_h264/ffmpeg.rs b/crates/store/re_video/src/decode/ffmpeg_h264/ffmpeg.rs index 00e3641af674..eb623ab048c5 100644 --- a/crates/store/re_video/src/decode/ffmpeg_h264/ffmpeg.rs +++ b/crates/store/re_video/src/decode/ffmpeg_h264/ffmpeg.rs @@ -448,6 +448,8 @@ fn write_ffmpeg_input( .concat(); write_bytes(ffmpeg_stdin, &end_nals).ok(); + // NOTE(emilk): I've also tried writing `NalUnitType::AccessUnitDelimiter` here, but to no avail. + ffmpeg_stdin.flush().ok(); break; @@ -1011,8 +1013,7 @@ fn should_ignore_log_msg(msg: &str) -> bool { // Size etc. *is* specified in SPS & PPS, unclear why it's missing that. // Observed on Windows FFmpeg 7.1, but not with the same version on Mac with the same video. "Could not find codec parameters for stream 0 (Video: h264, none): unspecified size", - // We sometimes get a `[NULL @ 0x14f107150]`, which is not very actionable - "[NULL @ ", + // NOTE: We sometimes get a `[NULL @ 0x14f107150]`, which is not very actionable, but may be useful for debugging. ]; // Why would we get an empty message? Observed on Windows FFmpeg 7.1. diff --git a/crates/store/re_video/src/decode/ffmpeg_h264/sps.rs b/crates/store/re_video/src/decode/ffmpeg_h264/sps.rs index 2500a1494839..0f7f0ee5bb30 100644 --- a/crates/store/re_video/src/decode/ffmpeg_h264/sps.rs +++ b/crates/store/re_video/src/decode/ffmpeg_h264/sps.rs @@ -1,3 +1,5 @@ +//! TODO(emilk): replace this whole file with + use crate::decode::YuvPixelLayout; use super::nalu::{NalHeader, NalUnitType}; diff --git a/crates/viewer/re_renderer/src/video/player.rs b/crates/viewer/re_renderer/src/video/player.rs index 8e2d63575973..1c5d1c22842a 100644 --- a/crates/viewer/re_renderer/src/video/player.rs +++ b/crates/viewer/re_renderer/src/video/player.rs @@ -132,7 +132,8 @@ impl VideoPlayer { let presentation_timestamp = presentation_timestamp.min(self.data.duration); // Don't seek past the end of the video. let error_on_last_frame_at = self.last_error.is_some(); - self.frame_at_internal(render_ctx, presentation_timestamp, video_data)?; + self.enqueue_samples(presentation_timestamp, video_data)?; + self.update_video_texture(render_ctx, presentation_timestamp)?; let frame_info = self.video_texture.frame_info.clone(); @@ -181,9 +182,8 @@ impl VideoPlayer { } } - fn frame_at_internal( + fn enqueue_samples( &mut self, - render_ctx: &RenderContext, presentation_timestamp: Time, video_data: &[u8], ) -> Result<(), VideoPlayerError> { @@ -279,6 +279,14 @@ impl VideoPlayer { self.current_gop_idx = requested_gop_idx; self.current_sample_idx = requested_sample_idx; + Ok(()) + } + + fn update_video_texture( + &mut self, + render_ctx: &RenderContext, + presentation_timestamp: Time, + ) -> Result<(), VideoPlayerError> { let result = self.chunk_decoder.update_video_texture( render_ctx, &mut self.video_texture,