lib: make discarded events/packets support and clock snapshots optional
[babeltrace.git] / plugins / utils / trimmer / trimmer.c
index db5b65b3215518ecf8de9920f1be21a48c51bdb0..0a5557e4002837ac47f5ff1bbb186ac619e7d4b9 100644 (file)
@@ -1734,7 +1734,8 @@ bt_self_message_iterator_status handle_message(
                        }
 
                        /*
-                        * Temporary: make sure packet beginning and end
+                        * Temporary: make sure packet beginning, packet
+                        * end, discarded events, and discarded packets
                         * messages have default clock snapshots until
                         * the support for not having them is
                         * implemented.
@@ -1765,6 +1766,32 @@ bt_self_message_iterator_status handle_message(
                                goto end;
                        }
 
+                       if (bt_stream_class_supports_discarded_events(sc) &&
+                                       !bt_stream_class_discarded_events_have_default_clock_snapshots(sc)) {
+                               BT_LOGE("Unsupported stream: discarded events "
+                                       "have no clock snapshots: "
+                                       "stream-addr=%p, "
+                                       "stream-id=%" PRIu64 ", "
+                                       "stream-name=\"%s\"",
+                                       stream, bt_stream_get_id(stream),
+                                       bt_stream_get_name(stream));
+                               status = BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
+                               goto end;
+                       }
+
+                       if (bt_stream_class_supports_discarded_packets(sc) &&
+                                       !bt_stream_class_discarded_packets_have_default_clock_snapshots(sc)) {
+                               BT_LOGE("Unsupported stream: discarded packets "
+                                       "have no clock snapshots: "
+                                       "stream-addr=%p, "
+                                       "stream-id=%" PRIu64 ", "
+                                       "stream-name=\"%s\"",
+                                       stream, bt_stream_get_id(stream),
+                                       bt_stream_get_name(stream));
+                               status = BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
+                               goto end;
+                       }
+
                        sstate = g_new0(struct trimmer_iterator_stream_state,
                                1);
                        if (!sstate) {
This page took 0.025127 seconds and 4 git commands to generate.