Skip to content

Commit ec77897

Browse files
committed
Better error message in re_video
1 parent b1561fc commit ec77897

File tree

1 file changed

+8
-1
lines changed
  • crates/utils/re_video/src/demux

1 file changed

+8
-1
lines changed

crates/utils/re_video/src/demux/mod.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,10 @@ impl VideoDataDescription {
465465
media_type: &str,
466466
debug_name: &str,
467467
) -> Result<Self, VideoLoadError> {
468+
if data.is_empty() {
469+
return Err(VideoLoadError::ZeroBytes);
470+
}
471+
468472
re_tracing::profile_function!();
469473
match media_type {
470474
"video/mp4" => Self::load_mp4(data, debug_name),
@@ -829,7 +833,10 @@ impl SampleMetadata {
829833
/// Errors that can occur when loading a video.
830834
#[derive(thiserror::Error, Debug)]
831835
pub enum VideoLoadError {
832-
#[error("Failed to determine media type from data: {0}")]
836+
#[error("The video file is empty (zero bytes)")]
837+
ZeroBytes,
838+
839+
#[error("MP4 error: {0}")]
833840
ParseMp4(#[from] re_mp4::Error),
834841

835842
#[error("Video file has no video tracks")]

0 commit comments

Comments
 (0)