diff --git a/pc/sctp_data_channel.cc b/pc/sctp_data_channel.cc index 2ceef83936..f59dd1ec32 100644 --- a/pc/sctp_data_channel.cc +++ b/pc/sctp_data_channel.cc @@ -253,7 +253,7 @@ bool SctpDataChannel::reliable() const { uint64_t SctpDataChannel::buffered_amount() const { RTC_DCHECK_RUN_ON(signaling_thread_); - return buffered_amount_; + return queued_send_data_.byte_count(); } void SctpDataChannel::Close() { @@ -305,8 +305,6 @@ bool SctpDataChannel::Send(const DataBuffer& buffer) { return false; } - buffered_amount_ += buffer.size(); - // If the queue is non-empty, we're waiting for SignalReadyToSend, // so just add to the end of the queue and keep waiting. if (!queued_send_data_.Empty()) { @@ -486,8 +484,6 @@ void SctpDataChannel::CloseAbruptlyWithError(RTCError error) { } // Closing abruptly means any queued data gets thrown away. - buffered_amount_ = 0; - queued_send_data_.Clear(); queued_control_data_.Clear(); @@ -643,8 +639,6 @@ bool SctpDataChannel::SendDataMessage(const DataBuffer& buffer, ++messages_sent_; bytes_sent_ += buffer.size(); - RTC_DCHECK(buffered_amount_ >= buffer.size()); - buffered_amount_ -= buffer.size(); if (observer_ && buffer.size() > 0) { observer_->OnBufferedAmountChange(buffer.size()); } diff --git a/pc/sctp_data_channel.h b/pc/sctp_data_channel.h index 0c3b95a225..56f99df3e5 100644 --- a/pc/sctp_data_channel.h +++ b/pc/sctp_data_channel.h @@ -266,9 +266,6 @@ class SctpDataChannel : public DataChannelInterface, uint64_t bytes_sent_ RTC_GUARDED_BY(signaling_thread_) = 0; uint32_t messages_received_ RTC_GUARDED_BY(signaling_thread_) = 0; uint64_t bytes_received_ RTC_GUARDED_BY(signaling_thread_) = 0; - // Number of bytes of data that have been queued using Send(). Increased - // before each transport send and decreased after each successful send. - uint64_t buffered_amount_ RTC_GUARDED_BY(signaling_thread_) = 0; SctpDataChannelProviderInterface* const provider_ RTC_GUARDED_BY(signaling_thread_); HandshakeState handshake_state_ RTC_GUARDED_BY(signaling_thread_) =