flt.utils.muxer: handle all message types specifically
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Tue, 19 Feb 2019 14:29:22 +0000 (09:29 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 3 May 2019 22:19:38 +0000 (18:19 -0400)
The get_msg_ts_ns() function in `muxer.c` was only handling event and
inactivity messages, making all other messages high priority by default.
However, other messages can have default clock snapshots too, so they
can be sorted.

For discarded events and packets, we use the beginning clock snapshot
as, for the same stream, it must be greater than or equal to the
previous message's clock snapshot (if any), and less than or equal to
the next message's clock snapshot, if any.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
plugins/utils/muxer/muxer.c

index 700789520fee6d2ea2df02a5da90a708a3106aa9..6d8815241d650d0fb6d5a92ec597239c8baa0202 100644 (file)
@@ -614,6 +614,7 @@ int get_msg_ts_ns(struct muxer_comp *muxer_comp,
        const unsigned char *cc_uuid;
        const char *cc_name;
        bt_clock_snapshot_state cs_state = BT_CLOCK_SNAPSHOT_STATE_KNOWN;
+       bt_message_stream_activity_clock_snapshot_state sa_cs_state;
 
        BT_ASSERT(msg);
        BT_ASSERT(ts_ns);
@@ -628,7 +629,42 @@ int get_msg_ts_ns(struct muxer_comp *muxer_comp,
                cs_state = bt_message_event_borrow_default_clock_snapshot_const(
                        msg, &clock_snapshot);
                break;
+       case BT_MESSAGE_TYPE_PACKET_BEGINNING:
+               cs_state = bt_message_packet_beginning_borrow_default_clock_snapshot_const(
+                       msg, &clock_snapshot);
+               break;
+       case BT_MESSAGE_TYPE_PACKET_END:
+               cs_state = bt_message_packet_end_borrow_default_clock_snapshot_const(
+                       msg, &clock_snapshot);
+               break;
+       case BT_MESSAGE_TYPE_DISCARDED_EVENTS:
+               cs_state = bt_message_discarded_events_borrow_default_beginning_clock_snapshot_const(
+                       msg, &clock_snapshot);
+               break;
+       case BT_MESSAGE_TYPE_DISCARDED_PACKETS:
+               cs_state = bt_message_discarded_packets_borrow_default_beginning_clock_snapshot_const(
+                       msg, &clock_snapshot);
+               break;
+       case BT_MESSAGE_TYPE_STREAM_ACTIVITY_BEGINNING:
+               sa_cs_state = bt_message_stream_activity_beginning_borrow_default_clock_snapshot_const(
+                       msg, &clock_snapshot);
+               if (sa_cs_state != BT_MESSAGE_STREAM_ACTIVITY_CLOCK_SNAPSHOT_STATE_KNOWN) {
+                       /* No timestamp: high priority */
+                       *ts_ns = last_returned_ts_ns;
+                       goto end;
+               }
+
+               break;
+       case BT_MESSAGE_TYPE_STREAM_ACTIVITY_END:
+               sa_cs_state = bt_message_stream_activity_end_borrow_default_clock_snapshot_const(
+                       msg, &clock_snapshot);
+               if (sa_cs_state != BT_MESSAGE_STREAM_ACTIVITY_CLOCK_SNAPSHOT_STATE_KNOWN) {
+                       /* No timestamp: high priority */
+                       *ts_ns = last_returned_ts_ns;
+                       goto end;
+               }
 
+               break;
        case BT_MESSAGE_TYPE_INACTIVITY:
                cs_state =
                        bt_message_inactivity_borrow_default_clock_snapshot_const(
This page took 0.025355 seconds and 4 git commands to generate.