-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add dts extractor #61 #81
base: main
Are you sure you want to change the base?
Conversation
First, thank you! I don't own any cameras that produce B frames, so...
and...
I don't really either and need to make another pass through to develop that understanding and compare this technique with gstreamer's |
src/codec/h264/dts_extractor.rs
Outdated
r.read_u32((log2_max_frame_num_minus4 + 4).into(), "frame_num") | ||
.map_err(DtsExtractorError::BitReader)?; | ||
|
||
if let FrameMbsFlags::Fields { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- More specific comment: If
let Enum::VariantA { .. } = Enum::VariantB
is dead code. Looks like the right side here should come from a field in the sps; maybe plumb it through as a parameter? - Broader comment: can we use
h264_reader::nal::slice::SliceHeader
instead of this function's parsing logic? might keep things more readable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SliceHeader::from_bits()
takes SPS and PPS as arguments, I'm not sure parsing PPS in parse_sps_and_pps
and plumbing it in would be more readable.
The gstreamer implementation seems to add latency. I'm not sure if it's just some initial delay like with the MediaMTX implementation but otherwise that's a problem.
|
src/codec/h264/dts_extractor.rs
Outdated
// Allows to extract DTS from PTS. | ||
#[derive(Debug)] | ||
pub struct DtsExtractor { | ||
prev_dts_filled: bool, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More idiomatic to use prev_dts: Option<i64>
rather than the separate field.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh, it seems like extract_inner()
relies on the prev_dts
zero value.
Found an explanation for how this algorithm works: |
Would it be better to first add the dts extractor as separate module that people can use manually before integrating it into the |
This is a rust port of the gortsplib dts extractor. I don't really understand how it works, but my test stream doesn't stutter anymore.
I know you're busy, I don't expect this to be reviewed anytime soon.