Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorVivia Nikolaidou <vivia@ahiru.eu>2023-06-29 17:20:27 +0300
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>2023-06-30 12:20:42 +0300
commit8417efc63039b8f8387157d54522d79e26f47c85 (patch)
tree6c7ae22855d035208f6e4c248d156607f63d4d29 /utils
parentcc26f06289cdb0a36a6d8615d9a2da015ee7e382 (diff)
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/1264>
Diffstat (limited to 'utils')
-rw-r--r--utils/togglerecord/src/togglerecord/imp.rs14
1 files changed, 11 insertions, 3 deletions
diff --git a/utils/togglerecord/src/togglerecord/imp.rs b/utils/togglerecord/src/togglerecord/imp.rs
index 74fdaba0b..ee6fea71d 100644
--- a/utils/togglerecord/src/togglerecord/imp.rs
+++ b/utils/togglerecord/src/togglerecord/imp.rs
@@ -444,6 +444,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)
@@ -452,9 +463,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