Issue
=====
It is possible that, for a given stream, an `flt.utils.trimmer`
component receives the stream beginning and stream beginnin activity
messages, and then it needs to be ended. In this case,
`sstate->stream_act_end_ns_from_origin` is never set, so we hit the
assertion.
Solution
========
When ending a stream and when `sstate->stream_act_end_ns_from_origin` is
not set for this stream, use the trimming range's end time as the stream
activity end time.
If `sstate->stream_act_end_ns_from_origin` is not set at this point,
then we know the stream is currently active, so it is safe to use a
specific time as its activity end time. If the last received message for
this stream was a stream activity end message, then we don't reach this
code because it's conditional to
`!sstate->last_msg_is_stream_activity_end`.
Known drawbacks
===============
None.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
clock_class = bt_stream_class_borrow_default_clock_class_const(
bt_stream_borrow_class_const(sstate->stream));
BT_ASSERT(clock_class);
clock_class = bt_stream_class_borrow_default_clock_class_const(
bt_stream_borrow_class_const(sstate->stream));
BT_ASSERT(clock_class);
- BT_ASSERT(sstate->stream_act_end_ns_from_origin != INT64_MIN);
+
+ if (sstate->stream_act_end_ns_from_origin == INT64_MIN) {
+ /*
+ * We received at least what is necessary to
+ * have a stream state (stream beginning and
+ * stream activity beginning messages), but
+ * nothing else: use the trimmer range's end
+ * time.
+ */
+ sstate->stream_act_end_ns_from_origin =
+ trimmer_it->end.ns_from_origin;
+ }
+
ret = clock_raw_value_from_ns_from_origin(clock_class,
sstate->stream_act_end_ns_from_origin, &raw_value);
if (ret) {
ret = clock_raw_value_from_ns_from_origin(clock_class,
sstate->stream_act_end_ns_from_origin, &raw_value);
if (ret) {