mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-11-15 14:52:04 +00:00
togglerecord: Error out if main stream buffer has no valid running time
We cannot continue with this buffer, because we cannot calculate the time when the recording stopped or started. We also cannot safely drop it, because that might break the stream, especially if it's encoded. Therefore, we return an element error. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1266>
This commit is contained in:
parent
0c3def8b9e
commit
8f19a01fdd
1 changed files with 11 additions and 3 deletions
|
@ -366,6 +366,17 @@ impl ToggleRecord {
|
|||
|
||||
let current_running_time = state.in_segment.to_running_time(dts_or_pts);
|
||||
let current_running_time_end = state.in_segment.to_running_time(dts_or_pts_end);
|
||||
let (current_running_time, current_running_time_end) = state
|
||||
.in_segment
|
||||
.clip(current_running_time, current_running_time_end)
|
||||
.ok_or_else(|| {
|
||||
gst::element_imp_error!(
|
||||
self,
|
||||
gst::StreamError::Format,
|
||||
["Received a buffer in the main stream without a valid running time"]
|
||||
);
|
||||
gst::FlowError::Error
|
||||
})?;
|
||||
|
||||
state.current_running_time = current_running_time
|
||||
.opt_max(state.current_running_time)
|
||||
|
@ -374,9 +385,6 @@ impl ToggleRecord {
|
|||
.opt_max(state.current_running_time_end)
|
||||
.or(current_running_time_end);
|
||||
|
||||
// FIXME we should probably return if either current_running_time or current_running_time_end
|
||||
// are None at this point
|
||||
|
||||
// Wake up everybody, we advanced a bit
|
||||
// Important: They will only be able to advance once we're done with this
|
||||
// function or waiting for them to catch up below, otherwise they might
|
||||
|
|
Loading…
Reference in a new issue