"Creating stream {} (ID: {}) out of stream class {}",
lttng_live_stream->name->str, stream_id, stream_class_id);
+ bt_stream *stream;
+
if (stream_id < 0) {
/*
* No stream instance ID in the stream. It's possible
* LTTng. In these cases, use the viewer_stream_id that
* is unique for a live viewer session.
*/
- lttng_live_stream->stream =
+ stream =
bt_stream_create_with_id(stream_class, lttng_live_stream->trace->trace->libObjPtr(),
lttng_live_stream->viewer_stream_id);
} else {
- lttng_live_stream->stream = bt_stream_create_with_id(
+ stream = bt_stream_create_with_id(
stream_class, lttng_live_stream->trace->trace->libObjPtr(), (uint64_t) stream_id);
}
- if (!lttng_live_stream->stream) {
+ if (!stream) {
BT_CPPLOGE_APPEND_CAUSE_SPEC(
lttng_live_stream->logger,
"Cannot create stream {} (stream class ID {}, stream ID {})",
lttng_live_stream->name->str, stream_class_id, stream_id);
- goto end;
+ return nullptr;
}
- bt_stream_set_name(lttng_live_stream->stream, lttng_live_stream->name->str);
+ lttng_live_stream->stream = bt2::Stream::Shared::createWithoutRef(stream);
+ lttng_live_stream->stream->name(lttng_live_stream->name->str);
}
-end:
- return lttng_live_stream->stream;
+ return lttng_live_stream->stream->libObjPtr();
}
static struct ctf_msg_iter_medium_ops medops = {
return;
}
- if (stream_iter->stream) {
- BT_STREAM_PUT_REF_AND_RESET(stream_iter->stream);
- }
-
if (stream_iter->msg_iter) {
ctf_msg_iter_destroy(stream_iter->msg_iter);
}
goto end;
}
- stream_class = bt_stream_borrow_class_const(stream_iter->stream);
+ stream_class = bt_stream_borrow_class_const(stream_iter->stream->libObjPtr());
clock_class = bt_stream_class_borrow_default_clock_class_const(stream_class);
ts_ns_status = bt_clock_class_cycles_to_ns_from_origin(
switch (bt_message_get_type(late_msg)) {
case BT_MESSAGE_TYPE_DISCARDED_EVENTS:
adjust_status = adjust_discarded_events_message(
- lttng_live_msg_iter->self_msg_iter, stream_iter->stream, late_msg, &adjusted_message,
- stream_iter->last_inactivity_ts.value);
+ lttng_live_msg_iter->self_msg_iter, stream_iter->stream->libObjPtr(), late_msg,
+ &adjusted_message, stream_iter->last_inactivity_ts.value);
break;
case BT_MESSAGE_TYPE_DISCARDED_PACKETS:
adjust_status = adjust_discarded_packets_message(
- lttng_live_msg_iter->self_msg_iter, stream_iter->stream, late_msg, &adjusted_message,
- stream_iter->last_inactivity_ts.value);
+ lttng_live_msg_iter->self_msg_iter, stream_iter->stream->libObjPtr(), late_msg,
+ &adjusted_message, stream_iter->last_inactivity_ts.value);
break;
default:
bt_common_abort();