diff --git a/Cargo.lock b/Cargo.lock index ff3b2a1..803ab87 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3094,19 +3094,3 @@ dependencies = [ "syn", "synstructure", ] - -[[patch.unused]] -name = "messagebus" -version = "0.10.0" - -[[patch.unused]] -name = "mpeg2ts" -version = "0.1.1" - -[[patch.unused]] -name = "metrix" -version = "0.2.1" - -[[patch.unused]] -name = "metrix-macros" -version = "0.2.1" diff --git a/src/codec/h265.rs b/src/codec/h265.rs index 180cfcd..5ff5edb 100644 --- a/src/codec/h265.rs +++ b/src/codec/h265.rs @@ -292,17 +292,21 @@ impl AccessUnit { fn finish(self, dst: &mut VecDeque, ctx: crate::PacketContext, loss: u32) { let mut data = self.data.to_vec(); - // let length = data.len() as u32 - 4; - // data[0..4].copy_from_slice(); - if let Some(hdr) = self.header { + let is_random_access_point = if let Some(hdr) = self.header { (&mut data[4..6]).put_u16(hdr.0); - } - let is_random_access_point = match self.header.unwrap().nalu_type() { - H265NALU_BLA_W_LP | H265NALU_BLA_W_RADL | H265NALU_BLA_N_LP | H265NALU_IDR_W_RADL - | H265NALU_IDR_N_LP | H265NALU_CRA_NUT => true, - _ => false, + matches!( + hdr.nalu_type(), + H265NALU_BLA_W_LP + | H265NALU_BLA_W_RADL + | H265NALU_BLA_N_LP + | H265NALU_IDR_W_RADL + | H265NALU_IDR_N_LP + | H265NALU_CRA_NUT + ) + } else { + false }; dst.push_back(VideoFrame {