/* Current packet (NULL if not created yet) */
struct bt_packet *packet;
+ /* Previous packet availability */
+ enum bt_packet_previous_packet_availability prev_packet_avail;
+
+ /* Previous packet (NULL if not available) */
+ struct bt_packet *prev_packet;
+
/* Current stream (NULL if not set yet) */
struct bt_stream *stream;
/* Current content size (bits) (-1 if unknown) */
int64_t cur_content_size;
- /* Current packet default beginning and end clock values */
- struct clock_value cur_packet_begin_cv;
- struct clock_value cur_packet_end_cv;
-
/*
* Offset, in the underlying media, of the current packet's start
* (-1 if unknown).
/* Create packet */
BT_ASSERT(notit->stream);
- packet = bt_packet_create(notit->stream);
+ packet = bt_packet_create(notit->stream, notit->prev_packet_avail,
+ notit->prev_packet);
if (!packet) {
BT_LOGE("Cannot create packet from stream: "
"notit-addr=%p, stream-addr=%p, "
return val;
}
-static
-void set_current_packet_begin_end(struct bt_notif_iter *notit)
-{
- struct bt_clock_class *clock_class;
- uint64_t val;
-
- if (!notit->dscopes.stream_packet_context) {
- goto end;
- }
-
- val = get_field_raw_clock_value(notit->dscopes.stream_packet_context,
- "timestamp_begin", &clock_class);
- notit->cur_packet_begin_cv.clock_class = clock_class;
- notit->cur_packet_begin_cv.raw_value = val;
- val = get_field_raw_clock_value(notit->dscopes.stream_packet_context,
- "timestamp_end", &clock_class);
- notit->cur_packet_end_cv.clock_class = clock_class;
- notit->cur_packet_end_cv.raw_value = val;
-
-end:
- return;
-}
-
static
enum bt_notif_iter_status set_current_packet_content_sizes(
struct bt_notif_iter *notit)
goto end;
}
- set_current_packet_begin_end(notit);
-
if (notit->stream_begin_emitted) {
notit->state = STATE_EMIT_NOTIF_NEW_PACKET;
} else {
notit->meta.stream_class = NULL;
notit->meta.event_class = NULL;
BT_PUT(notit->packet);
+ notit->prev_packet_avail = BT_PACKET_PREVIOUS_PACKET_AVAILABILITY_NONE;
+ BT_PUT(notit->prev_packet);
BT_PUT(notit->stream);
BT_PUT(notit->event_notif);
release_all_dscopes(notit);
notit->cur_content_size = -1;
notit->cur_packet_size = -1;
notit->cur_packet_offset = -1;
- reset_clock_value(¬it->cur_packet_begin_cv);
- reset_clock_value(¬it->cur_packet_end_cv);
notit->stream_begin_emitted = false;
notit->cur_timestamp_end = NULL;
}
notit->cur_content_size = -1;
notit->cur_packet_size = -1;
- reset_clock_value(¬it->cur_packet_begin_cv);
- reset_clock_value(¬it->cur_packet_end_cv);
notit->cur_sc_field_path_cache = NULL;
end:
notit->dscopes.stream_packet_context);
}
- if (notit->cur_packet_begin_cv.clock_class) {
- ret = bt_packet_set_beginning_clock_value(notit->packet,
- notit->cur_packet_begin_cv.clock_class,
- notit->cur_packet_begin_cv.raw_value, BT_TRUE);
- if (ret) {
- BT_LOGE("Cannot set packet's default beginning clock value: "
- "notit-addr=%p, packet-addr=%p",
- notit, notit->packet);
- goto end;
- }
- }
-
- if (notit->cur_packet_end_cv.clock_class) {
- ret = bt_packet_set_end_clock_value(notit->packet,
- notit->cur_packet_end_cv.clock_class,
- notit->cur_packet_end_cv.raw_value, BT_TRUE);
- if (ret) {
- BT_LOGE("Cannot set packet's default end clock value: "
- "notit-addr=%p, packet-addr=%p",
- notit, notit->packet);
- goto end;
- }
- }
-
BT_ASSERT(notit->notif_iter);
notif = bt_notification_packet_begin_create(notit->notif_iter,
notit->packet);
"notit-addr=%p, packet-addr=%p",
notit, notit->packet);
return;
+
}
- BT_PUT(notit->packet);
+ BT_MOVE(notit->prev_packet, notit->packet);
+ notit->prev_packet_avail =
+ BT_PACKET_PREVIOUS_PACKET_AVAILABILITY_AVAILABLE;
*notification = notif;
}
void bt_notif_iter_destroy(struct bt_notif_iter *notit)
{
BT_PUT(notit->packet);
+ BT_PUT(notit->prev_packet);
BT_PUT(notit->stream);
release_all_dscopes(notit);