Update PeerConnectionSdpMethods::AddRemoteCandidate
...to use string_view for the mid and prefer .mid() over .name for ContentInfo. Bug: webrtc:42233761 Change-Id: Ia9bfe1d7454759ff87295939cda6a71e53cb6b98 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/374663 Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/main@{#43781}
This commit is contained in:
parent
3fef8b27db
commit
7a0bdb602c
@ -2587,7 +2587,7 @@ bool PeerConnection::GetLocalCandidateMediaIndex(
|
|||||||
bool content_found = false;
|
bool content_found = false;
|
||||||
const ContentInfos& contents = local_description()->description()->contents();
|
const ContentInfos& contents = local_description()->description()->contents();
|
||||||
for (size_t index = 0; index < contents.size(); ++index) {
|
for (size_t index = 0; index < contents.size(); ++index) {
|
||||||
if (contents[index].name == content_name) {
|
if (contents[index].mid() == content_name) {
|
||||||
*sdp_mline_index = static_cast<int>(index);
|
*sdp_mline_index = static_cast<int>(index);
|
||||||
content_found = true;
|
content_found = true;
|
||||||
break;
|
break;
|
||||||
@ -2669,7 +2669,7 @@ bool PeerConnection::ValidateBundleSettings(
|
|||||||
citer != contents.end(); ++citer) {
|
citer != contents.end(); ++citer) {
|
||||||
const cricket::ContentInfo* content = (&*citer);
|
const cricket::ContentInfo* content = (&*citer);
|
||||||
RTC_DCHECK(content != NULL);
|
RTC_DCHECK(content != NULL);
|
||||||
auto it = bundle_groups_by_mid.find(content->name);
|
auto it = bundle_groups_by_mid.find(content->mid());
|
||||||
if (it != bundle_groups_by_mid.end() &&
|
if (it != bundle_groups_by_mid.end() &&
|
||||||
!(content->rejected || content->bundle_only) &&
|
!(content->rejected || content->bundle_only) &&
|
||||||
content->type == MediaProtocolType::kRtp) {
|
content->type == MediaProtocolType::kRtp) {
|
||||||
@ -2747,7 +2747,7 @@ void PeerConnection::NoteUsageEvent(UsageEvent event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Asynchronously adds remote candidates on the network thread.
|
// Asynchronously adds remote candidates on the network thread.
|
||||||
void PeerConnection::AddRemoteCandidate(const std::string& mid,
|
void PeerConnection::AddRemoteCandidate(absl::string_view mid,
|
||||||
const cricket::Candidate& candidate) {
|
const cricket::Candidate& candidate) {
|
||||||
RTC_DCHECK_RUN_ON(signaling_thread());
|
RTC_DCHECK_RUN_ON(signaling_thread());
|
||||||
|
|
||||||
@ -2763,7 +2763,8 @@ void PeerConnection::AddRemoteCandidate(const std::string& mid,
|
|||||||
new_candidate.set_underlying_type_for_vpn(rtc::ADAPTER_TYPE_UNKNOWN);
|
new_candidate.set_underlying_type_for_vpn(rtc::ADAPTER_TYPE_UNKNOWN);
|
||||||
|
|
||||||
network_thread()->PostTask(SafeTask(
|
network_thread()->PostTask(SafeTask(
|
||||||
network_thread_safety_, [this, mid = mid, candidate = new_candidate] {
|
network_thread_safety_,
|
||||||
|
[this, mid = std::string(mid), candidate = new_candidate] {
|
||||||
RTC_DCHECK_RUN_ON(network_thread());
|
RTC_DCHECK_RUN_ON(network_thread());
|
||||||
std::vector<cricket::Candidate> candidates = {candidate};
|
std::vector<cricket::Candidate> candidates = {candidate};
|
||||||
RTCError error =
|
RTCError error =
|
||||||
|
|||||||
@ -376,7 +376,7 @@ class PeerConnection : public PeerConnectionInternal,
|
|||||||
void NoteUsageEvent(UsageEvent event) override;
|
void NoteUsageEvent(UsageEvent event) override;
|
||||||
|
|
||||||
// Asynchronously adds a remote candidate on the network thread.
|
// Asynchronously adds a remote candidate on the network thread.
|
||||||
void AddRemoteCandidate(const std::string& mid,
|
void AddRemoteCandidate(absl::string_view mid,
|
||||||
const cricket::Candidate& candidate) override;
|
const cricket::Candidate& candidate) override;
|
||||||
|
|
||||||
// Report the UMA metric BundleUsage for the given remote description.
|
// Report the UMA metric BundleUsage for the given remote description.
|
||||||
|
|||||||
@ -109,7 +109,7 @@ class PeerConnectionSdpMethods {
|
|||||||
int max_message_size) = 0;
|
int max_message_size) = 0;
|
||||||
|
|
||||||
// Asynchronously adds a remote candidate on the network thread.
|
// Asynchronously adds a remote candidate on the network thread.
|
||||||
virtual void AddRemoteCandidate(const std::string& mid,
|
virtual void AddRemoteCandidate(absl::string_view mid,
|
||||||
const cricket::Candidate& candidate) = 0;
|
const cricket::Candidate& candidate) = 0;
|
||||||
|
|
||||||
virtual Call* call_ptr() = 0;
|
virtual Call* call_ptr() = 0;
|
||||||
|
|||||||
@ -355,7 +355,7 @@ class FakePeerConnectionBase : public PeerConnectionInternal {
|
|||||||
int remote_port,
|
int remote_port,
|
||||||
int max_message_size) override {}
|
int max_message_size) override {}
|
||||||
|
|
||||||
void AddRemoteCandidate(const std::string& mid,
|
void AddRemoteCandidate(absl::string_view mid,
|
||||||
const cricket::Candidate& candidate) override {}
|
const cricket::Candidate& candidate) override {}
|
||||||
|
|
||||||
Call* call_ptr() override { return nullptr; }
|
Call* call_ptr() override { return nullptr; }
|
||||||
|
|||||||
@ -270,7 +270,7 @@ class MockPeerConnectionInternal : public PeerConnectionInternal {
|
|||||||
MOCK_METHOD(void, StartSctpTransport, (int, int, int), (override));
|
MOCK_METHOD(void, StartSctpTransport, (int, int, int), (override));
|
||||||
MOCK_METHOD(void,
|
MOCK_METHOD(void,
|
||||||
AddRemoteCandidate,
|
AddRemoteCandidate,
|
||||||
(const std::string&, const cricket::Candidate&),
|
(absl::string_view, const cricket::Candidate&),
|
||||||
(override));
|
(override));
|
||||||
MOCK_METHOD(Call*, call_ptr, (), (override));
|
MOCK_METHOD(Call*, call_ptr, (), (override));
|
||||||
MOCK_METHOD(bool, SrtpRequired, (), (const, override));
|
MOCK_METHOD(bool, SrtpRequired, (), (const, override));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user