- BT_LOGV("Getting notification's timestamp: "
- "muxer-notif-iter-addr=%p, notif-addr=%p, "
- "last-returned-ts=%" PRId64,
- muxer_notif_iter, notif, last_returned_ts_ns);
-
- switch (bt_notification_get_type(notif)) {
- case BT_NOTIFICATION_TYPE_EVENT:
- cc_prio_map =
- bt_notification_event_get_clock_class_priority_map(
- notif);
- break;
-
- case BT_NOTIFICATION_TYPE_INACTIVITY:
- cc_prio_map =
- bt_notification_inactivity_get_clock_class_priority_map(
- notif);
- break;
- default:
- /* All the other notifications have a higher priority */
- BT_LOGV_STR("Notification has no timestamp: using the last returned timestamp.");
- *ts_ns = last_returned_ts_ns;
- goto end;
- }
-
- if (!cc_prio_map) {
- BT_LOGE("Cannot get notification's clock class priority map: "
- "notif-addr=%p", notif);
- goto error;
- }
-
- /*
- * If the clock class priority map is empty, then we consider
- * that this notification has no time. In this case it's always
- * the youngest.
- */
- if (bt_clock_class_priority_map_get_clock_class_count(cc_prio_map) == 0) {
- BT_LOGV_STR("Notification's clock class priorty map contains 0 clock classes: "
- "using the last returned timestamp.");
- *ts_ns = last_returned_ts_ns;
- goto end;
- }
-
- clock_class =
- bt_clock_class_priority_map_get_highest_priority_clock_class(
- cc_prio_map);
- if (!clock_class) {
- BT_LOGE("Cannot get the clock class with the highest priority from clock class priority map: "
- "cc-prio-map-addr=%p", cc_prio_map);
- goto error;
- }
-
- cc_uuid = bt_ctf_clock_class_get_uuid(clock_class);
- cc_name = bt_ctf_clock_class_get_name(clock_class);
-
- if (muxer_notif_iter->clock_class_expectation ==
- MUXER_NOTIF_ITER_CLOCK_CLASS_EXPECTATION_ANY) {