Skip to content
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
9 changes: 9 additions & 0 deletions web-codecs/src/video/frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ use derive_more::From;

use crate::Timestamp;

use super::Dimensions;

#[derive(Debug, From)]
pub struct VideoFrame(web_sys::VideoFrame);

Expand All @@ -18,6 +20,13 @@ impl VideoFrame {
pub fn duration(&self) -> Option<Duration> {
Some(Duration::from_micros(self.0.duration()? as _))
}

pub fn dimensions(&self) -> Dimensions {
Dimensions {
width: self.0.coded_width(),
height: self.0.coded_height(),
}
}
}

// Avoid closing the video frame on transfer by cloning it.
Expand Down
Loading