forge
Explore
Log in

Don't you dare go Hollow

S12: mjpeg reads the container video params in one match (same values, one pass)

Browse files at this commit

a9547b5a9aa6b272a083432623afdd826a25d8caAhmet Kaan GümüşParent: 4fd4ed4
crates/ec-mjpeg/src/lib.rsmodified+3 -7
@@ -81,13 +81,9 @@ impl MjpegDecoder {
81 81
82 /// Decode one packet to one frame.82 /// Decode one packet to one frame.
83 pub fn decode(&mut self, data: &[u8], pts: Option<Timestamp>) -> Result<VideoFrame> {83 pub fn decode(&mut self, data: &[u8], pts: Option<Timestamp>) -> Result<VideoFrame> {
84- let container_height = match &self.params.media {84+ let (container_height, container_color) = match &self.params.media {
85- MediaParameters::Video(v) => v.height,85+ MediaParameters::Video(v) => (v.height, v.color),
86- _ => 0,86+ _ => (0, ColorInfo::default()),
87- };
88- let container_color = match &self.params.media {
89- MediaParameters::Video(v) => v.color,
90- _ => ColorInfo::default(),
91 };87 };
92 let mut frame = decode_frame(data, container_height, self.field_order, self.limits)?;88 let mut frame = decode_frame(data, container_height, self.field_order, self.limits)?;
93 frame.pts = pts;89 frame.pts = pts;