dcsctp: Add more consistency checks

When there is no outstanding data, then next TSN to allocate should
always be one more than what the client has last ACKed.

Bug: None
Change-Id: Ieb8b5b23912d77d96fe3749fb53fd53652d97066
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/232002
Commit-Queue: Victor Boivie <boivie@webrtc.org>
Reviewed-by: Florent Castelli <orphis@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35016}
diff --git a/net/dcsctp/tx/retransmission_queue.cc b/net/dcsctp/tx/retransmission_queue.cc
index 8468143..b1b9afb 100644
--- a/net/dcsctp/tx/retransmission_queue.cc
+++ b/net/dcsctp/tx/retransmission_queue.cc
@@ -108,6 +108,11 @@
     }
   }
 
+  if (outstanding_data_.empty() &&
+      next_tsn_ != last_cumulative_tsn_ack_.next_value()) {
+    return false;
+  }
+
   return actual_outstanding_bytes == outstanding_bytes_ &&
          actual_outstanding_items == outstanding_items_ &&
          actual_to_be_retransmitted == to_be_retransmitted_;