mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2025-02-21 07:06:19 +00:00
mpegtslivesrc: Handle zero-byte adaption fields
Simply skip over them instead of handling them as parse error. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2048>
This commit is contained in:
parent
0b0c1cbf50
commit
b70ad7895f
1 changed files with 17 additions and 14 deletions
|
@ -524,21 +524,24 @@ impl State {
|
|||
let af = &af[..length];
|
||||
reader.skip(8 * length as u32).context("af")?;
|
||||
|
||||
// Parse adaption field and update PCR if it's the PID of our selected program
|
||||
if self.pmt.as_ref().map(|pmt| pmt.pcr_pid) == Some(header.pid) {
|
||||
let mut af_reader = BitReader::endian(af, BigEndian);
|
||||
let adaptation_field = af_reader.parse::<AdaptionField>().context("af")?;
|
||||
// Zero-byte adaption field is valid and can be just skipped over.
|
||||
if !af.is_empty() {
|
||||
// Parse adaption field and update PCR if it's the PID of our selected program
|
||||
if self.pmt.as_ref().map(|pmt| pmt.pcr_pid) == Some(header.pid) {
|
||||
let mut af_reader = BitReader::endian(af, BigEndian);
|
||||
let adaptation_field = af_reader.parse::<AdaptionField>().context("af")?;
|
||||
|
||||
// PCR present
|
||||
if let Some(pcr) = adaptation_field.pcr {
|
||||
if let Some(monotonic_time) = monotonic_time {
|
||||
self.store_observation(imp, pcr, monotonic_time);
|
||||
} else {
|
||||
gst::warning!(
|
||||
CAT,
|
||||
imp = imp,
|
||||
"Can't handle PCR without packet capture time"
|
||||
);
|
||||
// PCR present
|
||||
if let Some(pcr) = adaptation_field.pcr {
|
||||
if let Some(monotonic_time) = monotonic_time {
|
||||
self.store_observation(imp, pcr, monotonic_time);
|
||||
} else {
|
||||
gst::warning!(
|
||||
CAT,
|
||||
imp = imp,
|
||||
"Can't handle PCR without packet capture time"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue