+ goto end;
+ }
+ *_ts_begin = ts_begin;
+ *_ts_end = ts_end;
+end:
+ return ret;
+}
+
+int ctf_tc_set_stream_intersection_mode(struct bt_context *ctx)
+{
+ int ret = 0, i;
+
+ if (!ctx || !ctx->tc || !ctx->tc->array) {
+ ret = -EINVAL;
+ goto end;
+ }
+
+ for (i = 0; i < ctx->tc->array->len; i++) {
+ struct bt_trace_descriptor *td_read;
+ struct packet_index_time intersection_real;
+
+ td_read = g_ptr_array_index(ctx->tc->array, i);
+ if (!td_read) {
+ continue;
+ }
+
+ ret = ctf_find_stream_intersection(td_read, &intersection_real,
+ NULL);
+ if (ret == 1) {
+ /* Empty trace or no stream intersection. */
+ continue;
+ } else if (ret < 0) {
+ goto end;
+ }
+
+ td_read->interval_real = intersection_real;
+ td_read->interval_set = true;