- BT_ASSERT_PRE((with_cs && stream_class->default_clock_class) ||
- (!with_cs && !stream_class->default_clock_class),
- "Creating a message with a default clock snapshot, but without "
- "a default clock class, or without a default clock snapshot, "
- "but with a default clock class: ",
+
+ if (type == BT_MESSAGE_TYPE_DISCARDED_EVENTS) {
+ has_support = stream_class->supports_discarded_events;
+ has_default_clock_snapshots =
+ stream_class->discarded_events_have_default_clock_snapshots;
+ } else {
+ has_support = stream_class->supports_discarded_packets;
+ has_default_clock_snapshots =
+ stream_class->discarded_packets_have_default_clock_snapshots;
+ }
+
+ BT_ASSERT_PRE(has_support,
+ "Stream class does not support discarded events or packets: "
+ "type=%s, %![stream-]+s, %![sc-]+S",
+ bt_message_type_string(type), stream, stream_class);
+ BT_ASSERT_PRE((with_cs && has_default_clock_snapshots) ||
+ (!with_cs && !has_default_clock_snapshots),
+ "Unexpected stream class configuration when creating "
+ "a discarded events or packets message: "