mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2025-02-22 07:36:20 +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];
|
let af = &af[..length];
|
||||||
reader.skip(8 * length as u32).context("af")?;
|
reader.skip(8 * length as u32).context("af")?;
|
||||||
|
|
||||||
// Parse adaption field and update PCR if it's the PID of our selected program
|
// Zero-byte adaption field is valid and can be just skipped over.
|
||||||
if self.pmt.as_ref().map(|pmt| pmt.pcr_pid) == Some(header.pid) {
|
if !af.is_empty() {
|
||||||
let mut af_reader = BitReader::endian(af, BigEndian);
|
// Parse adaption field and update PCR if it's the PID of our selected program
|
||||||
let adaptation_field = af_reader.parse::<AdaptionField>().context("af")?;
|
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
|
// PCR present
|
||||||
if let Some(pcr) = adaptation_field.pcr {
|
if let Some(pcr) = adaptation_field.pcr {
|
||||||
if let Some(monotonic_time) = monotonic_time {
|
if let Some(monotonic_time) = monotonic_time {
|
||||||
self.store_observation(imp, pcr, monotonic_time);
|
self.store_observation(imp, pcr, monotonic_time);
|
||||||
} else {
|
} else {
|
||||||
gst::warning!(
|
gst::warning!(
|
||||||
CAT,
|
CAT,
|
||||||
imp = imp,
|
imp = imp,
|
||||||
"Can't handle PCR without packet capture time"
|
"Can't handle PCR without packet capture time"
|
||||||
);
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue