mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2025-02-16 21:05:15 +00:00
mpegtslivesrc: Set DISCONT flag on buffers at PCR discontinuities
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1767>
This commit is contained in:
parent
8fd2b7daa4
commit
453b3014e6
1 changed files with 6 additions and 15 deletions
|
@ -319,11 +319,8 @@ impl MpegTsLiveSource {
|
||||||
(monotonic_time, get_pcr_from_buffer(self, &buffer))
|
(monotonic_time, get_pcr_from_buffer(self, &buffer))
|
||||||
{
|
{
|
||||||
if state.store_observation(raw_pcr, monotonic_time) {
|
if state.store_observation(raw_pcr, monotonic_time) {
|
||||||
// FIXME: Handle PCR discontinuities more gracefully. This requires replacing the
|
let buffer = buffer.make_mut();
|
||||||
// clock and making sure that the application selects the new clock, and making
|
buffer.set_flags(gst::BufferFlags::DISCONT);
|
||||||
// sure that tsdemux detects it correctly too.
|
|
||||||
gst::element_imp_error!(self, gst::StreamError::Format, ["PCR discontinuity"]);
|
|
||||||
return Err(gst::FlowError::Error);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -353,7 +350,6 @@ impl MpegTsLiveSource {
|
||||||
|
|
||||||
// The last monotonic time
|
// The last monotonic time
|
||||||
let mut monotonic_time = None;
|
let mut monotonic_time = None;
|
||||||
let mut discont = false;
|
|
||||||
|
|
||||||
bufferlist.make_mut().foreach_mut(|mut buffer, _idx| {
|
bufferlist.make_mut().foreach_mut(|mut buffer, _idx| {
|
||||||
let this_buffer_timestamp = buffer.dts_or_pts();
|
let this_buffer_timestamp = buffer.dts_or_pts();
|
||||||
|
@ -369,7 +365,10 @@ impl MpegTsLiveSource {
|
||||||
if let (Some(monotonic_time), Some(raw_pcr)) =
|
if let (Some(monotonic_time), Some(raw_pcr)) =
|
||||||
(monotonic_time, get_pcr_from_buffer(self, &buffer))
|
(monotonic_time, get_pcr_from_buffer(self, &buffer))
|
||||||
{
|
{
|
||||||
discont = state.store_observation(raw_pcr, monotonic_time);
|
if state.store_observation(raw_pcr, monotonic_time) {
|
||||||
|
let buffer = buffer.make_mut();
|
||||||
|
buffer.set_flags(gst::BufferFlags::DISCONT);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Update buffer timestamp if present
|
// Update buffer timestamp if present
|
||||||
|
@ -387,14 +386,6 @@ impl MpegTsLiveSource {
|
||||||
ControlFlow::Continue(Some(buffer))
|
ControlFlow::Continue(Some(buffer))
|
||||||
});
|
});
|
||||||
|
|
||||||
if discont {
|
|
||||||
// FIXME: Handle PCR discontinuities more gracefully. This requires replacing the
|
|
||||||
// clock and making sure that the application selects the new clock, and making
|
|
||||||
// sure that tsdemux detects it correctly too.
|
|
||||||
gst::element_imp_error!(self, gst::StreamError::Format, ["PCR discontinuity"]);
|
|
||||||
return Err(gst::FlowError::Error);
|
|
||||||
}
|
|
||||||
|
|
||||||
gst::ProxyPad::chain_list_default(pad, Some(&*self.obj()), bufferlist)
|
gst::ProxyPad::chain_list_default(pad, Some(&*self.obj()), bufferlist)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue