- if beg_clock_snapshot is None and end_clock_snapshot is None:
- ptr = native_bt.message_discarded_packets_create(self._ptr, stream._ptr)
- elif beg_clock_snapshot is not None and end_clock_snapshot is not None:
+ if not stream.stream_class.supports_discarded_packets:
+ raise ValueError('stream class does not support discarded packets')
+
+ if stream.stream_class.discarded_packets_have_default_clock_snapshots:
+ if beg_clock_snapshot is None or end_clock_snapshot is None:
+ raise ValueError('discarded packets have default clock snapshots for this stream class')
+