Writer: validating the packet header is not necessary
[babeltrace.git] / formats / ctf / ir / stream.c
index 979d40e92839fd94f066bad1d8d226e5153e170b..c0b4e979a9ff9195b21e323bc7402110cafe335e 100644 (file)
@@ -884,12 +884,18 @@ int bt_ctf_stream_flush(struct bt_ctf_stream *stream)
                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);
 
This page took 0.022924 seconds and 4 git commands to generate.