- diff = next_count - stream_state->discarded_packets_state.cur_count;
- if (diff > 0) {
- /*
- * Add a discarded packets notification. The packets
- * are considered to be lost betweem the state's last time
- * and the current packet's beginning time.
- */
- notif = bt_notification_discarded_elements_create(
- BT_NOTIFICATION_TYPE_DISCARDED_PACKETS,
- stream_state->stream,
- stream_state->discarded_packets_state.cur_begin,
- ts_begin, diff);
- if (!notif) {
- BT_LOGE_STR("Cannot create discarded packets notification.");
- ret = -1;
+ if (prev_count != -1ULL) {
+ if (next_count < prev_count) {
+ BT_LOGW("Current value of packet's context field's `packet_seq_num` field is lesser than the previous value for the same stream: "
+ "not updating the stream state's current value: "
+ "packet-addr=%p, prev-count=%" PRIu64 ", "
+ "cur-count=%" PRIu64,
+ packet, prev_count, next_count);
+ goto end;
+ }
+ if (next_count == prev_count) {
+ BT_LOGW("Current value of packet's context field's `packet_seq_num` field is equal to the previous value for the same stream: "
+ "not updating the stream state's current value: "
+ "packet-addr=%p, prev-count=%" PRIu64 ", "
+ "cur-count=%" PRIu64,
+ packet, prev_count, next_count);