sctp: dcsctp: Don't log full send buffer as error

When sending a large amount of data, the sender will want to keep the
send buffer full so that the socket can quickly drain it as its able to
put more bytes on the wire.

When trying to send a message and when the send buffer is full, an error
will be returned and the OnError callback will be triggered. In these
situations, this is an expected and handled error and should not be
logged as an error, as it causes confusion.

Bug: chromium:1258225
Change-Id: I3e1feab03f60ba5c41cc524d8d8f066445030d18
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/235201
Reviewed-by: Florent Castelli <orphis@webrtc.org>
Commit-Queue: Victor Boivie <boivie@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35204}
diff --git a/media/sctp/dcsctp_transport.cc b/media/sctp/dcsctp_transport.cc
index b6038b2..4a51668 100644
--- a/media/sctp/dcsctp_transport.cc
+++ b/media/sctp/dcsctp_transport.cc
@@ -406,9 +406,18 @@
 
 void DcSctpTransport::OnError(dcsctp::ErrorKind error,
                               absl::string_view message) {
-  RTC_LOG(LS_ERROR) << debug_name_
-                    << "->OnError(error=" << dcsctp::ToString(error)
-                    << ", message=" << message << ").";
+  if (error == dcsctp::ErrorKind::kResourceExhaustion) {
+    // Indicates that a message failed to be enqueued, because the send buffer
+    // is full, which is a very common (and wanted) state for high throughput
+    // sending/benchmarks.
+    RTC_LOG(LS_VERBOSE) << debug_name_
+                        << "->OnError(error=" << dcsctp::ToString(error)
+                        << ", message=" << message << ").";
+  } else {
+    RTC_LOG(LS_ERROR) << debug_name_
+                      << "->OnError(error=" << dcsctp::ToString(error)
+                      << ", message=" << message << ").";
+  }
 }
 
 void DcSctpTransport::OnAborted(dcsctp::ErrorKind error,