Fix h265 aggregation packet issue

This commit is contained in:
Andrey Tkachenko 2023-04-26 12:55:31 +04:00
parent d2c1fa003f
commit 8e9c950389
2 changed files with 12 additions and 24 deletions

16
Cargo.lock generated
View File

@ -3094,19 +3094,3 @@ dependencies = [
"syn", "syn",
"synstructure", "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"

View File

@ -292,17 +292,21 @@ impl AccessUnit {
fn finish(self, dst: &mut VecDeque<VideoFrame>, ctx: crate::PacketContext, loss: u32) { fn finish(self, dst: &mut VecDeque<VideoFrame>, ctx: crate::PacketContext, loss: u32) {
let mut data = self.data.to_vec(); 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); (&mut data[4..6]).put_u16(hdr.0);
}
let is_random_access_point = match self.header.unwrap().nalu_type() { matches!(
H265NALU_BLA_W_LP | H265NALU_BLA_W_RADL | H265NALU_BLA_N_LP | H265NALU_IDR_W_RADL hdr.nalu_type(),
| H265NALU_IDR_N_LP | H265NALU_CRA_NUT => true, H265NALU_BLA_W_LP
_ => false, | 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 { dst.push_back(VideoFrame {