Skip to content

Commit

Permalink
NalUnitIter
Browse files Browse the repository at this point in the history
  • Loading branch information
Curid committed Nov 18, 2023
1 parent 7126ba0 commit 8a05e77
Show file tree
Hide file tree
Showing 2 changed files with 147 additions and 240 deletions.
13 changes: 8 additions & 5 deletions src/codec/h264.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub mod dts_extractor;

use super::VideoFrame;
use crate::{
codec::h264::dts_extractor::{DtsExtractor, Temp},
codec::h264::dts_extractor::{DtsExtractor, NalUnitIter},
rtp::{ReceivedPacket, ReceivedPacketBuilder},
Error, Timestamp, VideoTimestamp,
};
Expand Down Expand Up @@ -47,7 +47,7 @@ pub(crate) struct Depacketizer {
}

#[derive(Debug)]
pub(crate) struct Nal {
struct Nal {
hdr: h264_reader::nal::NalHeader,

/// The length of `Depacketizer::pieces` as this NAL finishes.
Expand Down Expand Up @@ -517,8 +517,6 @@ impl Depacketizer {
_ => false,
};

let nalus = Temp::new(&self.nals, &self.pieces);

let mut dts = au.timestamp.timestamp;
if let Some(parameters) = &self.parameters {
// Skip samples silently until we find one with an IDR.
Expand All @@ -530,7 +528,12 @@ impl Depacketizer {
if let Some(dts_extractor) = &mut self.dts_extractor {
let pts = au.timestamp.timestamp();
dts = dts_extractor
.extract(&parameters.sps, is_random_access_point, nalus, pts)
.extract(
&parameters.sps,
is_random_access_point,
NalUnitIter::new(&data),
pts,
)
.map_err(|e| e.to_string())?;
};
}
Expand Down
Loading

0 comments on commit 8a05e77

Please sign in to comment.