Log error when candidates are created without mid and index
Bug: none
Change-Id: Ife764008c67bea6028d50c94e55b248d3ea7eec7
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/403080
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Auto-Submit: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#45276}
diff --git a/api/jsep_ice_candidate.cc b/api/jsep_ice_candidate.cc
index 49c7fb7..635beb1 100644
--- a/api/jsep_ice_candidate.cc
+++ b/api/jsep_ice_candidate.cc
@@ -23,6 +23,7 @@
#include "api/candidate.h"
#include "api/jsep.h"
#include "rtc_base/checks.h"
+#include "rtc_base/logging.h"
namespace webrtc {
namespace {
@@ -43,7 +44,11 @@
const Candidate& candidate)
: sdp_mid_(sdp_mid),
sdp_mline_index_(EnsureValidMLineIndex(sdp_mline_index)),
- candidate_(candidate) {}
+ candidate_(candidate) {
+ if (sdp_mid_.empty() && sdp_mline_index_ < 0) {
+ RTC_LOG(LS_ERROR) << "Neither mid nor index supplied for IceCandidate.";
+ }
+}
void IceCandidateCollection::add(std::unique_ptr<IceCandidate> candidate) {
candidates_.push_back(std::move(candidate));