goto end;
}
- empty_packet = (stream->events->len == 0);
- ret = bt_ctf_field_validate(stream->packet_header);
- if (ret) {
+ if (!stream->packet_context && stream->flushed_packet_count > 0) {
+ /*
+ * A stream without a packet context, and thus without
+ * content and packet size members, can't have more than
+ * one packet.
+ */
+ ret = -1;
goto end;
}
+ empty_packet = (stream->events->len == 0);
+
/* mmap the next packet */
ctf_packet_seek(&stream->pos.parent, 0, SEEK_CUR);