webrtc_m130/pc/jsep_transport_controller.cc

1430 lines
55 KiB
C++
Raw Normal View History

/*
* Copyright 2017 The WebRTC Project Authors. All rights reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "pc/jsep_transport_controller.h"
#include <stddef.h>
#include <functional>
#include <memory>
#include <string>
#include <type_traits>
#include <utility>
#include "absl/algorithm/container.h"
#include "api/dtls_transport_interface.h"
#include "api/rtp_parameters.h"
#include "api/sequence_checker.h"
#include "api/transport/enums.h"
#include "media/sctp/sctp_transport_internal.h"
#include "p2p/base/dtls_transport.h"
#include "p2p/base/ice_transport_internal.h"
#include "p2p/base/p2p_constants.h"
#include "p2p/base/port.h"
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
#include "rtc_base/thread.h"
#include "rtc_base/trace_event.h"
using webrtc::SdpType;
namespace webrtc {
JsepTransportController::JsepTransportController(
rtc::Thread* network_thread,
cricket::PortAllocator* port_allocator,
Reland "Use the new DNS resolver API in PeerConnection" This reverts commit 5a40b3710545edfd8a634341df3de26f57d79281. Reason for revert: Fixed the bug and ran layout tests. Original change's description: > Revert "Use the new DNS resolver API in PeerConnection" > > This reverts commit acf8ccb3c9f001b0ed749aca52b2d436d66f9586. > > Reason for revert: Speculative revert for https://ci.chromium.org/ui/p/chromium/builders/try/win10_chromium_x64_rel_ng/b8851745102358680592/overview. > > Original change's description: > > Use the new DNS resolver API in PeerConnection > > > > Bug: webrtc:12598 > > Change-Id: I5a14058e7f28c993ed927749df7357c715ba83fb > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/212961 > > Reviewed-by: Niels Moller <nisse@webrtc.org> > > Commit-Queue: Harald Alvestrand <hta@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#33561} > > # Not skipping CQ checks because original CL landed > 1 day ago. > > TBR=hta@webrtc.org > > Bug: webrtc:12598 > Change-Id: Idc9853cb569849c49052f9cbd865614710fff979 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/213188 > Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> > Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#33591} # Not skipping CQ checks because original CL landed > 1 day ago. Bug: webrtc:12598 Change-Id: Ief7867f2f23de66504877cdab1b23a11df2d5de4 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214120 Commit-Queue: Harald Alvestrand <hta@webrtc.org> Reviewed-by: Tommi <tommi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33647}
2021-04-08 07:25:04 +00:00
AsyncDnsResolverFactoryInterface* async_dns_resolver_factory,
Config config)
Reland "Remove thread hops from events provided by JsepTransportController." This reverts commit 6e4fcac31312f2dda5b60d33874ff0cd62f94321. Reason for revert: Parent CL issue has been resolved. Original change's description: > Revert "Remove thread hops from events provided by JsepTransportController." > > This reverts commit f554b3c577f69fa9ffad5c07155898c2d985ac76. > > Reason for revert: Parent CL breaks FYI bots. > See https://webrtc-review.googlesource.com/c/src/+/206466 > > Original change's description: > > Remove thread hops from events provided by JsepTransportController. > > > > Events associated with Subscribe* methods in JTC had trampolines that > > would use an async invoker to fire the events on the signaling thread. > > This was being done for the purposes of PeerConnection but the concept > > of a signaling thread is otherwise not applicable to JTC and use of > > JTC from PC is inconsistent across threads (as has been flagged in > > webrtc:9987). > > > > This change makes all CallbackList members only accessible from the > > network thread and moves the signaling thread related work over to > > PeerConnection, which makes hops there more visible as well as making > > that class easier to refactor for thread efficiency. > > > > This CL removes the AsyncInvoker from JTC (webrtc:12339) > > > > The signaling_thread_ variable is also removed from JTC and more thread > > checks added to catch errors. > > > > Bug: webrtc:12427, webrtc:11988, webrtc:12339 > > Change-Id: Id232aedd00dfd5403b2ba0ca147d3eca7c12c7c5 > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206062 > > Commit-Queue: Tommi <tommi@webrtc.org> > > Reviewed-by: Niels Moller <nisse@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#33195} > > TBR=nisse@webrtc.org,tommi@webrtc.org > > Change-Id: I6134b71b74a9408854b79d44506d513519e9cf4d > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:12427 > Bug: webrtc:11988 > Bug: webrtc:12339 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206467 > Reviewed-by: Guido Urdaneta <guidou@webrtc.org> > Commit-Queue: Guido Urdaneta <guidou@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#33203} TBR=nisse@webrtc.org,tommi@webrtc.org,guidou@webrtc.org # Not skipping CQ checks because original CL landed > 1 day ago. Bug: webrtc:12427 Bug: webrtc:11988 Bug: webrtc:12339 Change-Id: I4e2e1490e1f9a87ed6ac4d722fd3c442e3059ae0 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206809 Reviewed-by: Tommi <tommi@webrtc.org> Commit-Queue: Tommi <tommi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33225}
2021-02-10 17:40:08 +00:00
: network_thread_(network_thread),
port_allocator_(port_allocator),
Reland "Use the new DNS resolver API in PeerConnection" This reverts commit 5a40b3710545edfd8a634341df3de26f57d79281. Reason for revert: Fixed the bug and ran layout tests. Original change's description: > Revert "Use the new DNS resolver API in PeerConnection" > > This reverts commit acf8ccb3c9f001b0ed749aca52b2d436d66f9586. > > Reason for revert: Speculative revert for https://ci.chromium.org/ui/p/chromium/builders/try/win10_chromium_x64_rel_ng/b8851745102358680592/overview. > > Original change's description: > > Use the new DNS resolver API in PeerConnection > > > > Bug: webrtc:12598 > > Change-Id: I5a14058e7f28c993ed927749df7357c715ba83fb > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/212961 > > Reviewed-by: Niels Moller <nisse@webrtc.org> > > Commit-Queue: Harald Alvestrand <hta@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#33561} > > # Not skipping CQ checks because original CL landed > 1 day ago. > > TBR=hta@webrtc.org > > Bug: webrtc:12598 > Change-Id: Idc9853cb569849c49052f9cbd865614710fff979 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/213188 > Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> > Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#33591} # Not skipping CQ checks because original CL landed > 1 day ago. Bug: webrtc:12598 Change-Id: Ief7867f2f23de66504877cdab1b23a11df2d5de4 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214120 Commit-Queue: Harald Alvestrand <hta@webrtc.org> Reviewed-by: Tommi <tommi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33647}
2021-04-08 07:25:04 +00:00
async_dns_resolver_factory_(async_dns_resolver_factory),
transports_(
[this](const std::string& mid, cricket::JsepTransport* transport) {
return OnTransportChanged(mid, transport);
},
[this]() {
RTC_DCHECK_RUN_ON(network_thread_);
UpdateAggregateStates_n();
}),
config_(config),
Reland "Fix bug where we assume new m= sections will always be bundled." This is a reland of commit 704a834f685eb96c9fcf891ca345557bef4d138a, after it was reverted in order to merge a CL to M93. Original change's description: > Fix bug where we assume new m= sections will always be bundled. > > A recent change [1] assumes that all new m= sections will share the > first BUNDLE group (if one already exists), which avoids generating > ICE candidates that are ultimately unnecessary. This is fine for JSEP > endpoints, but it breaks the following scenarios for non-JSEP endpoints: > > * Remote offer adding a new m= section that's not part of any BUNDLE > group. > * Remote offer adding an m= section to the second BUNDLE group. > > The latter is specifically problematic for any application that wants > to bundle all audio streams in one group and all video streams in > another group when using Unified Plan SDP, to replicate the behavior of > using Plan B without bundling. It may try to add a video stream only > for WebRTC to bundle it with audio. > > This is fixed by doing some minor re-factoring, having BundleManager > update the bundle groups at offer time. > > Also: > * Added some additional validation for multiple bundle groups in a > subsequent offer, since that now becomes relevant. > * Improved rollback support, because now rolling back an offer may need > to not only remove mid->transport mappings but alter them. > > [1]: https://webrtc-review.googlesource.com/c/src/+/221601 > > Bug: webrtc:12906, webrtc:12999 > Change-Id: I4c6e7020c0be33a782d3608dee88e4e2fceb1be1 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/225642 > Reviewed-by: Harald Alvestrand <hta@webrtc.org> > Reviewed-by: Henrik Boström <hbos@webrtc.org> > Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#34544} Bug: webrtc:12906, webrtc:12999 Change-Id: Id6acab2e2d7430c65f4b6a1d7372388a70cc18ab Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/228465 Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/master@{#34728}
2021-08-11 14:56:38 -07:00
active_reset_srtp_params_(config.active_reset_srtp_params),
bundles_(config.bundle_policy) {
Reland "Use backticks not vertical bars to denote variables in comments for /pc" Original change's description: > Revert "Use backticks not vertical bars to denote variables in comments for /pc" > > This reverts commit 37ee0f5e594dd772ec6d620b5e5ea8a751b684f0. > > Reason for revert: Revert in order to be able to revert https://webrtc-review.googlesource.com/c/src/+/225642 > > Original change's description: > > Use backticks not vertical bars to denote variables in comments for /pc > > > > Bug: webrtc:12338 > > Change-Id: I88cf10afa5fc810b95d2a585ab2e895dcc163b63 > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/226953 > > Reviewed-by: Harald Alvestrand <hta@webrtc.org> > > Commit-Queue: Artem Titov <titovartem@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#34575} > > TBR=hta@webrtc.org,titovartem@webrtc.org,webrtc-scoped@luci-project-accounts.iam.gserviceaccount.com > > Change-Id: I5eddd3a14e1f664bf831e5c294fbc4de5f6a88af > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:12338 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/227082 > Reviewed-by: Björn Terelius <terelius@webrtc.org> > Commit-Queue: Björn Terelius <terelius@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#34577} Bug: webrtc:12338 Change-Id: I96bd229b73613c162d11d75fa4f5934e1b4295c7 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/227087 Commit-Queue: Artem Titov <titovartem@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/master@{#34611}
2021-07-30 22:30:23 +02:00
// The `transport_observer` is assumed to be non-null.
RTC_DCHECK(config_.transport_observer);
RTC_DCHECK(config_.rtcp_handler);
RTC_DCHECK(config_.ice_transport_factory);
RTC_DCHECK(config_.on_dtls_handshake_error_);
RTC_DCHECK(config_.field_trials);
}
JsepTransportController::~JsepTransportController() {
// Channel destructors may try to send packets, so this needs to happen on
// the network thread.
Reland "Fix unsynchronized access to mid_to_transport_ in JsepTransportController" This reverts commit 6b143c1c0686519bc9d73223c1350cee286c8d78. Reason for revert: Relanding with updated expectations for SctpTransport::Information based on TransceiverStateSurfacer in Chromium. Original change's description: > Revert "Fix unsynchronized access to mid_to_transport_ in JsepTransportController" > > This reverts commit 6cd405850467683cf10d05028ea0f644a68a91a4. > > Reason for revert: Breaks WebRTC Chromium FYI Bots > > First failure: > https://ci.chromium.org/p/chromium/builders/webrtc.fyi/WebRTC%20Chromium%20FYI%20Android%20Tests%20%28dbg%29%20%28L%20Nexus5%29/1925 > > Failed tests: > WebRtcDataBrowserTest.CallWithSctpDataAndMedia > WebRtcDataBrowserTest.CallWithSctpDataOnly > > Original change's description: > > Fix unsynchronized access to mid_to_transport_ in JsepTransportController > > > > * Added several thread checks to JTC to help with programmer errors. > > * Avoid a few Invokes() to the network thread here and there such > > as for fetching sctp transport name for getStats(). The transport > > name is now cached when it changes on the network thread. > > * JsepTransportController instances now get deleted on the network > > thread rather than on the signaling thread + issuing an Invoke() > > in the dtor. > > * Moved some thread hops from JTC over to PC which is where the problem > > exists and also (imho) makes it easier to see where hops happen in > > the PC code. > > * The sctp transport is now started asynchronously when we push down the > > media description. > > * PeerConnection proxy calls GetSctpTransport directly on the network > > thread instead of to the signaling thread + blocking on the network > > thread. > > * The above changes simplified things for webrtc::SctpTransport which > > allowed for removing locking from that class and delete some code. > > > > Bug: webrtc:9987, webrtc:12445 > > Change-Id: Ic89a9426e314e1b93c81751d4f732f05fa448fbc > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/205620 > > Commit-Queue: Tommi <tommi@webrtc.org> > > Reviewed-by: Harald Alvestrand <hta@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#33191} > > TBR=tommi@webrtc.org,hta@webrtc.org > > Change-Id: I7b2913d5133807589461105cf07eff3e9bb7157e > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:9987 > Bug: webrtc:12445 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206466 > Reviewed-by: Guido Urdaneta <guidou@webrtc.org> > Commit-Queue: Guido Urdaneta <guidou@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#33204} TBR=tommi@webrtc.org,hta@webrtc.org,guidou@webrtc.org # Not skipping CQ checks because this is a reland. Bug: webrtc:9987 Bug: webrtc:12445 Change-Id: Icb205cbac493ed3b881d71ea3af4fb9018701bf4 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206560 Reviewed-by: Tommi <tommi@webrtc.org> Reviewed-by: Guido Urdaneta <guidou@webrtc.org> Commit-Queue: Tommi <tommi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33219}
2021-02-10 13:05:44 +01:00
RTC_DCHECK_RUN_ON(network_thread_);
DestroyAllJsepTransports_n();
}
RTCError JsepTransportController::SetLocalDescription(
SdpType type,
const cricket::SessionDescription* description) {
TRACE_EVENT0("webrtc", "JsepTransportController::SetLocalDescription");
if (!network_thread_->IsCurrent()) {
return network_thread_->BlockingCall(
[=] { return SetLocalDescription(type, description); });
}
RTC_DCHECK_RUN_ON(network_thread_);
if (!initial_offerer_.has_value()) {
initial_offerer_.emplace(type == SdpType::kOffer);
if (*initial_offerer_) {
SetIceRole_n(cricket::ICEROLE_CONTROLLING);
} else {
SetIceRole_n(cricket::ICEROLE_CONTROLLED);
}
}
return ApplyDescription_n(/*local=*/true, type, description);
}
RTCError JsepTransportController::SetRemoteDescription(
SdpType type,
const cricket::SessionDescription* description) {
TRACE_EVENT0("webrtc", "JsepTransportController::SetRemoteDescription");
if (!network_thread_->IsCurrent()) {
return network_thread_->BlockingCall(
[=] { return SetRemoteDescription(type, description); });
}
RTC_DCHECK_RUN_ON(network_thread_);
return ApplyDescription_n(/*local=*/false, type, description);
}
RtpTransportInternal* JsepTransportController::GetRtpTransport(
absl::string_view mid) const {
Reland "Fix unsynchronized access to mid_to_transport_ in JsepTransportController" This reverts commit 6b143c1c0686519bc9d73223c1350cee286c8d78. Reason for revert: Relanding with updated expectations for SctpTransport::Information based on TransceiverStateSurfacer in Chromium. Original change's description: > Revert "Fix unsynchronized access to mid_to_transport_ in JsepTransportController" > > This reverts commit 6cd405850467683cf10d05028ea0f644a68a91a4. > > Reason for revert: Breaks WebRTC Chromium FYI Bots > > First failure: > https://ci.chromium.org/p/chromium/builders/webrtc.fyi/WebRTC%20Chromium%20FYI%20Android%20Tests%20%28dbg%29%20%28L%20Nexus5%29/1925 > > Failed tests: > WebRtcDataBrowserTest.CallWithSctpDataAndMedia > WebRtcDataBrowserTest.CallWithSctpDataOnly > > Original change's description: > > Fix unsynchronized access to mid_to_transport_ in JsepTransportController > > > > * Added several thread checks to JTC to help with programmer errors. > > * Avoid a few Invokes() to the network thread here and there such > > as for fetching sctp transport name for getStats(). The transport > > name is now cached when it changes on the network thread. > > * JsepTransportController instances now get deleted on the network > > thread rather than on the signaling thread + issuing an Invoke() > > in the dtor. > > * Moved some thread hops from JTC over to PC which is where the problem > > exists and also (imho) makes it easier to see where hops happen in > > the PC code. > > * The sctp transport is now started asynchronously when we push down the > > media description. > > * PeerConnection proxy calls GetSctpTransport directly on the network > > thread instead of to the signaling thread + blocking on the network > > thread. > > * The above changes simplified things for webrtc::SctpTransport which > > allowed for removing locking from that class and delete some code. > > > > Bug: webrtc:9987, webrtc:12445 > > Change-Id: Ic89a9426e314e1b93c81751d4f732f05fa448fbc > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/205620 > > Commit-Queue: Tommi <tommi@webrtc.org> > > Reviewed-by: Harald Alvestrand <hta@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#33191} > > TBR=tommi@webrtc.org,hta@webrtc.org > > Change-Id: I7b2913d5133807589461105cf07eff3e9bb7157e > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:9987 > Bug: webrtc:12445 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206466 > Reviewed-by: Guido Urdaneta <guidou@webrtc.org> > Commit-Queue: Guido Urdaneta <guidou@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#33204} TBR=tommi@webrtc.org,hta@webrtc.org,guidou@webrtc.org # Not skipping CQ checks because this is a reland. Bug: webrtc:9987 Bug: webrtc:12445 Change-Id: Icb205cbac493ed3b881d71ea3af4fb9018701bf4 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206560 Reviewed-by: Tommi <tommi@webrtc.org> Reviewed-by: Guido Urdaneta <guidou@webrtc.org> Commit-Queue: Tommi <tommi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33219}
2021-02-10 13:05:44 +01:00
RTC_DCHECK_RUN_ON(network_thread_);
auto jsep_transport = GetJsepTransportForMid(mid);
if (!jsep_transport) {
return nullptr;
}
return jsep_transport->rtp_transport();
}
Changes to enable use of DatagramTransport as a data channel transport. PeerConnection now has a new setting in RTCConfiguration to enable use of datagram transport for data channels. There is also a corresponding field trial, which has both a kill-switch and a way to change the default value. PeerConnection's interaction with MediaTransport for data channels has been refactored to work with DataChannelTransportInterface instead. Adds a DataChannelState and OnStateChanged() to the DataChannelSink callbacks. This allows PeerConnection to listen to the data channel's state directly, instead of indirectly by monitoring media transport state. This is necessary to enable use of non-media-transport (eg. datagram transport) data channel transports. For now, PeerConnection watches the state through MediaTransport as well. This will persist until MediaTransport implements the new callback. Datagram transport use is negotiated. As such, an offer that requests to use datagram transport for data channels may be rejected by the answerer. If the offer includes DTLS, the data channels will be negotiated as SCTP/DTLS data channels with an extra x-opaque parameter for datagram transport. If the opaque parameter is rejected (by an answerer without datagram support), the offerer may fall back to SCTP. If DTLS is not enabled, there is no viable fallback. In this case, the data channels are negotiated as media transport data channels. If the receiver does not understand the x-opaque line, it will reject these data channels, and the offerer's data channels will be closed. Bug: webrtc:9719 Change-Id: Ic1bf3664c4bcf9d754482df59897f5f72fe68fcc Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/147702 Commit-Queue: Bjorn Mellem <mellem@webrtc.org> Reviewed-by: Steve Anton <steveanton@webrtc.org> Cr-Commit-Position: refs/heads/master@{#28932}
2019-08-21 10:44:59 -07:00
DataChannelTransportInterface* JsepTransportController::GetDataChannelTransport(
const std::string& mid) const {
Reland "Fix unsynchronized access to mid_to_transport_ in JsepTransportController" This reverts commit 6b143c1c0686519bc9d73223c1350cee286c8d78. Reason for revert: Relanding with updated expectations for SctpTransport::Information based on TransceiverStateSurfacer in Chromium. Original change's description: > Revert "Fix unsynchronized access to mid_to_transport_ in JsepTransportController" > > This reverts commit 6cd405850467683cf10d05028ea0f644a68a91a4. > > Reason for revert: Breaks WebRTC Chromium FYI Bots > > First failure: > https://ci.chromium.org/p/chromium/builders/webrtc.fyi/WebRTC%20Chromium%20FYI%20Android%20Tests%20%28dbg%29%20%28L%20Nexus5%29/1925 > > Failed tests: > WebRtcDataBrowserTest.CallWithSctpDataAndMedia > WebRtcDataBrowserTest.CallWithSctpDataOnly > > Original change's description: > > Fix unsynchronized access to mid_to_transport_ in JsepTransportController > > > > * Added several thread checks to JTC to help with programmer errors. > > * Avoid a few Invokes() to the network thread here and there such > > as for fetching sctp transport name for getStats(). The transport > > name is now cached when it changes on the network thread. > > * JsepTransportController instances now get deleted on the network > > thread rather than on the signaling thread + issuing an Invoke() > > in the dtor. > > * Moved some thread hops from JTC over to PC which is where the problem > > exists and also (imho) makes it easier to see where hops happen in > > the PC code. > > * The sctp transport is now started asynchronously when we push down the > > media description. > > * PeerConnection proxy calls GetSctpTransport directly on the network > > thread instead of to the signaling thread + blocking on the network > > thread. > > * The above changes simplified things for webrtc::SctpTransport which > > allowed for removing locking from that class and delete some code. > > > > Bug: webrtc:9987, webrtc:12445 > > Change-Id: Ic89a9426e314e1b93c81751d4f732f05fa448fbc > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/205620 > > Commit-Queue: Tommi <tommi@webrtc.org> > > Reviewed-by: Harald Alvestrand <hta@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#33191} > > TBR=tommi@webrtc.org,hta@webrtc.org > > Change-Id: I7b2913d5133807589461105cf07eff3e9bb7157e > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:9987 > Bug: webrtc:12445 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206466 > Reviewed-by: Guido Urdaneta <guidou@webrtc.org> > Commit-Queue: Guido Urdaneta <guidou@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#33204} TBR=tommi@webrtc.org,hta@webrtc.org,guidou@webrtc.org # Not skipping CQ checks because this is a reland. Bug: webrtc:9987 Bug: webrtc:12445 Change-Id: Icb205cbac493ed3b881d71ea3af4fb9018701bf4 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206560 Reviewed-by: Tommi <tommi@webrtc.org> Reviewed-by: Guido Urdaneta <guidou@webrtc.org> Commit-Queue: Tommi <tommi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33219}
2021-02-10 13:05:44 +01:00
RTC_DCHECK_RUN_ON(network_thread_);
auto jsep_transport = GetJsepTransportForMid(mid);
Changes to enable use of DatagramTransport as a data channel transport. PeerConnection now has a new setting in RTCConfiguration to enable use of datagram transport for data channels. There is also a corresponding field trial, which has both a kill-switch and a way to change the default value. PeerConnection's interaction with MediaTransport for data channels has been refactored to work with DataChannelTransportInterface instead. Adds a DataChannelState and OnStateChanged() to the DataChannelSink callbacks. This allows PeerConnection to listen to the data channel's state directly, instead of indirectly by monitoring media transport state. This is necessary to enable use of non-media-transport (eg. datagram transport) data channel transports. For now, PeerConnection watches the state through MediaTransport as well. This will persist until MediaTransport implements the new callback. Datagram transport use is negotiated. As such, an offer that requests to use datagram transport for data channels may be rejected by the answerer. If the offer includes DTLS, the data channels will be negotiated as SCTP/DTLS data channels with an extra x-opaque parameter for datagram transport. If the opaque parameter is rejected (by an answerer without datagram support), the offerer may fall back to SCTP. If DTLS is not enabled, there is no viable fallback. In this case, the data channels are negotiated as media transport data channels. If the receiver does not understand the x-opaque line, it will reject these data channels, and the offerer's data channels will be closed. Bug: webrtc:9719 Change-Id: Ic1bf3664c4bcf9d754482df59897f5f72fe68fcc Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/147702 Commit-Queue: Bjorn Mellem <mellem@webrtc.org> Reviewed-by: Steve Anton <steveanton@webrtc.org> Cr-Commit-Position: refs/heads/master@{#28932}
2019-08-21 10:44:59 -07:00
if (!jsep_transport) {
return nullptr;
}
Reland "Reland "Refactor SCTP data channels to use DataChannelTransportInterface."" This is a reland of 487f9a17e426fd14bb06b13e861071b3f15d119b Original change's description: > Reland "Refactor SCTP data channels to use DataChannelTransportInterface." > > Also clears SctpTransport before deleting JsepTransport. > > SctpTransport is ref-counted, but the underlying transport is deleted when > JsepTransport clears the rtp_dtls_transport. This results in crashes when > usrsctp attempts to send outgoing packets through a dangling pointer to the > underlying transport. > > Clearing SctpTransport before DtlsTransport removes the pointer to the > underlying transport before it becomes invalid. > > This fixes a crash in chromium's web platform tests (see > https://chromium-review.googlesource.com/c/chromium/src/+/1776711). > > Original change's description: > > Refactor SCTP data channels to use DataChannelTransportInterface. > > > > This change moves SctpTransport to be owned by JsepTransport, which now > > holds a DataChannelTransport implementation for SCTP when it is used for > > data channels. > > > > This simplifies negotiation and fallback to SCTP. Negotiation can now > > use a composite DataChannelTransport, just as negotiation for RTP uses a > > composite RTP transport. > > > > PeerConnection also has one fewer way it needs to manage data channels. > > It now handles SCTP and datagram- or media-transport-based data channels > > the same way. > > > > There are a few leaky abstractions left. For example, PeerConnection > > calls Start() on the SctpTransport at a particular point in negotiation, > > but does not need to call this for other transports. Similarly, PC > > exposes an interface to the SCTP transport directly to the user; there > > is no equivalent for other transports. > > Bug: webrtc:9719 > Change-Id: I64e94b88afb119fdbf5f22750f88c8a084d53937 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/151981 > Reviewed-by: Benjamin Wright <benwright@webrtc.org> > Reviewed-by: Steve Anton <steveanton@webrtc.org> > Commit-Queue: Benjamin Wright <benwright@webrtc.org> > Commit-Queue: Bjorn Mellem <mellem@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#29120} Bug: webrtc:9719 Change-Id: I28481a3de64a3506bc57748106383eeba4ef205c Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/152740 Reviewed-by: Artem Titov <titovartem@webrtc.org> Reviewed-by: Benjamin Wright <benwright@webrtc.org> Reviewed-by: Seth Hampson <shampson@webrtc.org> Commit-Queue: Bjorn Mellem <mellem@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29290}
2019-09-23 14:53:54 -07:00
return jsep_transport->data_channel_transport();
}
cricket::DtlsTransportInternal* JsepTransportController::GetDtlsTransport(
const std::string& mid) {
Reland "Fix unsynchronized access to mid_to_transport_ in JsepTransportController" This reverts commit 6b143c1c0686519bc9d73223c1350cee286c8d78. Reason for revert: Relanding with updated expectations for SctpTransport::Information based on TransceiverStateSurfacer in Chromium. Original change's description: > Revert "Fix unsynchronized access to mid_to_transport_ in JsepTransportController" > > This reverts commit 6cd405850467683cf10d05028ea0f644a68a91a4. > > Reason for revert: Breaks WebRTC Chromium FYI Bots > > First failure: > https://ci.chromium.org/p/chromium/builders/webrtc.fyi/WebRTC%20Chromium%20FYI%20Android%20Tests%20%28dbg%29%20%28L%20Nexus5%29/1925 > > Failed tests: > WebRtcDataBrowserTest.CallWithSctpDataAndMedia > WebRtcDataBrowserTest.CallWithSctpDataOnly > > Original change's description: > > Fix unsynchronized access to mid_to_transport_ in JsepTransportController > > > > * Added several thread checks to JTC to help with programmer errors. > > * Avoid a few Invokes() to the network thread here and there such > > as for fetching sctp transport name for getStats(). The transport > > name is now cached when it changes on the network thread. > > * JsepTransportController instances now get deleted on the network > > thread rather than on the signaling thread + issuing an Invoke() > > in the dtor. > > * Moved some thread hops from JTC over to PC which is where the problem > > exists and also (imho) makes it easier to see where hops happen in > > the PC code. > > * The sctp transport is now started asynchronously when we push down the > > media description. > > * PeerConnection proxy calls GetSctpTransport directly on the network > > thread instead of to the signaling thread + blocking on the network > > thread. > > * The above changes simplified things for webrtc::SctpTransport which > > allowed for removing locking from that class and delete some code. > > > > Bug: webrtc:9987, webrtc:12445 > > Change-Id: Ic89a9426e314e1b93c81751d4f732f05fa448fbc > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/205620 > > Commit-Queue: Tommi <tommi@webrtc.org> > > Reviewed-by: Harald Alvestrand <hta@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#33191} > > TBR=tommi@webrtc.org,hta@webrtc.org > > Change-Id: I7b2913d5133807589461105cf07eff3e9bb7157e > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:9987 > Bug: webrtc:12445 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206466 > Reviewed-by: Guido Urdaneta <guidou@webrtc.org> > Commit-Queue: Guido Urdaneta <guidou@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#33204} TBR=tommi@webrtc.org,hta@webrtc.org,guidou@webrtc.org # Not skipping CQ checks because this is a reland. Bug: webrtc:9987 Bug: webrtc:12445 Change-Id: Icb205cbac493ed3b881d71ea3af4fb9018701bf4 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206560 Reviewed-by: Tommi <tommi@webrtc.org> Reviewed-by: Guido Urdaneta <guidou@webrtc.org> Commit-Queue: Tommi <tommi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33219}
2021-02-10 13:05:44 +01:00
RTC_DCHECK_RUN_ON(network_thread_);
auto jsep_transport = GetJsepTransportForMid(mid);
if (!jsep_transport) {
return nullptr;
}
return jsep_transport->rtp_dtls_transport();
}
const cricket::DtlsTransportInternal*
JsepTransportController::GetRtcpDtlsTransport(const std::string& mid) const {
Reland "Fix unsynchronized access to mid_to_transport_ in JsepTransportController" This reverts commit 6b143c1c0686519bc9d73223c1350cee286c8d78. Reason for revert: Relanding with updated expectations for SctpTransport::Information based on TransceiverStateSurfacer in Chromium. Original change's description: > Revert "Fix unsynchronized access to mid_to_transport_ in JsepTransportController" > > This reverts commit 6cd405850467683cf10d05028ea0f644a68a91a4. > > Reason for revert: Breaks WebRTC Chromium FYI Bots > > First failure: > https://ci.chromium.org/p/chromium/builders/webrtc.fyi/WebRTC%20Chromium%20FYI%20Android%20Tests%20%28dbg%29%20%28L%20Nexus5%29/1925 > > Failed tests: > WebRtcDataBrowserTest.CallWithSctpDataAndMedia > WebRtcDataBrowserTest.CallWithSctpDataOnly > > Original change's description: > > Fix unsynchronized access to mid_to_transport_ in JsepTransportController > > > > * Added several thread checks to JTC to help with programmer errors. > > * Avoid a few Invokes() to the network thread here and there such > > as for fetching sctp transport name for getStats(). The transport > > name is now cached when it changes on the network thread. > > * JsepTransportController instances now get deleted on the network > > thread rather than on the signaling thread + issuing an Invoke() > > in the dtor. > > * Moved some thread hops from JTC over to PC which is where the problem > > exists and also (imho) makes it easier to see where hops happen in > > the PC code. > > * The sctp transport is now started asynchronously when we push down the > > media description. > > * PeerConnection proxy calls GetSctpTransport directly on the network > > thread instead of to the signaling thread + blocking on the network > > thread. > > * The above changes simplified things for webrtc::SctpTransport which > > allowed for removing locking from that class and delete some code. > > > > Bug: webrtc:9987, webrtc:12445 > > Change-Id: Ic89a9426e314e1b93c81751d4f732f05fa448fbc > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/205620 > > Commit-Queue: Tommi <tommi@webrtc.org> > > Reviewed-by: Harald Alvestrand <hta@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#33191} > > TBR=tommi@webrtc.org,hta@webrtc.org > > Change-Id: I7b2913d5133807589461105cf07eff3e9bb7157e > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:9987 > Bug: webrtc:12445 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206466 > Reviewed-by: Guido Urdaneta <guidou@webrtc.org> > Commit-Queue: Guido Urdaneta <guidou@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#33204} TBR=tommi@webrtc.org,hta@webrtc.org,guidou@webrtc.org # Not skipping CQ checks because this is a reland. Bug: webrtc:9987 Bug: webrtc:12445 Change-Id: Icb205cbac493ed3b881d71ea3af4fb9018701bf4 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206560 Reviewed-by: Tommi <tommi@webrtc.org> Reviewed-by: Guido Urdaneta <guidou@webrtc.org> Commit-Queue: Tommi <tommi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33219}
2021-02-10 13:05:44 +01:00
RTC_DCHECK_RUN_ON(network_thread_);
auto jsep_transport = GetJsepTransportForMid(mid);
if (!jsep_transport) {
return nullptr;
}
return jsep_transport->rtcp_dtls_transport();
}
rtc::scoped_refptr<webrtc::DtlsTransport>
JsepTransportController::LookupDtlsTransportByMid(const std::string& mid) {
Reland "Fix unsynchronized access to mid_to_transport_ in JsepTransportController" This reverts commit 6b143c1c0686519bc9d73223c1350cee286c8d78. Reason for revert: Relanding with updated expectations for SctpTransport::Information based on TransceiverStateSurfacer in Chromium. Original change's description: > Revert "Fix unsynchronized access to mid_to_transport_ in JsepTransportController" > > This reverts commit 6cd405850467683cf10d05028ea0f644a68a91a4. > > Reason for revert: Breaks WebRTC Chromium FYI Bots > > First failure: > https://ci.chromium.org/p/chromium/builders/webrtc.fyi/WebRTC%20Chromium%20FYI%20Android%20Tests%20%28dbg%29%20%28L%20Nexus5%29/1925 > > Failed tests: > WebRtcDataBrowserTest.CallWithSctpDataAndMedia > WebRtcDataBrowserTest.CallWithSctpDataOnly > > Original change's description: > > Fix unsynchronized access to mid_to_transport_ in JsepTransportController > > > > * Added several thread checks to JTC to help with programmer errors. > > * Avoid a few Invokes() to the network thread here and there such > > as for fetching sctp transport name for getStats(). The transport > > name is now cached when it changes on the network thread. > > * JsepTransportController instances now get deleted on the network > > thread rather than on the signaling thread + issuing an Invoke() > > in the dtor. > > * Moved some thread hops from JTC over to PC which is where the problem > > exists and also (imho) makes it easier to see where hops happen in > > the PC code. > > * The sctp transport is now started asynchronously when we push down the > > media description. > > * PeerConnection proxy calls GetSctpTransport directly on the network > > thread instead of to the signaling thread + blocking on the network > > thread. > > * The above changes simplified things for webrtc::SctpTransport which > > allowed for removing locking from that class and delete some code. > > > > Bug: webrtc:9987, webrtc:12445 > > Change-Id: Ic89a9426e314e1b93c81751d4f732f05fa448fbc > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/205620 > > Commit-Queue: Tommi <tommi@webrtc.org> > > Reviewed-by: Harald Alvestrand <hta@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#33191} > > TBR=tommi@webrtc.org,hta@webrtc.org > > Change-Id: I7b2913d5133807589461105cf07eff3e9bb7157e > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:9987 > Bug: webrtc:12445 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206466 > Reviewed-by: Guido Urdaneta <guidou@webrtc.org> > Commit-Queue: Guido Urdaneta <guidou@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#33204} TBR=tommi@webrtc.org,hta@webrtc.org,guidou@webrtc.org # Not skipping CQ checks because this is a reland. Bug: webrtc:9987 Bug: webrtc:12445 Change-Id: Icb205cbac493ed3b881d71ea3af4fb9018701bf4 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206560 Reviewed-by: Tommi <tommi@webrtc.org> Reviewed-by: Guido Urdaneta <guidou@webrtc.org> Commit-Queue: Tommi <tommi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33219}
2021-02-10 13:05:44 +01:00
RTC_DCHECK_RUN_ON(network_thread_);
auto jsep_transport = GetJsepTransportForMid(mid);
if (!jsep_transport) {
return nullptr;
}
return jsep_transport->RtpDtlsTransport();
}
Reland "Reland "Refactor SCTP data channels to use DataChannelTransportInterface."" This is a reland of 487f9a17e426fd14bb06b13e861071b3f15d119b Original change's description: > Reland "Refactor SCTP data channels to use DataChannelTransportInterface." > > Also clears SctpTransport before deleting JsepTransport. > > SctpTransport is ref-counted, but the underlying transport is deleted when > JsepTransport clears the rtp_dtls_transport. This results in crashes when > usrsctp attempts to send outgoing packets through a dangling pointer to the > underlying transport. > > Clearing SctpTransport before DtlsTransport removes the pointer to the > underlying transport before it becomes invalid. > > This fixes a crash in chromium's web platform tests (see > https://chromium-review.googlesource.com/c/chromium/src/+/1776711). > > Original change's description: > > Refactor SCTP data channels to use DataChannelTransportInterface. > > > > This change moves SctpTransport to be owned by JsepTransport, which now > > holds a DataChannelTransport implementation for SCTP when it is used for > > data channels. > > > > This simplifies negotiation and fallback to SCTP. Negotiation can now > > use a composite DataChannelTransport, just as negotiation for RTP uses a > > composite RTP transport. > > > > PeerConnection also has one fewer way it needs to manage data channels. > > It now handles SCTP and datagram- or media-transport-based data channels > > the same way. > > > > There are a few leaky abstractions left. For example, PeerConnection > > calls Start() on the SctpTransport at a particular point in negotiation, > > but does not need to call this for other transports. Similarly, PC > > exposes an interface to the SCTP transport directly to the user; there > > is no equivalent for other transports. > > Bug: webrtc:9719 > Change-Id: I64e94b88afb119fdbf5f22750f88c8a084d53937 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/151981 > Reviewed-by: Benjamin Wright <benwright@webrtc.org> > Reviewed-by: Steve Anton <steveanton@webrtc.org> > Commit-Queue: Benjamin Wright <benwright@webrtc.org> > Commit-Queue: Bjorn Mellem <mellem@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#29120} Bug: webrtc:9719 Change-Id: I28481a3de64a3506bc57748106383eeba4ef205c Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/152740 Reviewed-by: Artem Titov <titovartem@webrtc.org> Reviewed-by: Benjamin Wright <benwright@webrtc.org> Reviewed-by: Seth Hampson <shampson@webrtc.org> Commit-Queue: Bjorn Mellem <mellem@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29290}
2019-09-23 14:53:54 -07:00
rtc::scoped_refptr<SctpTransport> JsepTransportController::GetSctpTransport(
const std::string& mid) const {
Reland "Fix unsynchronized access to mid_to_transport_ in JsepTransportController" This reverts commit 6b143c1c0686519bc9d73223c1350cee286c8d78. Reason for revert: Relanding with updated expectations for SctpTransport::Information based on TransceiverStateSurfacer in Chromium. Original change's description: > Revert "Fix unsynchronized access to mid_to_transport_ in JsepTransportController" > > This reverts commit 6cd405850467683cf10d05028ea0f644a68a91a4. > > Reason for revert: Breaks WebRTC Chromium FYI Bots > > First failure: > https://ci.chromium.org/p/chromium/builders/webrtc.fyi/WebRTC%20Chromium%20FYI%20Android%20Tests%20%28dbg%29%20%28L%20Nexus5%29/1925 > > Failed tests: > WebRtcDataBrowserTest.CallWithSctpDataAndMedia > WebRtcDataBrowserTest.CallWithSctpDataOnly > > Original change's description: > > Fix unsynchronized access to mid_to_transport_ in JsepTransportController > > > > * Added several thread checks to JTC to help with programmer errors. > > * Avoid a few Invokes() to the network thread here and there such > > as for fetching sctp transport name for getStats(). The transport > > name is now cached when it changes on the network thread. > > * JsepTransportController instances now get deleted on the network > > thread rather than on the signaling thread + issuing an Invoke() > > in the dtor. > > * Moved some thread hops from JTC over to PC which is where the problem > > exists and also (imho) makes it easier to see where hops happen in > > the PC code. > > * The sctp transport is now started asynchronously when we push down the > > media description. > > * PeerConnection proxy calls GetSctpTransport directly on the network > > thread instead of to the signaling thread + blocking on the network > > thread. > > * The above changes simplified things for webrtc::SctpTransport which > > allowed for removing locking from that class and delete some code. > > > > Bug: webrtc:9987, webrtc:12445 > > Change-Id: Ic89a9426e314e1b93c81751d4f732f05fa448fbc > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/205620 > > Commit-Queue: Tommi <tommi@webrtc.org> > > Reviewed-by: Harald Alvestrand <hta@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#33191} > > TBR=tommi@webrtc.org,hta@webrtc.org > > Change-Id: I7b2913d5133807589461105cf07eff3e9bb7157e > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:9987 > Bug: webrtc:12445 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206466 > Reviewed-by: Guido Urdaneta <guidou@webrtc.org> > Commit-Queue: Guido Urdaneta <guidou@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#33204} TBR=tommi@webrtc.org,hta@webrtc.org,guidou@webrtc.org # Not skipping CQ checks because this is a reland. Bug: webrtc:9987 Bug: webrtc:12445 Change-Id: Icb205cbac493ed3b881d71ea3af4fb9018701bf4 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206560 Reviewed-by: Tommi <tommi@webrtc.org> Reviewed-by: Guido Urdaneta <guidou@webrtc.org> Commit-Queue: Tommi <tommi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33219}
2021-02-10 13:05:44 +01:00
RTC_DCHECK_RUN_ON(network_thread_);
Reland "Reland "Refactor SCTP data channels to use DataChannelTransportInterface."" This is a reland of 487f9a17e426fd14bb06b13e861071b3f15d119b Original change's description: > Reland "Refactor SCTP data channels to use DataChannelTransportInterface." > > Also clears SctpTransport before deleting JsepTransport. > > SctpTransport is ref-counted, but the underlying transport is deleted when > JsepTransport clears the rtp_dtls_transport. This results in crashes when > usrsctp attempts to send outgoing packets through a dangling pointer to the > underlying transport. > > Clearing SctpTransport before DtlsTransport removes the pointer to the > underlying transport before it becomes invalid. > > This fixes a crash in chromium's web platform tests (see > https://chromium-review.googlesource.com/c/chromium/src/+/1776711). > > Original change's description: > > Refactor SCTP data channels to use DataChannelTransportInterface. > > > > This change moves SctpTransport to be owned by JsepTransport, which now > > holds a DataChannelTransport implementation for SCTP when it is used for > > data channels. > > > > This simplifies negotiation and fallback to SCTP. Negotiation can now > > use a composite DataChannelTransport, just as negotiation for RTP uses a > > composite RTP transport. > > > > PeerConnection also has one fewer way it needs to manage data channels. > > It now handles SCTP and datagram- or media-transport-based data channels > > the same way. > > > > There are a few leaky abstractions left. For example, PeerConnection > > calls Start() on the SctpTransport at a particular point in negotiation, > > but does not need to call this for other transports. Similarly, PC > > exposes an interface to the SCTP transport directly to the user; there > > is no equivalent for other transports. > > Bug: webrtc:9719 > Change-Id: I64e94b88afb119fdbf5f22750f88c8a084d53937 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/151981 > Reviewed-by: Benjamin Wright <benwright@webrtc.org> > Reviewed-by: Steve Anton <steveanton@webrtc.org> > Commit-Queue: Benjamin Wright <benwright@webrtc.org> > Commit-Queue: Bjorn Mellem <mellem@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#29120} Bug: webrtc:9719 Change-Id: I28481a3de64a3506bc57748106383eeba4ef205c Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/152740 Reviewed-by: Artem Titov <titovartem@webrtc.org> Reviewed-by: Benjamin Wright <benwright@webrtc.org> Reviewed-by: Seth Hampson <shampson@webrtc.org> Commit-Queue: Bjorn Mellem <mellem@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29290}
2019-09-23 14:53:54 -07:00
auto jsep_transport = GetJsepTransportForMid(mid);
if (!jsep_transport) {
return nullptr;
}
return jsep_transport->SctpTransport();
}
void JsepTransportController::SetIceConfig(const cricket::IceConfig& config) {
Reduce thread hops in StatsCollector and fix incorrect variable access. StatsCollector::ExtractSessionInfo was run fully on the signaling thread and several calls were being made to methods that need to run on the network thread. Additionally, BaseChannel::transport_name() was being read directly on the signaling thread (needs to be read on the network thread). So with shifting the work that needs to happen on the network thread over to that thread, we now also grab the transport name there and use the name with the work that still needs to happen on the signaling thread. These changes allow us to remove Invoke<>() calls to the network thread from callback functions implemented in PeerConnection: * GetPooledCandidateStats * GetTransportNamesByMid * GetTransportStatsByNames * Also adding a correctness thread check to: * GetLocalCertificate * GetRemoteSSLCertChain Because PeerConnection now has a way of knowing when things are or have been uninitialized on the network thread, all of these functions can exit early without doing throw away work. Additionally removing thread hops that aren't needed anymore from JsepTransportController. Using the RTC_LOG_THREAD_BLOCK_COUNT() macro in GetStats, the number of Invokes (when >1), goes down by 3. Typically from 8->5, 7->4, 6->3. Bug: webrtc:11687 Change-Id: I06ab25eab301e192e99076d7891444bcb61b491f Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214135 Commit-Queue: Tommi <tommi@webrtc.org> Reviewed-by: Danil Chapovalov <danilchap@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33656}
2021-04-08 15:15:28 +02:00
RTC_DCHECK_RUN_ON(network_thread_);
ice_config_ = config;
for (auto& dtls : GetDtlsTransports()) {
dtls->ice_transport()->SetIceConfig(ice_config_);
}
}
void JsepTransportController::SetNeedsIceRestartFlag() {
RTC_DCHECK_RUN_ON(network_thread_);
for (auto& transport : transports_.Transports()) {
transport->SetNeedsIceRestartFlag();
}
}
bool JsepTransportController::NeedsIceRestart(
const std::string& transport_name) const {
RTC_DCHECK_RUN_ON(network_thread_);
const cricket::JsepTransport* transport =
GetJsepTransportByName(transport_name);
if (!transport) {
return false;
}
return transport->needs_ice_restart();
}
absl::optional<rtc::SSLRole> JsepTransportController::GetDtlsRole(
const std::string& mid) const {
Reland "Fix unsynchronized access to mid_to_transport_ in JsepTransportController" This reverts commit 6b143c1c0686519bc9d73223c1350cee286c8d78. Reason for revert: Relanding with updated expectations for SctpTransport::Information based on TransceiverStateSurfacer in Chromium. Original change's description: > Revert "Fix unsynchronized access to mid_to_transport_ in JsepTransportController" > > This reverts commit 6cd405850467683cf10d05028ea0f644a68a91a4. > > Reason for revert: Breaks WebRTC Chromium FYI Bots > > First failure: > https://ci.chromium.org/p/chromium/builders/webrtc.fyi/WebRTC%20Chromium%20FYI%20Android%20Tests%20%28dbg%29%20%28L%20Nexus5%29/1925 > > Failed tests: > WebRtcDataBrowserTest.CallWithSctpDataAndMedia > WebRtcDataBrowserTest.CallWithSctpDataOnly > > Original change's description: > > Fix unsynchronized access to mid_to_transport_ in JsepTransportController > > > > * Added several thread checks to JTC to help with programmer errors. > > * Avoid a few Invokes() to the network thread here and there such > > as for fetching sctp transport name for getStats(). The transport > > name is now cached when it changes on the network thread. > > * JsepTransportController instances now get deleted on the network > > thread rather than on the signaling thread + issuing an Invoke() > > in the dtor. > > * Moved some thread hops from JTC over to PC which is where the problem > > exists and also (imho) makes it easier to see where hops happen in > > the PC code. > > * The sctp transport is now started asynchronously when we push down the > > media description. > > * PeerConnection proxy calls GetSctpTransport directly on the network > > thread instead of to the signaling thread + blocking on the network > > thread. > > * The above changes simplified things for webrtc::SctpTransport which > > allowed for removing locking from that class and delete some code. > > > > Bug: webrtc:9987, webrtc:12445 > > Change-Id: Ic89a9426e314e1b93c81751d4f732f05fa448fbc > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/205620 > > Commit-Queue: Tommi <tommi@webrtc.org> > > Reviewed-by: Harald Alvestrand <hta@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#33191} > > TBR=tommi@webrtc.org,hta@webrtc.org > > Change-Id: I7b2913d5133807589461105cf07eff3e9bb7157e > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:9987 > Bug: webrtc:12445 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206466 > Reviewed-by: Guido Urdaneta <guidou@webrtc.org> > Commit-Queue: Guido Urdaneta <guidou@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#33204} TBR=tommi@webrtc.org,hta@webrtc.org,guidou@webrtc.org # Not skipping CQ checks because this is a reland. Bug: webrtc:9987 Bug: webrtc:12445 Change-Id: Icb205cbac493ed3b881d71ea3af4fb9018701bf4 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206560 Reviewed-by: Tommi <tommi@webrtc.org> Reviewed-by: Guido Urdaneta <guidou@webrtc.org> Commit-Queue: Tommi <tommi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33219}
2021-02-10 13:05:44 +01:00
// TODO(tommi): Remove this hop. Currently it's called from the signaling
// thread during negotiations, potentially multiple times.
// WebRtcSessionDescriptionFactory::InternalCreateAnswer is one example.
if (!network_thread_->IsCurrent()) {
return network_thread_->BlockingCall([&] { return GetDtlsRole(mid); });
}
Reland "Fix unsynchronized access to mid_to_transport_ in JsepTransportController" This reverts commit 6b143c1c0686519bc9d73223c1350cee286c8d78. Reason for revert: Relanding with updated expectations for SctpTransport::Information based on TransceiverStateSurfacer in Chromium. Original change's description: > Revert "Fix unsynchronized access to mid_to_transport_ in JsepTransportController" > > This reverts commit 6cd405850467683cf10d05028ea0f644a68a91a4. > > Reason for revert: Breaks WebRTC Chromium FYI Bots > > First failure: > https://ci.chromium.org/p/chromium/builders/webrtc.fyi/WebRTC%20Chromium%20FYI%20Android%20Tests%20%28dbg%29%20%28L%20Nexus5%29/1925 > > Failed tests: > WebRtcDataBrowserTest.CallWithSctpDataAndMedia > WebRtcDataBrowserTest.CallWithSctpDataOnly > > Original change's description: > > Fix unsynchronized access to mid_to_transport_ in JsepTransportController > > > > * Added several thread checks to JTC to help with programmer errors. > > * Avoid a few Invokes() to the network thread here and there such > > as for fetching sctp transport name for getStats(). The transport > > name is now cached when it changes on the network thread. > > * JsepTransportController instances now get deleted on the network > > thread rather than on the signaling thread + issuing an Invoke() > > in the dtor. > > * Moved some thread hops from JTC over to PC which is where the problem > > exists and also (imho) makes it easier to see where hops happen in > > the PC code. > > * The sctp transport is now started asynchronously when we push down the > > media description. > > * PeerConnection proxy calls GetSctpTransport directly on the network > > thread instead of to the signaling thread + blocking on the network > > thread. > > * The above changes simplified things for webrtc::SctpTransport which > > allowed for removing locking from that class and delete some code. > > > > Bug: webrtc:9987, webrtc:12445 > > Change-Id: Ic89a9426e314e1b93c81751d4f732f05fa448fbc > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/205620 > > Commit-Queue: Tommi <tommi@webrtc.org> > > Reviewed-by: Harald Alvestrand <hta@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#33191} > > TBR=tommi@webrtc.org,hta@webrtc.org > > Change-Id: I7b2913d5133807589461105cf07eff3e9bb7157e > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:9987 > Bug: webrtc:12445 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206466 > Reviewed-by: Guido Urdaneta <guidou@webrtc.org> > Commit-Queue: Guido Urdaneta <guidou@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#33204} TBR=tommi@webrtc.org,hta@webrtc.org,guidou@webrtc.org # Not skipping CQ checks because this is a reland. Bug: webrtc:9987 Bug: webrtc:12445 Change-Id: Icb205cbac493ed3b881d71ea3af4fb9018701bf4 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206560 Reviewed-by: Tommi <tommi@webrtc.org> Reviewed-by: Guido Urdaneta <guidou@webrtc.org> Commit-Queue: Tommi <tommi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33219}
2021-02-10 13:05:44 +01:00
RTC_DCHECK_RUN_ON(network_thread_);
const cricket::JsepTransport* t = GetJsepTransportForMid(mid);
if (!t) {
return absl::optional<rtc::SSLRole>();
}
return t->GetDtlsRole();
}
bool JsepTransportController::SetLocalCertificate(
const rtc::scoped_refptr<rtc::RTCCertificate>& certificate) {
if (!network_thread_->IsCurrent()) {
return network_thread_->BlockingCall(
[&] { return SetLocalCertificate(certificate); });
}
RTC_DCHECK_RUN_ON(network_thread_);
// Can't change a certificate, or set a null certificate.
if (certificate_ || !certificate) {
return false;
}
certificate_ = certificate;
// Set certificate for JsepTransport, which verifies it matches the
// fingerprint in SDP, and DTLS transport.
// Fallback from DTLS to SDES is not supported.
for (auto& transport : transports_.Transports()) {
transport->SetLocalCertificate(certificate_);
}
for (auto& dtls : GetDtlsTransports()) {
bool set_cert_success = dtls->SetLocalCertificate(certificate_);
RTC_DCHECK(set_cert_success);
}
return true;
}
rtc::scoped_refptr<rtc::RTCCertificate>
JsepTransportController::GetLocalCertificate(
const std::string& transport_name) const {
RTC_DCHECK_RUN_ON(network_thread_);
const cricket::JsepTransport* t = GetJsepTransportByName(transport_name);
if (!t) {
return nullptr;
}
return t->GetLocalCertificate();
}
std::unique_ptr<rtc::SSLCertChain>
JsepTransportController::GetRemoteSSLCertChain(
const std::string& transport_name) const {
RTC_DCHECK_RUN_ON(network_thread_);
// Get the certificate from the RTP transport's DTLS handshake. Should be
// identical to the RTCP transport's, since they were given the same remote
// fingerprint.
auto jsep_transport = GetJsepTransportByName(transport_name);
if (!jsep_transport) {
return nullptr;
}
auto dtls = jsep_transport->rtp_dtls_transport();
if (!dtls) {
return nullptr;
}
return dtls->GetRemoteSSLCertChain();
}
void JsepTransportController::MaybeStartGathering() {
if (!network_thread_->IsCurrent()) {
network_thread_->BlockingCall([&] { MaybeStartGathering(); });
return;
}
for (auto& dtls : GetDtlsTransports()) {
dtls->ice_transport()->MaybeStartGathering();
}
}
RTCError JsepTransportController::AddRemoteCandidates(
const std::string& transport_name,
const cricket::Candidates& candidates) {
RTC_DCHECK_RUN_ON(network_thread_);
RTC_DCHECK(VerifyCandidates(candidates).ok());
auto jsep_transport = GetJsepTransportByName(transport_name);
if (!jsep_transport) {
RTC_LOG(LS_WARNING) << "Not adding candidate because the JsepTransport "
"doesn't exist. Ignore it.";
return RTCError::OK();
}
return jsep_transport->AddRemoteCandidates(candidates);
}
RTCError JsepTransportController::RemoveRemoteCandidates(
const cricket::Candidates& candidates) {
if (!network_thread_->IsCurrent()) {
return network_thread_->BlockingCall(
[&] { return RemoveRemoteCandidates(candidates); });
}
RTC_DCHECK_RUN_ON(network_thread_);
// Verify each candidate before passing down to the transport layer.
RTCError error = VerifyCandidates(candidates);
if (!error.ok()) {
return error;
}
std::map<std::string, cricket::Candidates> candidates_by_transport_name;
for (const cricket::Candidate& cand : candidates) {
if (!cand.transport_name().empty()) {
candidates_by_transport_name[cand.transport_name()].push_back(cand);
} else {
RTC_LOG(LS_ERROR) << "Not removing candidate because it does not have a "
"transport name set: "
<< cand.ToSensitiveString();
}
}
for (const auto& kv : candidates_by_transport_name) {
const std::string& transport_name = kv.first;
const cricket::Candidates& candidates = kv.second;
cricket::JsepTransport* jsep_transport =
GetJsepTransportByName(transport_name);
if (!jsep_transport) {
RTC_LOG(LS_WARNING)
<< "Not removing candidate because the JsepTransport doesn't exist.";
continue;
}
for (const cricket::Candidate& candidate : candidates) {
cricket::DtlsTransportInternal* dtls =
candidate.component() == cricket::ICE_CANDIDATE_COMPONENT_RTP
? jsep_transport->rtp_dtls_transport()
: jsep_transport->rtcp_dtls_transport();
if (dtls) {
dtls->ice_transport()->RemoveRemoteCandidate(candidate);
}
}
}
return RTCError::OK();
}
bool JsepTransportController::GetStats(const std::string& transport_name,
cricket::TransportStats* stats) {
RTC_DCHECK_RUN_ON(network_thread_);
cricket::JsepTransport* transport = GetJsepTransportByName(transport_name);
if (!transport) {
return false;
}
return transport->GetStats(stats);
}
void JsepTransportController::SetActiveResetSrtpParams(
bool active_reset_srtp_params) {
if (!network_thread_->IsCurrent()) {
network_thread_->BlockingCall(
[=] { SetActiveResetSrtpParams(active_reset_srtp_params); });
return;
}
RTC_DCHECK_RUN_ON(network_thread_);
RTC_LOG(LS_INFO)
<< "Updating the active_reset_srtp_params for JsepTransportController: "
<< active_reset_srtp_params;
active_reset_srtp_params_ = active_reset_srtp_params;
for (auto& transport : transports_.Transports()) {
transport->SetActiveResetSrtpParams(active_reset_srtp_params);
}
}
Reland "Fix bug where we assume new m= sections will always be bundled." This is a reland of commit 704a834f685eb96c9fcf891ca345557bef4d138a, after it was reverted in order to merge a CL to M93. Original change's description: > Fix bug where we assume new m= sections will always be bundled. > > A recent change [1] assumes that all new m= sections will share the > first BUNDLE group (if one already exists), which avoids generating > ICE candidates that are ultimately unnecessary. This is fine for JSEP > endpoints, but it breaks the following scenarios for non-JSEP endpoints: > > * Remote offer adding a new m= section that's not part of any BUNDLE > group. > * Remote offer adding an m= section to the second BUNDLE group. > > The latter is specifically problematic for any application that wants > to bundle all audio streams in one group and all video streams in > another group when using Unified Plan SDP, to replicate the behavior of > using Plan B without bundling. It may try to add a video stream only > for WebRTC to bundle it with audio. > > This is fixed by doing some minor re-factoring, having BundleManager > update the bundle groups at offer time. > > Also: > * Added some additional validation for multiple bundle groups in a > subsequent offer, since that now becomes relevant. > * Improved rollback support, because now rolling back an offer may need > to not only remove mid->transport mappings but alter them. > > [1]: https://webrtc-review.googlesource.com/c/src/+/221601 > > Bug: webrtc:12906, webrtc:12999 > Change-Id: I4c6e7020c0be33a782d3608dee88e4e2fceb1be1 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/225642 > Reviewed-by: Harald Alvestrand <hta@webrtc.org> > Reviewed-by: Henrik Boström <hbos@webrtc.org> > Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#34544} Bug: webrtc:12906, webrtc:12999 Change-Id: Id6acab2e2d7430c65f4b6a1d7372388a70cc18ab Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/228465 Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/master@{#34728}
2021-08-11 14:56:38 -07:00
RTCError JsepTransportController::RollbackTransports() {
if (!network_thread_->IsCurrent()) {
return network_thread_->BlockingCall([=] { return RollbackTransports(); });
}
RTC_DCHECK_RUN_ON(network_thread_);
Reland "Fix bug where we assume new m= sections will always be bundled." This is a reland of commit 704a834f685eb96c9fcf891ca345557bef4d138a, after it was reverted in order to merge a CL to M93. Original change's description: > Fix bug where we assume new m= sections will always be bundled. > > A recent change [1] assumes that all new m= sections will share the > first BUNDLE group (if one already exists), which avoids generating > ICE candidates that are ultimately unnecessary. This is fine for JSEP > endpoints, but it breaks the following scenarios for non-JSEP endpoints: > > * Remote offer adding a new m= section that's not part of any BUNDLE > group. > * Remote offer adding an m= section to the second BUNDLE group. > > The latter is specifically problematic for any application that wants > to bundle all audio streams in one group and all video streams in > another group when using Unified Plan SDP, to replicate the behavior of > using Plan B without bundling. It may try to add a video stream only > for WebRTC to bundle it with audio. > > This is fixed by doing some minor re-factoring, having BundleManager > update the bundle groups at offer time. > > Also: > * Added some additional validation for multiple bundle groups in a > subsequent offer, since that now becomes relevant. > * Improved rollback support, because now rolling back an offer may need > to not only remove mid->transport mappings but alter them. > > [1]: https://webrtc-review.googlesource.com/c/src/+/221601 > > Bug: webrtc:12906, webrtc:12999 > Change-Id: I4c6e7020c0be33a782d3608dee88e4e2fceb1be1 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/225642 > Reviewed-by: Harald Alvestrand <hta@webrtc.org> > Reviewed-by: Henrik Boström <hbos@webrtc.org> > Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#34544} Bug: webrtc:12906, webrtc:12999 Change-Id: Id6acab2e2d7430c65f4b6a1d7372388a70cc18ab Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/228465 Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/master@{#34728}
2021-08-11 14:56:38 -07:00
bundles_.Rollback();
if (!transports_.RollbackTransports()) {
LOG_AND_RETURN_ERROR(RTCErrorType::INTERNAL_ERROR,
"Failed to roll back transport state.");
}
return RTCError::OK();
}
rtc::scoped_refptr<webrtc::IceTransportInterface>
JsepTransportController::CreateIceTransport(const std::string& transport_name,
bool rtcp) {
int component = rtcp ? cricket::ICE_CANDIDATE_COMPONENT_RTCP
: cricket::ICE_CANDIDATE_COMPONENT_RTP;
IceTransportInit init;
init.set_port_allocator(port_allocator_);
Reland "Use the new DNS resolver API in PeerConnection" This reverts commit 5a40b3710545edfd8a634341df3de26f57d79281. Reason for revert: Fixed the bug and ran layout tests. Original change's description: > Revert "Use the new DNS resolver API in PeerConnection" > > This reverts commit acf8ccb3c9f001b0ed749aca52b2d436d66f9586. > > Reason for revert: Speculative revert for https://ci.chromium.org/ui/p/chromium/builders/try/win10_chromium_x64_rel_ng/b8851745102358680592/overview. > > Original change's description: > > Use the new DNS resolver API in PeerConnection > > > > Bug: webrtc:12598 > > Change-Id: I5a14058e7f28c993ed927749df7357c715ba83fb > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/212961 > > Reviewed-by: Niels Moller <nisse@webrtc.org> > > Commit-Queue: Harald Alvestrand <hta@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#33561} > > # Not skipping CQ checks because original CL landed > 1 day ago. > > TBR=hta@webrtc.org > > Bug: webrtc:12598 > Change-Id: Idc9853cb569849c49052f9cbd865614710fff979 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/213188 > Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> > Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#33591} # Not skipping CQ checks because original CL landed > 1 day ago. Bug: webrtc:12598 Change-Id: Ief7867f2f23de66504877cdab1b23a11df2d5de4 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214120 Commit-Queue: Harald Alvestrand <hta@webrtc.org> Reviewed-by: Tommi <tommi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33647}
2021-04-08 07:25:04 +00:00
init.set_async_dns_resolver_factory(async_dns_resolver_factory_);
init.set_event_log(config_.event_log);
init.set_field_trials(config_.field_trials);
return config_.ice_transport_factory->CreateIceTransport(
transport_name, component, std::move(init));
}
std::unique_ptr<cricket::DtlsTransportInternal>
JsepTransportController::CreateDtlsTransport(
const cricket::ContentInfo& content_info,
cricket::IceTransportInternal* ice) {
RTC_DCHECK_RUN_ON(network_thread_);
std::unique_ptr<cricket::DtlsTransportInternal> dtls;
if (config_.dtls_transport_factory) {
dtls = config_.dtls_transport_factory->CreateDtlsTransport(
ice, config_.crypto_options, config_.ssl_max_version);
} else {
Use std::make_unique instead of absl::make_unique. WebRTC is now using C++14 so there is no need to use the Abseil version of std::make_unique. This CL has been created with the following steps: git grep -l absl::make_unique | sort | uniq > /tmp/make_unique.txt git grep -l absl::WrapUnique | sort | uniq > /tmp/wrap_unique.txt git grep -l "#include <memory>" | sort | uniq > /tmp/memory.txt diff --new-line-format="" --unchanged-line-format="" \ /tmp/make_unique.txt /tmp/wrap_unique.txt | sort | \ uniq > /tmp/only_make_unique.txt diff --new-line-format="" --unchanged-line-format="" \ /tmp/only_make_unique.txt /tmp/memory.txt | \ xargs grep -l "absl/memory" > /tmp/add-memory.txt git grep -l "\babsl::make_unique\b" | \ xargs sed -i "s/\babsl::make_unique\b/std::make_unique/g" git checkout PRESUBMIT.py abseil-in-webrtc.md cat /tmp/add-memory.txt | \ xargs sed -i \ 's/#include "absl\/memory\/memory.h"/#include <memory>/g' git cl format # Manual fix order of the new inserted #include <memory> cat /tmp/only_make_unique | xargs grep -l "#include <memory>" | \ xargs sed -i '/#include "absl\/memory\/memory.h"/d' git ls-files | grep BUILD.gn | \ xargs sed -i '/\/\/third_party\/abseil-cpp\/absl\/memory/d' python tools_webrtc/gn_check_autofix.py \ -m tryserver.webrtc -b linux_rel # Repead the gn_check_autofix step for other platforms git ls-files | grep BUILD.gn | \ xargs sed -i 's/absl\/memory:memory/absl\/memory/g' git cl format Bug: webrtc:10945 Change-Id: I3fe28ea80f4dd3ba3cf28effd151d5e1f19aff89 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/153221 Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Alessio Bazzica <alessiob@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29209}
2019-09-17 17:06:18 +02:00
dtls = std::make_unique<cricket::DtlsTransport>(ice, config_.crypto_options,
config_.event_log,
config_.ssl_max_version);
}
RTC_DCHECK(dtls);
dtls->ice_transport()->SetIceRole(ice_role_);
dtls->ice_transport()->SetIceTiebreaker(ice_tiebreaker_);
dtls->ice_transport()->SetIceConfig(ice_config_);
if (certificate_) {
bool set_cert_success = dtls->SetLocalCertificate(certificate_);
RTC_DCHECK(set_cert_success);
}
// Connect to signals offered by the DTLS and ICE transport.
dtls->SignalWritableState.connect(
this, &JsepTransportController::OnTransportWritableState_n);
dtls->SignalReceivingState.connect(
this, &JsepTransportController::OnTransportReceivingState_n);
dtls->ice_transport()->SignalGatheringState.connect(
this, &JsepTransportController::OnTransportGatheringState_n);
dtls->ice_transport()->SignalCandidateGathered.connect(
this, &JsepTransportController::OnTransportCandidateGathered_n);
dtls->ice_transport()->SignalCandidateError.connect(
this, &JsepTransportController::OnTransportCandidateError_n);
dtls->ice_transport()->SignalCandidatesRemoved.connect(
this, &JsepTransportController::OnTransportCandidatesRemoved_n);
dtls->ice_transport()->SignalRoleConflict.connect(
this, &JsepTransportController::OnTransportRoleConflict_n);
dtls->ice_transport()->SignalStateChanged.connect(
this, &JsepTransportController::OnTransportStateChanged_n);
dtls->ice_transport()->SignalIceTransportStateChanged.connect(
this, &JsepTransportController::OnTransportStateChanged_n);
dtls->ice_transport()->SignalCandidatePairChanged.connect(
this, &JsepTransportController::OnTransportCandidatePairChanged_n);
dtls->SubscribeDtlsHandshakeError(
[this](rtc::SSLHandshakeError error) { OnDtlsHandshakeError(error); });
return dtls;
}
std::unique_ptr<webrtc::RtpTransport>
JsepTransportController::CreateUnencryptedRtpTransport(
const std::string& transport_name,
rtc::PacketTransportInternal* rtp_packet_transport,
rtc::PacketTransportInternal* rtcp_packet_transport) {
RTC_DCHECK_RUN_ON(network_thread_);
auto unencrypted_rtp_transport =
Use std::make_unique instead of absl::make_unique. WebRTC is now using C++14 so there is no need to use the Abseil version of std::make_unique. This CL has been created with the following steps: git grep -l absl::make_unique | sort | uniq > /tmp/make_unique.txt git grep -l absl::WrapUnique | sort | uniq > /tmp/wrap_unique.txt git grep -l "#include <memory>" | sort | uniq > /tmp/memory.txt diff --new-line-format="" --unchanged-line-format="" \ /tmp/make_unique.txt /tmp/wrap_unique.txt | sort | \ uniq > /tmp/only_make_unique.txt diff --new-line-format="" --unchanged-line-format="" \ /tmp/only_make_unique.txt /tmp/memory.txt | \ xargs grep -l "absl/memory" > /tmp/add-memory.txt git grep -l "\babsl::make_unique\b" | \ xargs sed -i "s/\babsl::make_unique\b/std::make_unique/g" git checkout PRESUBMIT.py abseil-in-webrtc.md cat /tmp/add-memory.txt | \ xargs sed -i \ 's/#include "absl\/memory\/memory.h"/#include <memory>/g' git cl format # Manual fix order of the new inserted #include <memory> cat /tmp/only_make_unique | xargs grep -l "#include <memory>" | \ xargs sed -i '/#include "absl\/memory\/memory.h"/d' git ls-files | grep BUILD.gn | \ xargs sed -i '/\/\/third_party\/abseil-cpp\/absl\/memory/d' python tools_webrtc/gn_check_autofix.py \ -m tryserver.webrtc -b linux_rel # Repead the gn_check_autofix step for other platforms git ls-files | grep BUILD.gn | \ xargs sed -i 's/absl\/memory:memory/absl\/memory/g' git cl format Bug: webrtc:10945 Change-Id: I3fe28ea80f4dd3ba3cf28effd151d5e1f19aff89 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/153221 Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Alessio Bazzica <alessiob@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29209}
2019-09-17 17:06:18 +02:00
std::make_unique<RtpTransport>(rtcp_packet_transport == nullptr);
unencrypted_rtp_transport->SetRtpPacketTransport(rtp_packet_transport);
if (rtcp_packet_transport) {
unencrypted_rtp_transport->SetRtcpPacketTransport(rtcp_packet_transport);
}
return unencrypted_rtp_transport;
}
std::unique_ptr<webrtc::SrtpTransport>
JsepTransportController::CreateSdesTransport(
const std::string& transport_name,
cricket::DtlsTransportInternal* rtp_dtls_transport,
cricket::DtlsTransportInternal* rtcp_dtls_transport) {
RTC_DCHECK_RUN_ON(network_thread_);
auto srtp_transport = std::make_unique<webrtc::SrtpTransport>(
rtcp_dtls_transport == nullptr, *config_.field_trials);
RTC_DCHECK(rtp_dtls_transport);
srtp_transport->SetRtpPacketTransport(rtp_dtls_transport);
if (rtcp_dtls_transport) {
srtp_transport->SetRtcpPacketTransport(rtcp_dtls_transport);
}
if (config_.enable_external_auth) {
srtp_transport->EnableExternalAuth();
}
return srtp_transport;
}
std::unique_ptr<webrtc::DtlsSrtpTransport>
JsepTransportController::CreateDtlsSrtpTransport(
const std::string& transport_name,
cricket::DtlsTransportInternal* rtp_dtls_transport,
cricket::DtlsTransportInternal* rtcp_dtls_transport) {
RTC_DCHECK_RUN_ON(network_thread_);
Use std::make_unique instead of absl::make_unique. WebRTC is now using C++14 so there is no need to use the Abseil version of std::make_unique. This CL has been created with the following steps: git grep -l absl::make_unique | sort | uniq > /tmp/make_unique.txt git grep -l absl::WrapUnique | sort | uniq > /tmp/wrap_unique.txt git grep -l "#include <memory>" | sort | uniq > /tmp/memory.txt diff --new-line-format="" --unchanged-line-format="" \ /tmp/make_unique.txt /tmp/wrap_unique.txt | sort | \ uniq > /tmp/only_make_unique.txt diff --new-line-format="" --unchanged-line-format="" \ /tmp/only_make_unique.txt /tmp/memory.txt | \ xargs grep -l "absl/memory" > /tmp/add-memory.txt git grep -l "\babsl::make_unique\b" | \ xargs sed -i "s/\babsl::make_unique\b/std::make_unique/g" git checkout PRESUBMIT.py abseil-in-webrtc.md cat /tmp/add-memory.txt | \ xargs sed -i \ 's/#include "absl\/memory\/memory.h"/#include <memory>/g' git cl format # Manual fix order of the new inserted #include <memory> cat /tmp/only_make_unique | xargs grep -l "#include <memory>" | \ xargs sed -i '/#include "absl\/memory\/memory.h"/d' git ls-files | grep BUILD.gn | \ xargs sed -i '/\/\/third_party\/abseil-cpp\/absl\/memory/d' python tools_webrtc/gn_check_autofix.py \ -m tryserver.webrtc -b linux_rel # Repead the gn_check_autofix step for other platforms git ls-files | grep BUILD.gn | \ xargs sed -i 's/absl\/memory:memory/absl\/memory/g' git cl format Bug: webrtc:10945 Change-Id: I3fe28ea80f4dd3ba3cf28effd151d5e1f19aff89 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/153221 Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Alessio Bazzica <alessiob@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29209}
2019-09-17 17:06:18 +02:00
auto dtls_srtp_transport = std::make_unique<webrtc::DtlsSrtpTransport>(
rtcp_dtls_transport == nullptr, *config_.field_trials);
if (config_.enable_external_auth) {
dtls_srtp_transport->EnableExternalAuth();
}
dtls_srtp_transport->SetDtlsTransports(rtp_dtls_transport,
rtcp_dtls_transport);
dtls_srtp_transport->SetActiveResetSrtpParams(active_reset_srtp_params_);
// Capturing this in the callback because JsepTransportController will always
// outlive the DtlsSrtpTransport.
dtls_srtp_transport->SetOnDtlsStateChange([this]() {
RTC_DCHECK_RUN_ON(this->network_thread_);
this->UpdateAggregateStates_n();
});
return dtls_srtp_transport;
}
std::vector<cricket::DtlsTransportInternal*>
JsepTransportController::GetDtlsTransports() {
RTC_DCHECK_RUN_ON(network_thread_);
std::vector<cricket::DtlsTransportInternal*> dtls_transports;
for (auto jsep_transport : transports_.Transports()) {
RTC_DCHECK(jsep_transport);
if (jsep_transport->rtp_dtls_transport()) {
dtls_transports.push_back(jsep_transport->rtp_dtls_transport());
}
if (jsep_transport->rtcp_dtls_transport()) {
dtls_transports.push_back(jsep_transport->rtcp_dtls_transport());
}
}
return dtls_transports;
}
Reland "Fix bug where we assume new m= sections will always be bundled." This is a reland of commit 704a834f685eb96c9fcf891ca345557bef4d138a, after it was reverted in order to merge a CL to M93. Original change's description: > Fix bug where we assume new m= sections will always be bundled. > > A recent change [1] assumes that all new m= sections will share the > first BUNDLE group (if one already exists), which avoids generating > ICE candidates that are ultimately unnecessary. This is fine for JSEP > endpoints, but it breaks the following scenarios for non-JSEP endpoints: > > * Remote offer adding a new m= section that's not part of any BUNDLE > group. > * Remote offer adding an m= section to the second BUNDLE group. > > The latter is specifically problematic for any application that wants > to bundle all audio streams in one group and all video streams in > another group when using Unified Plan SDP, to replicate the behavior of > using Plan B without bundling. It may try to add a video stream only > for WebRTC to bundle it with audio. > > This is fixed by doing some minor re-factoring, having BundleManager > update the bundle groups at offer time. > > Also: > * Added some additional validation for multiple bundle groups in a > subsequent offer, since that now becomes relevant. > * Improved rollback support, because now rolling back an offer may need > to not only remove mid->transport mappings but alter them. > > [1]: https://webrtc-review.googlesource.com/c/src/+/221601 > > Bug: webrtc:12906, webrtc:12999 > Change-Id: I4c6e7020c0be33a782d3608dee88e4e2fceb1be1 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/225642 > Reviewed-by: Harald Alvestrand <hta@webrtc.org> > Reviewed-by: Henrik Boström <hbos@webrtc.org> > Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#34544} Bug: webrtc:12906, webrtc:12999 Change-Id: Id6acab2e2d7430c65f4b6a1d7372388a70cc18ab Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/228465 Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/master@{#34728}
2021-08-11 14:56:38 -07:00
std::vector<cricket::DtlsTransportInternal*>
JsepTransportController::GetActiveDtlsTransports() {
RTC_DCHECK_RUN_ON(network_thread_);
std::vector<cricket::DtlsTransportInternal*> dtls_transports;
for (auto jsep_transport : transports_.ActiveTransports()) {
RTC_DCHECK(jsep_transport);
if (jsep_transport->rtp_dtls_transport()) {
dtls_transports.push_back(jsep_transport->rtp_dtls_transport());
}
if (jsep_transport->rtcp_dtls_transport()) {
dtls_transports.push_back(jsep_transport->rtcp_dtls_transport());
}
}
return dtls_transports;
}
RTCError JsepTransportController::ApplyDescription_n(
bool local,
SdpType type,
const cricket::SessionDescription* description) {
TRACE_EVENT0("webrtc", "JsepTransportController::ApplyDescription_n");
RTC_DCHECK(description);
if (local) {
local_desc_ = description;
} else {
remote_desc_ = description;
}
RTCError error;
[Unified Plan] Support multiple BUNDLE groups. In this CL, JsepTransportController and MediaSessionDescriptionFactory are updated not to assume that there only exists at most a single BUNDLE group but a list of N groups. This makes it possible to create multiple BUNDLE groups by having multiple "a=group:BUNDLE" lines in the SDP. This makes it possible to have some m= sections in one group and some other m= sections in another group. For example, you could group all audio m= sections in one group and all video m= sections in another group. This enables "send all audio tracks on one transport and all video tracks on another transport" in Unified Plan. This is something that was possible in Plan B because all ssrcs in the same m= section were implicitly bundled together forming a group of audio m= section and video m= section (even without use of the BUNDLE tag). PeerConnection will never create multiple BUNDLE groups by default, but upon setting SDP with multiple BUNDLE groups the PeerConnection will accept them if configured to accept BUNDLE. This makes it possible to accept an SFU's BUNDLE offer without having to SDP munge the answer. C++ unit tests are added. This fix has also been verified manually on: https://jsfiddle.net/henbos/to89L6ce/43/ Without fix: 0+2 get bundled, 1+3 don't get bundled. With fix: 0+2 get bundled in first group, 1+3 get bundled in second group. Bug: webrtc:10208 Change-Id: Iaf451fa5459c484730c8018274166ef154b19af8 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214487 Reviewed-by: Taylor <deadbeef@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33838}
2021-04-26 21:04:26 +02:00
error = ValidateAndMaybeUpdateBundleGroups(local, type, description);
if (!error.ok()) {
return error;
}
[Unified Plan] Support multiple BUNDLE groups. In this CL, JsepTransportController and MediaSessionDescriptionFactory are updated not to assume that there only exists at most a single BUNDLE group but a list of N groups. This makes it possible to create multiple BUNDLE groups by having multiple "a=group:BUNDLE" lines in the SDP. This makes it possible to have some m= sections in one group and some other m= sections in another group. For example, you could group all audio m= sections in one group and all video m= sections in another group. This enables "send all audio tracks on one transport and all video tracks on another transport" in Unified Plan. This is something that was possible in Plan B because all ssrcs in the same m= section were implicitly bundled together forming a group of audio m= section and video m= section (even without use of the BUNDLE tag). PeerConnection will never create multiple BUNDLE groups by default, but upon setting SDP with multiple BUNDLE groups the PeerConnection will accept them if configured to accept BUNDLE. This makes it possible to accept an SFU's BUNDLE offer without having to SDP munge the answer. C++ unit tests are added. This fix has also been verified manually on: https://jsfiddle.net/henbos/to89L6ce/43/ Without fix: 0+2 get bundled, 1+3 don't get bundled. With fix: 0+2 get bundled in first group, 1+3 get bundled in second group. Bug: webrtc:10208 Change-Id: Iaf451fa5459c484730c8018274166ef154b19af8 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214487 Reviewed-by: Taylor <deadbeef@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33838}
2021-04-26 21:04:26 +02:00
std::map<const cricket::ContentGroup*, std::vector<int>>
merged_encrypted_extension_ids_by_bundle;
if (!bundles_.bundle_groups().empty()) {
[Unified Plan] Support multiple BUNDLE groups. In this CL, JsepTransportController and MediaSessionDescriptionFactory are updated not to assume that there only exists at most a single BUNDLE group but a list of N groups. This makes it possible to create multiple BUNDLE groups by having multiple "a=group:BUNDLE" lines in the SDP. This makes it possible to have some m= sections in one group and some other m= sections in another group. For example, you could group all audio m= sections in one group and all video m= sections in another group. This enables "send all audio tracks on one transport and all video tracks on another transport" in Unified Plan. This is something that was possible in Plan B because all ssrcs in the same m= section were implicitly bundled together forming a group of audio m= section and video m= section (even without use of the BUNDLE tag). PeerConnection will never create multiple BUNDLE groups by default, but upon setting SDP with multiple BUNDLE groups the PeerConnection will accept them if configured to accept BUNDLE. This makes it possible to accept an SFU's BUNDLE offer without having to SDP munge the answer. C++ unit tests are added. This fix has also been verified manually on: https://jsfiddle.net/henbos/to89L6ce/43/ Without fix: 0+2 get bundled, 1+3 don't get bundled. With fix: 0+2 get bundled in first group, 1+3 get bundled in second group. Bug: webrtc:10208 Change-Id: Iaf451fa5459c484730c8018274166ef154b19af8 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214487 Reviewed-by: Taylor <deadbeef@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33838}
2021-04-26 21:04:26 +02:00
merged_encrypted_extension_ids_by_bundle =
MergeEncryptedHeaderExtensionIdsForBundles(description);
}
for (const cricket::ContentInfo& content_info : description->contents()) {
[Unified Plan] Support multiple BUNDLE groups. In this CL, JsepTransportController and MediaSessionDescriptionFactory are updated not to assume that there only exists at most a single BUNDLE group but a list of N groups. This makes it possible to create multiple BUNDLE groups by having multiple "a=group:BUNDLE" lines in the SDP. This makes it possible to have some m= sections in one group and some other m= sections in another group. For example, you could group all audio m= sections in one group and all video m= sections in another group. This enables "send all audio tracks on one transport and all video tracks on another transport" in Unified Plan. This is something that was possible in Plan B because all ssrcs in the same m= section were implicitly bundled together forming a group of audio m= section and video m= section (even without use of the BUNDLE tag). PeerConnection will never create multiple BUNDLE groups by default, but upon setting SDP with multiple BUNDLE groups the PeerConnection will accept them if configured to accept BUNDLE. This makes it possible to accept an SFU's BUNDLE offer without having to SDP munge the answer. C++ unit tests are added. This fix has also been verified manually on: https://jsfiddle.net/henbos/to89L6ce/43/ Without fix: 0+2 get bundled, 1+3 don't get bundled. With fix: 0+2 get bundled in first group, 1+3 get bundled in second group. Bug: webrtc:10208 Change-Id: Iaf451fa5459c484730c8018274166ef154b19af8 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214487 Reviewed-by: Taylor <deadbeef@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33838}
2021-04-26 21:04:26 +02:00
// Don't create transports for rejected m-lines and bundled m-lines.
if (content_info.rejected ||
!bundles_.IsFirstMidInGroup(content_info.name)) {
continue;
}
error = MaybeCreateJsepTransport(local, content_info, *description);
if (!error.ok()) {
return error;
}
}
RTC_DCHECK(description->contents().size() ==
description->transport_infos().size());
for (size_t i = 0; i < description->contents().size(); ++i) {
const cricket::ContentInfo& content_info = description->contents()[i];
const cricket::TransportInfo& transport_info =
description->transport_infos()[i];
if (content_info.rejected) {
Reland "Fix bug where we assume new m= sections will always be bundled." This is a reland of commit 704a834f685eb96c9fcf891ca345557bef4d138a, after it was reverted in order to merge a CL to M93. Original change's description: > Fix bug where we assume new m= sections will always be bundled. > > A recent change [1] assumes that all new m= sections will share the > first BUNDLE group (if one already exists), which avoids generating > ICE candidates that are ultimately unnecessary. This is fine for JSEP > endpoints, but it breaks the following scenarios for non-JSEP endpoints: > > * Remote offer adding a new m= section that's not part of any BUNDLE > group. > * Remote offer adding an m= section to the second BUNDLE group. > > The latter is specifically problematic for any application that wants > to bundle all audio streams in one group and all video streams in > another group when using Unified Plan SDP, to replicate the behavior of > using Plan B without bundling. It may try to add a video stream only > for WebRTC to bundle it with audio. > > This is fixed by doing some minor re-factoring, having BundleManager > update the bundle groups at offer time. > > Also: > * Added some additional validation for multiple bundle groups in a > subsequent offer, since that now becomes relevant. > * Improved rollback support, because now rolling back an offer may need > to not only remove mid->transport mappings but alter them. > > [1]: https://webrtc-review.googlesource.com/c/src/+/221601 > > Bug: webrtc:12906, webrtc:12999 > Change-Id: I4c6e7020c0be33a782d3608dee88e4e2fceb1be1 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/225642 > Reviewed-by: Harald Alvestrand <hta@webrtc.org> > Reviewed-by: Henrik Boström <hbos@webrtc.org> > Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#34544} Bug: webrtc:12906, webrtc:12999 Change-Id: Id6acab2e2d7430c65f4b6a1d7372388a70cc18ab Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/228465 Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/master@{#34728}
2021-08-11 14:56:38 -07:00
// This may cause groups to be removed from |bundles_.bundle_groups()|.
HandleRejectedContent(content_info);
continue;
}
[Unified Plan] Support multiple BUNDLE groups. In this CL, JsepTransportController and MediaSessionDescriptionFactory are updated not to assume that there only exists at most a single BUNDLE group but a list of N groups. This makes it possible to create multiple BUNDLE groups by having multiple "a=group:BUNDLE" lines in the SDP. This makes it possible to have some m= sections in one group and some other m= sections in another group. For example, you could group all audio m= sections in one group and all video m= sections in another group. This enables "send all audio tracks on one transport and all video tracks on another transport" in Unified Plan. This is something that was possible in Plan B because all ssrcs in the same m= section were implicitly bundled together forming a group of audio m= section and video m= section (even without use of the BUNDLE tag). PeerConnection will never create multiple BUNDLE groups by default, but upon setting SDP with multiple BUNDLE groups the PeerConnection will accept them if configured to accept BUNDLE. This makes it possible to accept an SFU's BUNDLE offer without having to SDP munge the answer. C++ unit tests are added. This fix has also been verified manually on: https://jsfiddle.net/henbos/to89L6ce/43/ Without fix: 0+2 get bundled, 1+3 don't get bundled. With fix: 0+2 get bundled in first group, 1+3 get bundled in second group. Bug: webrtc:10208 Change-Id: Iaf451fa5459c484730c8018274166ef154b19af8 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214487 Reviewed-by: Taylor <deadbeef@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33838}
2021-04-26 21:04:26 +02:00
const cricket::ContentGroup* established_bundle_group =
bundles_.LookupGroupByMid(content_info.name);
[Unified Plan] Support multiple BUNDLE groups. In this CL, JsepTransportController and MediaSessionDescriptionFactory are updated not to assume that there only exists at most a single BUNDLE group but a list of N groups. This makes it possible to create multiple BUNDLE groups by having multiple "a=group:BUNDLE" lines in the SDP. This makes it possible to have some m= sections in one group and some other m= sections in another group. For example, you could group all audio m= sections in one group and all video m= sections in another group. This enables "send all audio tracks on one transport and all video tracks on another transport" in Unified Plan. This is something that was possible in Plan B because all ssrcs in the same m= section were implicitly bundled together forming a group of audio m= section and video m= section (even without use of the BUNDLE tag). PeerConnection will never create multiple BUNDLE groups by default, but upon setting SDP with multiple BUNDLE groups the PeerConnection will accept them if configured to accept BUNDLE. This makes it possible to accept an SFU's BUNDLE offer without having to SDP munge the answer. C++ unit tests are added. This fix has also been verified manually on: https://jsfiddle.net/henbos/to89L6ce/43/ Without fix: 0+2 get bundled, 1+3 don't get bundled. With fix: 0+2 get bundled in first group, 1+3 get bundled in second group. Bug: webrtc:10208 Change-Id: Iaf451fa5459c484730c8018274166ef154b19af8 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214487 Reviewed-by: Taylor <deadbeef@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33838}
2021-04-26 21:04:26 +02:00
// For bundle members that are not BUNDLE-tagged (not first in the group),
// configure their transport to be the same as the BUNDLE-tagged transport.
if (established_bundle_group &&
content_info.name != *established_bundle_group->FirstContentName()) {
if (!HandleBundledContent(content_info, *established_bundle_group)) {
return RTCError(RTCErrorType::INVALID_PARAMETER,
[Unified Plan] Support multiple BUNDLE groups. In this CL, JsepTransportController and MediaSessionDescriptionFactory are updated not to assume that there only exists at most a single BUNDLE group but a list of N groups. This makes it possible to create multiple BUNDLE groups by having multiple "a=group:BUNDLE" lines in the SDP. This makes it possible to have some m= sections in one group and some other m= sections in another group. For example, you could group all audio m= sections in one group and all video m= sections in another group. This enables "send all audio tracks on one transport and all video tracks on another transport" in Unified Plan. This is something that was possible in Plan B because all ssrcs in the same m= section were implicitly bundled together forming a group of audio m= section and video m= section (even without use of the BUNDLE tag). PeerConnection will never create multiple BUNDLE groups by default, but upon setting SDP with multiple BUNDLE groups the PeerConnection will accept them if configured to accept BUNDLE. This makes it possible to accept an SFU's BUNDLE offer without having to SDP munge the answer. C++ unit tests are added. This fix has also been verified manually on: https://jsfiddle.net/henbos/to89L6ce/43/ Without fix: 0+2 get bundled, 1+3 don't get bundled. With fix: 0+2 get bundled in first group, 1+3 get bundled in second group. Bug: webrtc:10208 Change-Id: Iaf451fa5459c484730c8018274166ef154b19af8 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214487 Reviewed-by: Taylor <deadbeef@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33838}
2021-04-26 21:04:26 +02:00
"Failed to process the bundled m= section with "
"mid='" +
Reland "Added mid to error messages reported during SDP apply." This reverts commit 341434e4da2c193b8842917d73afed6eea3a4332. Reason for revert: another attempt to land with Chromium test updated to accept both error messages by CL: https://chromium-review.googlesource.com/c/chromium/src/+/2228545 Original change's description: > Revert "Added mid to error messages reported during SDP apply." > > This reverts commit d2890e8833796f13c4a1243769be966bebdfcaa7. > > Reason for revert: speculative: WebRtcBrowserTest.NegotiateUnsupportedVideoCodec broken on all FYI bots, example: https://ci.chromium.org/p/chromium/builders/webrtc.fyi/WebRTC%20Chromium%20FYI%20Linux%20Tester/6659 > > Original change's description: > > Added mid to error messages reported during SDP apply. > > > > Bug: webrtc:10139 > > Change-Id: I7462b632e00a2da7b189b63022d30f594700b68a > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176400 > > Reviewed-by: Tommi <tommi@webrtc.org> > > Commit-Queue: Yura Yaroshevich <yura.yaroshevich@gmail.com> > > Cr-Commit-Position: refs/heads/master@{#31421} > > TBR=tommi@webrtc.org,yura.yaroshevich@gmail.com > > Change-Id: I18972815df10e2bd7b914ad82df9596009c2fecc > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:10139 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176418 > Reviewed-by: Olga Sharonova <olka@webrtc.org> > Commit-Queue: Olga Sharonova <olka@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#31425} TBR=tommi@webrtc.org,olka@webrtc.org,yura.yaroshevich@gmail.com # Not skipping CQ checks because this is a reland. Bug: webrtc:10139 Change-Id: I603d3891c43ac396bf0ba98c6de189663235c8af Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176448 Reviewed-by: Tommi <tommi@webrtc.org> Commit-Queue: Yura Yaroshevich <yura.yaroshevich@gmail.com> Cr-Commit-Position: refs/heads/master@{#31445}
2020-06-03 21:15:22 +00:00
content_info.name + "'.");
}
continue;
}
error = ValidateContent(content_info);
if (!error.ok()) {
return error;
}
std::vector<int> extension_ids;
[Unified Plan] Support multiple BUNDLE groups. In this CL, JsepTransportController and MediaSessionDescriptionFactory are updated not to assume that there only exists at most a single BUNDLE group but a list of N groups. This makes it possible to create multiple BUNDLE groups by having multiple "a=group:BUNDLE" lines in the SDP. This makes it possible to have some m= sections in one group and some other m= sections in another group. For example, you could group all audio m= sections in one group and all video m= sections in another group. This enables "send all audio tracks on one transport and all video tracks on another transport" in Unified Plan. This is something that was possible in Plan B because all ssrcs in the same m= section were implicitly bundled together forming a group of audio m= section and video m= section (even without use of the BUNDLE tag). PeerConnection will never create multiple BUNDLE groups by default, but upon setting SDP with multiple BUNDLE groups the PeerConnection will accept them if configured to accept BUNDLE. This makes it possible to accept an SFU's BUNDLE offer without having to SDP munge the answer. C++ unit tests are added. This fix has also been verified manually on: https://jsfiddle.net/henbos/to89L6ce/43/ Without fix: 0+2 get bundled, 1+3 don't get bundled. With fix: 0+2 get bundled in first group, 1+3 get bundled in second group. Bug: webrtc:10208 Change-Id: Iaf451fa5459c484730c8018274166ef154b19af8 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214487 Reviewed-by: Taylor <deadbeef@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33838}
2021-04-26 21:04:26 +02:00
// Is BUNDLE-tagged (first in the group)?
if (established_bundle_group &&
content_info.name == *established_bundle_group->FirstContentName()) {
auto it = merged_encrypted_extension_ids_by_bundle.find(
established_bundle_group);
RTC_DCHECK(it != merged_encrypted_extension_ids_by_bundle.end());
extension_ids = it->second;
} else {
extension_ids = GetEncryptedHeaderExtensionIds(content_info);
}
int rtp_abs_sendtime_extn_id =
GetRtpAbsSendTimeHeaderExtensionId(content_info);
cricket::JsepTransport* transport =
GetJsepTransportForMid(content_info.name);
RTC_DCHECK(transport);
SetIceRole_n(DetermineIceRole(transport, transport_info, type, local));
cricket::JsepTransportDescription jsep_description =
CreateJsepTransportDescription(content_info, transport_info,
extension_ids, rtp_abs_sendtime_extn_id);
if (local) {
error =
transport->SetLocalJsepTransportDescription(jsep_description, type);
} else {
error =
transport->SetRemoteJsepTransportDescription(jsep_description, type);
}
if (!error.ok()) {
Reland "Added mid to error messages reported during SDP apply." This reverts commit 341434e4da2c193b8842917d73afed6eea3a4332. Reason for revert: another attempt to land with Chromium test updated to accept both error messages by CL: https://chromium-review.googlesource.com/c/chromium/src/+/2228545 Original change's description: > Revert "Added mid to error messages reported during SDP apply." > > This reverts commit d2890e8833796f13c4a1243769be966bebdfcaa7. > > Reason for revert: speculative: WebRtcBrowserTest.NegotiateUnsupportedVideoCodec broken on all FYI bots, example: https://ci.chromium.org/p/chromium/builders/webrtc.fyi/WebRTC%20Chromium%20FYI%20Linux%20Tester/6659 > > Original change's description: > > Added mid to error messages reported during SDP apply. > > > > Bug: webrtc:10139 > > Change-Id: I7462b632e00a2da7b189b63022d30f594700b68a > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176400 > > Reviewed-by: Tommi <tommi@webrtc.org> > > Commit-Queue: Yura Yaroshevich <yura.yaroshevich@gmail.com> > > Cr-Commit-Position: refs/heads/master@{#31421} > > TBR=tommi@webrtc.org,yura.yaroshevich@gmail.com > > Change-Id: I18972815df10e2bd7b914ad82df9596009c2fecc > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:10139 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176418 > Reviewed-by: Olga Sharonova <olka@webrtc.org> > Commit-Queue: Olga Sharonova <olka@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#31425} TBR=tommi@webrtc.org,olka@webrtc.org,yura.yaroshevich@gmail.com # Not skipping CQ checks because this is a reland. Bug: webrtc:10139 Change-Id: I603d3891c43ac396bf0ba98c6de189663235c8af Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176448 Reviewed-by: Tommi <tommi@webrtc.org> Commit-Queue: Yura Yaroshevich <yura.yaroshevich@gmail.com> Cr-Commit-Position: refs/heads/master@{#31445}
2020-06-03 21:15:22 +00:00
LOG_AND_RETURN_ERROR(
RTCErrorType::INVALID_PARAMETER,
"Failed to apply the description for m= section with mid='" +
content_info.name + "': " + error.message());
}
}
if (type == SdpType::kAnswer) {
transports_.CommitTransports();
Reland "Fix bug where we assume new m= sections will always be bundled." This is a reland of commit 704a834f685eb96c9fcf891ca345557bef4d138a, after it was reverted in order to merge a CL to M93. Original change's description: > Fix bug where we assume new m= sections will always be bundled. > > A recent change [1] assumes that all new m= sections will share the > first BUNDLE group (if one already exists), which avoids generating > ICE candidates that are ultimately unnecessary. This is fine for JSEP > endpoints, but it breaks the following scenarios for non-JSEP endpoints: > > * Remote offer adding a new m= section that's not part of any BUNDLE > group. > * Remote offer adding an m= section to the second BUNDLE group. > > The latter is specifically problematic for any application that wants > to bundle all audio streams in one group and all video streams in > another group when using Unified Plan SDP, to replicate the behavior of > using Plan B without bundling. It may try to add a video stream only > for WebRTC to bundle it with audio. > > This is fixed by doing some minor re-factoring, having BundleManager > update the bundle groups at offer time. > > Also: > * Added some additional validation for multiple bundle groups in a > subsequent offer, since that now becomes relevant. > * Improved rollback support, because now rolling back an offer may need > to not only remove mid->transport mappings but alter them. > > [1]: https://webrtc-review.googlesource.com/c/src/+/221601 > > Bug: webrtc:12906, webrtc:12999 > Change-Id: I4c6e7020c0be33a782d3608dee88e4e2fceb1be1 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/225642 > Reviewed-by: Harald Alvestrand <hta@webrtc.org> > Reviewed-by: Henrik Boström <hbos@webrtc.org> > Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#34544} Bug: webrtc:12906, webrtc:12999 Change-Id: Id6acab2e2d7430c65f4b6a1d7372388a70cc18ab Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/228465 Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/master@{#34728}
2021-08-11 14:56:38 -07:00
bundles_.Commit();
}
return RTCError::OK();
}
[Unified Plan] Support multiple BUNDLE groups. In this CL, JsepTransportController and MediaSessionDescriptionFactory are updated not to assume that there only exists at most a single BUNDLE group but a list of N groups. This makes it possible to create multiple BUNDLE groups by having multiple "a=group:BUNDLE" lines in the SDP. This makes it possible to have some m= sections in one group and some other m= sections in another group. For example, you could group all audio m= sections in one group and all video m= sections in another group. This enables "send all audio tracks on one transport and all video tracks on another transport" in Unified Plan. This is something that was possible in Plan B because all ssrcs in the same m= section were implicitly bundled together forming a group of audio m= section and video m= section (even without use of the BUNDLE tag). PeerConnection will never create multiple BUNDLE groups by default, but upon setting SDP with multiple BUNDLE groups the PeerConnection will accept them if configured to accept BUNDLE. This makes it possible to accept an SFU's BUNDLE offer without having to SDP munge the answer. C++ unit tests are added. This fix has also been verified manually on: https://jsfiddle.net/henbos/to89L6ce/43/ Without fix: 0+2 get bundled, 1+3 don't get bundled. With fix: 0+2 get bundled in first group, 1+3 get bundled in second group. Bug: webrtc:10208 Change-Id: Iaf451fa5459c484730c8018274166ef154b19af8 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214487 Reviewed-by: Taylor <deadbeef@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33838}
2021-04-26 21:04:26 +02:00
RTCError JsepTransportController::ValidateAndMaybeUpdateBundleGroups(
bool local,
SdpType type,
const cricket::SessionDescription* description) {
RTC_DCHECK(description);
[Unified Plan] Support multiple BUNDLE groups. In this CL, JsepTransportController and MediaSessionDescriptionFactory are updated not to assume that there only exists at most a single BUNDLE group but a list of N groups. This makes it possible to create multiple BUNDLE groups by having multiple "a=group:BUNDLE" lines in the SDP. This makes it possible to have some m= sections in one group and some other m= sections in another group. For example, you could group all audio m= sections in one group and all video m= sections in another group. This enables "send all audio tracks on one transport and all video tracks on another transport" in Unified Plan. This is something that was possible in Plan B because all ssrcs in the same m= section were implicitly bundled together forming a group of audio m= section and video m= section (even without use of the BUNDLE tag). PeerConnection will never create multiple BUNDLE groups by default, but upon setting SDP with multiple BUNDLE groups the PeerConnection will accept them if configured to accept BUNDLE. This makes it possible to accept an SFU's BUNDLE offer without having to SDP munge the answer. C++ unit tests are added. This fix has also been verified manually on: https://jsfiddle.net/henbos/to89L6ce/43/ Without fix: 0+2 get bundled, 1+3 don't get bundled. With fix: 0+2 get bundled in first group, 1+3 get bundled in second group. Bug: webrtc:10208 Change-Id: Iaf451fa5459c484730c8018274166ef154b19af8 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214487 Reviewed-by: Taylor <deadbeef@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33838}
2021-04-26 21:04:26 +02:00
std::vector<const cricket::ContentGroup*> new_bundle_groups =
description->GetGroupsByName(cricket::GROUP_TYPE_BUNDLE);
Reland "Use backticks not vertical bars to denote variables in comments for /pc" Original change's description: > Revert "Use backticks not vertical bars to denote variables in comments for /pc" > > This reverts commit 37ee0f5e594dd772ec6d620b5e5ea8a751b684f0. > > Reason for revert: Revert in order to be able to revert https://webrtc-review.googlesource.com/c/src/+/225642 > > Original change's description: > > Use backticks not vertical bars to denote variables in comments for /pc > > > > Bug: webrtc:12338 > > Change-Id: I88cf10afa5fc810b95d2a585ab2e895dcc163b63 > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/226953 > > Reviewed-by: Harald Alvestrand <hta@webrtc.org> > > Commit-Queue: Artem Titov <titovartem@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#34575} > > TBR=hta@webrtc.org,titovartem@webrtc.org,webrtc-scoped@luci-project-accounts.iam.gserviceaccount.com > > Change-Id: I5eddd3a14e1f664bf831e5c294fbc4de5f6a88af > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:12338 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/227082 > Reviewed-by: Björn Terelius <terelius@webrtc.org> > Commit-Queue: Björn Terelius <terelius@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#34577} Bug: webrtc:12338 Change-Id: I96bd229b73613c162d11d75fa4f5934e1b4295c7 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/227087 Commit-Queue: Artem Titov <titovartem@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/master@{#34611}
2021-07-30 22:30:23 +02:00
// Verify `new_bundle_groups`.
[Unified Plan] Support multiple BUNDLE groups. In this CL, JsepTransportController and MediaSessionDescriptionFactory are updated not to assume that there only exists at most a single BUNDLE group but a list of N groups. This makes it possible to create multiple BUNDLE groups by having multiple "a=group:BUNDLE" lines in the SDP. This makes it possible to have some m= sections in one group and some other m= sections in another group. For example, you could group all audio m= sections in one group and all video m= sections in another group. This enables "send all audio tracks on one transport and all video tracks on another transport" in Unified Plan. This is something that was possible in Plan B because all ssrcs in the same m= section were implicitly bundled together forming a group of audio m= section and video m= section (even without use of the BUNDLE tag). PeerConnection will never create multiple BUNDLE groups by default, but upon setting SDP with multiple BUNDLE groups the PeerConnection will accept them if configured to accept BUNDLE. This makes it possible to accept an SFU's BUNDLE offer without having to SDP munge the answer. C++ unit tests are added. This fix has also been verified manually on: https://jsfiddle.net/henbos/to89L6ce/43/ Without fix: 0+2 get bundled, 1+3 don't get bundled. With fix: 0+2 get bundled in first group, 1+3 get bundled in second group. Bug: webrtc:10208 Change-Id: Iaf451fa5459c484730c8018274166ef154b19af8 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214487 Reviewed-by: Taylor <deadbeef@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33838}
2021-04-26 21:04:26 +02:00
std::map<std::string, const cricket::ContentGroup*> new_bundle_groups_by_mid;
for (const cricket::ContentGroup* new_bundle_group : new_bundle_groups) {
Reland "Added mid to error messages reported during SDP apply." This reverts commit 341434e4da2c193b8842917d73afed6eea3a4332. Reason for revert: another attempt to land with Chromium test updated to accept both error messages by CL: https://chromium-review.googlesource.com/c/chromium/src/+/2228545 Original change's description: > Revert "Added mid to error messages reported during SDP apply." > > This reverts commit d2890e8833796f13c4a1243769be966bebdfcaa7. > > Reason for revert: speculative: WebRtcBrowserTest.NegotiateUnsupportedVideoCodec broken on all FYI bots, example: https://ci.chromium.org/p/chromium/builders/webrtc.fyi/WebRTC%20Chromium%20FYI%20Linux%20Tester/6659 > > Original change's description: > > Added mid to error messages reported during SDP apply. > > > > Bug: webrtc:10139 > > Change-Id: I7462b632e00a2da7b189b63022d30f594700b68a > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176400 > > Reviewed-by: Tommi <tommi@webrtc.org> > > Commit-Queue: Yura Yaroshevich <yura.yaroshevich@gmail.com> > > Cr-Commit-Position: refs/heads/master@{#31421} > > TBR=tommi@webrtc.org,yura.yaroshevich@gmail.com > > Change-Id: I18972815df10e2bd7b914ad82df9596009c2fecc > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:10139 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176418 > Reviewed-by: Olga Sharonova <olka@webrtc.org> > Commit-Queue: Olga Sharonova <olka@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#31425} TBR=tommi@webrtc.org,olka@webrtc.org,yura.yaroshevich@gmail.com # Not skipping CQ checks because this is a reland. Bug: webrtc:10139 Change-Id: I603d3891c43ac396bf0ba98c6de189663235c8af Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176448 Reviewed-by: Tommi <tommi@webrtc.org> Commit-Queue: Yura Yaroshevich <yura.yaroshevich@gmail.com> Cr-Commit-Position: refs/heads/master@{#31445}
2020-06-03 21:15:22 +00:00
for (const std::string& content_name : new_bundle_group->content_names()) {
[Unified Plan] Support multiple BUNDLE groups. In this CL, JsepTransportController and MediaSessionDescriptionFactory are updated not to assume that there only exists at most a single BUNDLE group but a list of N groups. This makes it possible to create multiple BUNDLE groups by having multiple "a=group:BUNDLE" lines in the SDP. This makes it possible to have some m= sections in one group and some other m= sections in another group. For example, you could group all audio m= sections in one group and all video m= sections in another group. This enables "send all audio tracks on one transport and all video tracks on another transport" in Unified Plan. This is something that was possible in Plan B because all ssrcs in the same m= section were implicitly bundled together forming a group of audio m= section and video m= section (even without use of the BUNDLE tag). PeerConnection will never create multiple BUNDLE groups by default, but upon setting SDP with multiple BUNDLE groups the PeerConnection will accept them if configured to accept BUNDLE. This makes it possible to accept an SFU's BUNDLE offer without having to SDP munge the answer. C++ unit tests are added. This fix has also been verified manually on: https://jsfiddle.net/henbos/to89L6ce/43/ Without fix: 0+2 get bundled, 1+3 don't get bundled. With fix: 0+2 get bundled in first group, 1+3 get bundled in second group. Bug: webrtc:10208 Change-Id: Iaf451fa5459c484730c8018274166ef154b19af8 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214487 Reviewed-by: Taylor <deadbeef@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33838}
2021-04-26 21:04:26 +02:00
// The BUNDLE group must not contain a MID that is a member of a different
// BUNDLE group, or that contains the same MID multiple times.
if (new_bundle_groups_by_mid.find(content_name) !=
new_bundle_groups_by_mid.end()) {
return RTCError(RTCErrorType::INVALID_PARAMETER,
"A BUNDLE group contains a MID='" + content_name +
"' that is already in a BUNDLE group.");
}
new_bundle_groups_by_mid.insert(
std::make_pair(content_name, new_bundle_group));
// The BUNDLE group must not contain a MID that no m= section has.
if (!description->GetContentByName(content_name)) {
return RTCError(RTCErrorType::INVALID_PARAMETER,
[Unified Plan] Support multiple BUNDLE groups. In this CL, JsepTransportController and MediaSessionDescriptionFactory are updated not to assume that there only exists at most a single BUNDLE group but a list of N groups. This makes it possible to create multiple BUNDLE groups by having multiple "a=group:BUNDLE" lines in the SDP. This makes it possible to have some m= sections in one group and some other m= sections in another group. For example, you could group all audio m= sections in one group and all video m= sections in another group. This enables "send all audio tracks on one transport and all video tracks on another transport" in Unified Plan. This is something that was possible in Plan B because all ssrcs in the same m= section were implicitly bundled together forming a group of audio m= section and video m= section (even without use of the BUNDLE tag). PeerConnection will never create multiple BUNDLE groups by default, but upon setting SDP with multiple BUNDLE groups the PeerConnection will accept them if configured to accept BUNDLE. This makes it possible to accept an SFU's BUNDLE offer without having to SDP munge the answer. C++ unit tests are added. This fix has also been verified manually on: https://jsfiddle.net/henbos/to89L6ce/43/ Without fix: 0+2 get bundled, 1+3 don't get bundled. With fix: 0+2 get bundled in first group, 1+3 get bundled in second group. Bug: webrtc:10208 Change-Id: Iaf451fa5459c484730c8018274166ef154b19af8 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214487 Reviewed-by: Taylor <deadbeef@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33838}
2021-04-26 21:04:26 +02:00
"A BUNDLE group contains a MID='" + content_name +
Reland "Added mid to error messages reported during SDP apply." This reverts commit 341434e4da2c193b8842917d73afed6eea3a4332. Reason for revert: another attempt to land with Chromium test updated to accept both error messages by CL: https://chromium-review.googlesource.com/c/chromium/src/+/2228545 Original change's description: > Revert "Added mid to error messages reported during SDP apply." > > This reverts commit d2890e8833796f13c4a1243769be966bebdfcaa7. > > Reason for revert: speculative: WebRtcBrowserTest.NegotiateUnsupportedVideoCodec broken on all FYI bots, example: https://ci.chromium.org/p/chromium/builders/webrtc.fyi/WebRTC%20Chromium%20FYI%20Linux%20Tester/6659 > > Original change's description: > > Added mid to error messages reported during SDP apply. > > > > Bug: webrtc:10139 > > Change-Id: I7462b632e00a2da7b189b63022d30f594700b68a > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176400 > > Reviewed-by: Tommi <tommi@webrtc.org> > > Commit-Queue: Yura Yaroshevich <yura.yaroshevich@gmail.com> > > Cr-Commit-Position: refs/heads/master@{#31421} > > TBR=tommi@webrtc.org,yura.yaroshevich@gmail.com > > Change-Id: I18972815df10e2bd7b914ad82df9596009c2fecc > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:10139 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176418 > Reviewed-by: Olga Sharonova <olka@webrtc.org> > Commit-Queue: Olga Sharonova <olka@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#31425} TBR=tommi@webrtc.org,olka@webrtc.org,yura.yaroshevich@gmail.com # Not skipping CQ checks because this is a reland. Bug: webrtc:10139 Change-Id: I603d3891c43ac396bf0ba98c6de189663235c8af Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176448 Reviewed-by: Tommi <tommi@webrtc.org> Commit-Queue: Yura Yaroshevich <yura.yaroshevich@gmail.com> Cr-Commit-Position: refs/heads/master@{#31445}
2020-06-03 21:15:22 +00:00
"' matching no m= section.");
}
}
}
Reland "Fix bug where we assume new m= sections will always be bundled." This is a reland of commit 704a834f685eb96c9fcf891ca345557bef4d138a, after it was reverted in order to merge a CL to M93. Original change's description: > Fix bug where we assume new m= sections will always be bundled. > > A recent change [1] assumes that all new m= sections will share the > first BUNDLE group (if one already exists), which avoids generating > ICE candidates that are ultimately unnecessary. This is fine for JSEP > endpoints, but it breaks the following scenarios for non-JSEP endpoints: > > * Remote offer adding a new m= section that's not part of any BUNDLE > group. > * Remote offer adding an m= section to the second BUNDLE group. > > The latter is specifically problematic for any application that wants > to bundle all audio streams in one group and all video streams in > another group when using Unified Plan SDP, to replicate the behavior of > using Plan B without bundling. It may try to add a video stream only > for WebRTC to bundle it with audio. > > This is fixed by doing some minor re-factoring, having BundleManager > update the bundle groups at offer time. > > Also: > * Added some additional validation for multiple bundle groups in a > subsequent offer, since that now becomes relevant. > * Improved rollback support, because now rolling back an offer may need > to not only remove mid->transport mappings but alter them. > > [1]: https://webrtc-review.googlesource.com/c/src/+/221601 > > Bug: webrtc:12906, webrtc:12999 > Change-Id: I4c6e7020c0be33a782d3608dee88e4e2fceb1be1 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/225642 > Reviewed-by: Harald Alvestrand <hta@webrtc.org> > Reviewed-by: Henrik Boström <hbos@webrtc.org> > Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#34544} Bug: webrtc:12906, webrtc:12999 Change-Id: Id6acab2e2d7430c65f4b6a1d7372388a70cc18ab Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/228465 Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/master@{#34728}
2021-08-11 14:56:38 -07:00
if (type == SdpType::kOffer) {
// For an offer, we need to verify that there is not a conflicting mapping
// between existing and new bundle groups. For example, if the existing
// groups are [[1,2],[3,4]] and new are [[1,3],[2,4]] or [[1,2,3,4]], or
// vice versa. Switching things around like this requires a separate offer
// that removes the relevant sections from their group, as per RFC 8843,
// section 7.5.2.
std::map<const cricket::ContentGroup*, const cricket::ContentGroup*>
new_bundle_groups_by_existing_bundle_groups;
std::map<const cricket::ContentGroup*, const cricket::ContentGroup*>
existing_bundle_groups_by_new_bundle_groups;
for (const cricket::ContentGroup* new_bundle_group : new_bundle_groups) {
for (const std::string& mid : new_bundle_group->content_names()) {
cricket::ContentGroup* existing_bundle_group =
bundles_.LookupGroupByMid(mid);
if (!existing_bundle_group) {
continue;
}
auto it = new_bundle_groups_by_existing_bundle_groups.find(
existing_bundle_group);
if (it != new_bundle_groups_by_existing_bundle_groups.end() &&
it->second != new_bundle_group) {
return RTCError(RTCErrorType::INVALID_PARAMETER,
"MID " + mid + " in the offer has changed group.");
}
new_bundle_groups_by_existing_bundle_groups.insert(
std::make_pair(existing_bundle_group, new_bundle_group));
it = existing_bundle_groups_by_new_bundle_groups.find(new_bundle_group);
if (it != existing_bundle_groups_by_new_bundle_groups.end() &&
it->second != existing_bundle_group) {
return RTCError(RTCErrorType::INVALID_PARAMETER,
"MID " + mid + " in the offer has changed group.");
}
existing_bundle_groups_by_new_bundle_groups.insert(
std::make_pair(new_bundle_group, existing_bundle_group));
}
}
} else if (type == SdpType::kAnswer) {
[Unified Plan] Support multiple BUNDLE groups. In this CL, JsepTransportController and MediaSessionDescriptionFactory are updated not to assume that there only exists at most a single BUNDLE group but a list of N groups. This makes it possible to create multiple BUNDLE groups by having multiple "a=group:BUNDLE" lines in the SDP. This makes it possible to have some m= sections in one group and some other m= sections in another group. For example, you could group all audio m= sections in one group and all video m= sections in another group. This enables "send all audio tracks on one transport and all video tracks on another transport" in Unified Plan. This is something that was possible in Plan B because all ssrcs in the same m= section were implicitly bundled together forming a group of audio m= section and video m= section (even without use of the BUNDLE tag). PeerConnection will never create multiple BUNDLE groups by default, but upon setting SDP with multiple BUNDLE groups the PeerConnection will accept them if configured to accept BUNDLE. This makes it possible to accept an SFU's BUNDLE offer without having to SDP munge the answer. C++ unit tests are added. This fix has also been verified manually on: https://jsfiddle.net/henbos/to89L6ce/43/ Without fix: 0+2 get bundled, 1+3 don't get bundled. With fix: 0+2 get bundled in first group, 1+3 get bundled in second group. Bug: webrtc:10208 Change-Id: Iaf451fa5459c484730c8018274166ef154b19af8 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214487 Reviewed-by: Taylor <deadbeef@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33838}
2021-04-26 21:04:26 +02:00
std::vector<const cricket::ContentGroup*> offered_bundle_groups =
local ? remote_desc_->GetGroupsByName(cricket::GROUP_TYPE_BUNDLE)
: local_desc_->GetGroupsByName(cricket::GROUP_TYPE_BUNDLE);
std::map<std::string, const cricket::ContentGroup*>
offered_bundle_groups_by_mid;
for (const cricket::ContentGroup* offered_bundle_group :
offered_bundle_groups) {
for (const std::string& content_name :
offered_bundle_group->content_names()) {
offered_bundle_groups_by_mid[content_name] = offered_bundle_group;
}
}
[Unified Plan] Support multiple BUNDLE groups. In this CL, JsepTransportController and MediaSessionDescriptionFactory are updated not to assume that there only exists at most a single BUNDLE group but a list of N groups. This makes it possible to create multiple BUNDLE groups by having multiple "a=group:BUNDLE" lines in the SDP. This makes it possible to have some m= sections in one group and some other m= sections in another group. For example, you could group all audio m= sections in one group and all video m= sections in another group. This enables "send all audio tracks on one transport and all video tracks on another transport" in Unified Plan. This is something that was possible in Plan B because all ssrcs in the same m= section were implicitly bundled together forming a group of audio m= section and video m= section (even without use of the BUNDLE tag). PeerConnection will never create multiple BUNDLE groups by default, but upon setting SDP with multiple BUNDLE groups the PeerConnection will accept them if configured to accept BUNDLE. This makes it possible to accept an SFU's BUNDLE offer without having to SDP munge the answer. C++ unit tests are added. This fix has also been verified manually on: https://jsfiddle.net/henbos/to89L6ce/43/ Without fix: 0+2 get bundled, 1+3 don't get bundled. With fix: 0+2 get bundled in first group, 1+3 get bundled in second group. Bug: webrtc:10208 Change-Id: Iaf451fa5459c484730c8018274166ef154b19af8 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214487 Reviewed-by: Taylor <deadbeef@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33838}
2021-04-26 21:04:26 +02:00
std::map<const cricket::ContentGroup*, const cricket::ContentGroup*>
new_bundle_groups_by_offered_bundle_groups;
for (const cricket::ContentGroup* new_bundle_group : new_bundle_groups) {
if (!new_bundle_group->FirstContentName()) {
// Empty groups could be a subset of any group.
continue;
}
// The group in the answer (new_bundle_group) must have a corresponding
// group in the offer (original_group), because the answer groups may only
// be subsets of the offer groups.
auto it = offered_bundle_groups_by_mid.find(
*new_bundle_group->FirstContentName());
if (it == offered_bundle_groups_by_mid.end()) {
return RTCError(RTCErrorType::INVALID_PARAMETER,
"A BUNDLE group was added in the answer that did not "
"exist in the offer.");
}
const cricket::ContentGroup* offered_bundle_group = it->second;
if (new_bundle_groups_by_offered_bundle_groups.find(
offered_bundle_group) !=
new_bundle_groups_by_offered_bundle_groups.end()) {
return RTCError(RTCErrorType::INVALID_PARAMETER,
"A MID in the answer has changed group.");
}
new_bundle_groups_by_offered_bundle_groups.insert(
std::make_pair(offered_bundle_group, new_bundle_group));
Reland "Added mid to error messages reported during SDP apply." This reverts commit 341434e4da2c193b8842917d73afed6eea3a4332. Reason for revert: another attempt to land with Chromium test updated to accept both error messages by CL: https://chromium-review.googlesource.com/c/chromium/src/+/2228545 Original change's description: > Revert "Added mid to error messages reported during SDP apply." > > This reverts commit d2890e8833796f13c4a1243769be966bebdfcaa7. > > Reason for revert: speculative: WebRtcBrowserTest.NegotiateUnsupportedVideoCodec broken on all FYI bots, example: https://ci.chromium.org/p/chromium/builders/webrtc.fyi/WebRTC%20Chromium%20FYI%20Linux%20Tester/6659 > > Original change's description: > > Added mid to error messages reported during SDP apply. > > > > Bug: webrtc:10139 > > Change-Id: I7462b632e00a2da7b189b63022d30f594700b68a > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176400 > > Reviewed-by: Tommi <tommi@webrtc.org> > > Commit-Queue: Yura Yaroshevich <yura.yaroshevich@gmail.com> > > Cr-Commit-Position: refs/heads/master@{#31421} > > TBR=tommi@webrtc.org,yura.yaroshevich@gmail.com > > Change-Id: I18972815df10e2bd7b914ad82df9596009c2fecc > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:10139 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176418 > Reviewed-by: Olga Sharonova <olka@webrtc.org> > Commit-Queue: Olga Sharonova <olka@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#31425} TBR=tommi@webrtc.org,olka@webrtc.org,yura.yaroshevich@gmail.com # Not skipping CQ checks because this is a reland. Bug: webrtc:10139 Change-Id: I603d3891c43ac396bf0ba98c6de189663235c8af Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176448 Reviewed-by: Tommi <tommi@webrtc.org> Commit-Queue: Yura Yaroshevich <yura.yaroshevich@gmail.com> Cr-Commit-Position: refs/heads/master@{#31445}
2020-06-03 21:15:22 +00:00
for (const std::string& content_name :
new_bundle_group->content_names()) {
[Unified Plan] Support multiple BUNDLE groups. In this CL, JsepTransportController and MediaSessionDescriptionFactory are updated not to assume that there only exists at most a single BUNDLE group but a list of N groups. This makes it possible to create multiple BUNDLE groups by having multiple "a=group:BUNDLE" lines in the SDP. This makes it possible to have some m= sections in one group and some other m= sections in another group. For example, you could group all audio m= sections in one group and all video m= sections in another group. This enables "send all audio tracks on one transport and all video tracks on another transport" in Unified Plan. This is something that was possible in Plan B because all ssrcs in the same m= section were implicitly bundled together forming a group of audio m= section and video m= section (even without use of the BUNDLE tag). PeerConnection will never create multiple BUNDLE groups by default, but upon setting SDP with multiple BUNDLE groups the PeerConnection will accept them if configured to accept BUNDLE. This makes it possible to accept an SFU's BUNDLE offer without having to SDP munge the answer. C++ unit tests are added. This fix has also been verified manually on: https://jsfiddle.net/henbos/to89L6ce/43/ Without fix: 0+2 get bundled, 1+3 don't get bundled. With fix: 0+2 get bundled in first group, 1+3 get bundled in second group. Bug: webrtc:10208 Change-Id: Iaf451fa5459c484730c8018274166ef154b19af8 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214487 Reviewed-by: Taylor <deadbeef@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33838}
2021-04-26 21:04:26 +02:00
it = offered_bundle_groups_by_mid.find(content_name);
// The BUNDLE group in answer should be a subset of offered group.
if (it == offered_bundle_groups_by_mid.end() ||
it->second != offered_bundle_group) {
return RTCError(RTCErrorType::INVALID_PARAMETER,
[Unified Plan] Support multiple BUNDLE groups. In this CL, JsepTransportController and MediaSessionDescriptionFactory are updated not to assume that there only exists at most a single BUNDLE group but a list of N groups. This makes it possible to create multiple BUNDLE groups by having multiple "a=group:BUNDLE" lines in the SDP. This makes it possible to have some m= sections in one group and some other m= sections in another group. For example, you could group all audio m= sections in one group and all video m= sections in another group. This enables "send all audio tracks on one transport and all video tracks on another transport" in Unified Plan. This is something that was possible in Plan B because all ssrcs in the same m= section were implicitly bundled together forming a group of audio m= section and video m= section (even without use of the BUNDLE tag). PeerConnection will never create multiple BUNDLE groups by default, but upon setting SDP with multiple BUNDLE groups the PeerConnection will accept them if configured to accept BUNDLE. This makes it possible to accept an SFU's BUNDLE offer without having to SDP munge the answer. C++ unit tests are added. This fix has also been verified manually on: https://jsfiddle.net/henbos/to89L6ce/43/ Without fix: 0+2 get bundled, 1+3 don't get bundled. With fix: 0+2 get bundled in first group, 1+3 get bundled in second group. Bug: webrtc:10208 Change-Id: Iaf451fa5459c484730c8018274166ef154b19af8 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214487 Reviewed-by: Taylor <deadbeef@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33838}
2021-04-26 21:04:26 +02:00
"A BUNDLE group in answer contains a MID='" +
Reland "Added mid to error messages reported during SDP apply." This reverts commit 341434e4da2c193b8842917d73afed6eea3a4332. Reason for revert: another attempt to land with Chromium test updated to accept both error messages by CL: https://chromium-review.googlesource.com/c/chromium/src/+/2228545 Original change's description: > Revert "Added mid to error messages reported during SDP apply." > > This reverts commit d2890e8833796f13c4a1243769be966bebdfcaa7. > > Reason for revert: speculative: WebRtcBrowserTest.NegotiateUnsupportedVideoCodec broken on all FYI bots, example: https://ci.chromium.org/p/chromium/builders/webrtc.fyi/WebRTC%20Chromium%20FYI%20Linux%20Tester/6659 > > Original change's description: > > Added mid to error messages reported during SDP apply. > > > > Bug: webrtc:10139 > > Change-Id: I7462b632e00a2da7b189b63022d30f594700b68a > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176400 > > Reviewed-by: Tommi <tommi@webrtc.org> > > Commit-Queue: Yura Yaroshevich <yura.yaroshevich@gmail.com> > > Cr-Commit-Position: refs/heads/master@{#31421} > > TBR=tommi@webrtc.org,yura.yaroshevich@gmail.com > > Change-Id: I18972815df10e2bd7b914ad82df9596009c2fecc > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:10139 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176418 > Reviewed-by: Olga Sharonova <olka@webrtc.org> > Commit-Queue: Olga Sharonova <olka@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#31425} TBR=tommi@webrtc.org,olka@webrtc.org,yura.yaroshevich@gmail.com # Not skipping CQ checks because this is a reland. Bug: webrtc:10139 Change-Id: I603d3891c43ac396bf0ba98c6de189663235c8af Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176448 Reviewed-by: Tommi <tommi@webrtc.org> Commit-Queue: Yura Yaroshevich <yura.yaroshevich@gmail.com> Cr-Commit-Position: refs/heads/master@{#31445}
2020-06-03 21:15:22 +00:00
content_name +
[Unified Plan] Support multiple BUNDLE groups. In this CL, JsepTransportController and MediaSessionDescriptionFactory are updated not to assume that there only exists at most a single BUNDLE group but a list of N groups. This makes it possible to create multiple BUNDLE groups by having multiple "a=group:BUNDLE" lines in the SDP. This makes it possible to have some m= sections in one group and some other m= sections in another group. For example, you could group all audio m= sections in one group and all video m= sections in another group. This enables "send all audio tracks on one transport and all video tracks on another transport" in Unified Plan. This is something that was possible in Plan B because all ssrcs in the same m= section were implicitly bundled together forming a group of audio m= section and video m= section (even without use of the BUNDLE tag). PeerConnection will never create multiple BUNDLE groups by default, but upon setting SDP with multiple BUNDLE groups the PeerConnection will accept them if configured to accept BUNDLE. This makes it possible to accept an SFU's BUNDLE offer without having to SDP munge the answer. C++ unit tests are added. This fix has also been verified manually on: https://jsfiddle.net/henbos/to89L6ce/43/ Without fix: 0+2 get bundled, 1+3 don't get bundled. With fix: 0+2 get bundled in first group, 1+3 get bundled in second group. Bug: webrtc:10208 Change-Id: Iaf451fa5459c484730c8018274166ef154b19af8 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214487 Reviewed-by: Taylor <deadbeef@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33838}
2021-04-26 21:04:26 +02:00
"' that was not in the offered group.");
}
}
}
for (const auto& bundle_group : bundles_.bundle_groups()) {
[Unified Plan] Support multiple BUNDLE groups. In this CL, JsepTransportController and MediaSessionDescriptionFactory are updated not to assume that there only exists at most a single BUNDLE group but a list of N groups. This makes it possible to create multiple BUNDLE groups by having multiple "a=group:BUNDLE" lines in the SDP. This makes it possible to have some m= sections in one group and some other m= sections in another group. For example, you could group all audio m= sections in one group and all video m= sections in another group. This enables "send all audio tracks on one transport and all video tracks on another transport" in Unified Plan. This is something that was possible in Plan B because all ssrcs in the same m= section were implicitly bundled together forming a group of audio m= section and video m= section (even without use of the BUNDLE tag). PeerConnection will never create multiple BUNDLE groups by default, but upon setting SDP with multiple BUNDLE groups the PeerConnection will accept them if configured to accept BUNDLE. This makes it possible to accept an SFU's BUNDLE offer without having to SDP munge the answer. C++ unit tests are added. This fix has also been verified manually on: https://jsfiddle.net/henbos/to89L6ce/43/ Without fix: 0+2 get bundled, 1+3 don't get bundled. With fix: 0+2 get bundled in first group, 1+3 get bundled in second group. Bug: webrtc:10208 Change-Id: Iaf451fa5459c484730c8018274166ef154b19af8 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214487 Reviewed-by: Taylor <deadbeef@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33838}
2021-04-26 21:04:26 +02:00
for (const std::string& content_name : bundle_group->content_names()) {
// An answer that removes m= sections from pre-negotiated BUNDLE group
// without rejecting it, is invalid.
[Unified Plan] Support multiple BUNDLE groups. In this CL, JsepTransportController and MediaSessionDescriptionFactory are updated not to assume that there only exists at most a single BUNDLE group but a list of N groups. This makes it possible to create multiple BUNDLE groups by having multiple "a=group:BUNDLE" lines in the SDP. This makes it possible to have some m= sections in one group and some other m= sections in another group. For example, you could group all audio m= sections in one group and all video m= sections in another group. This enables "send all audio tracks on one transport and all video tracks on another transport" in Unified Plan. This is something that was possible in Plan B because all ssrcs in the same m= section were implicitly bundled together forming a group of audio m= section and video m= section (even without use of the BUNDLE tag). PeerConnection will never create multiple BUNDLE groups by default, but upon setting SDP with multiple BUNDLE groups the PeerConnection will accept them if configured to accept BUNDLE. This makes it possible to accept an SFU's BUNDLE offer without having to SDP munge the answer. C++ unit tests are added. This fix has also been verified manually on: https://jsfiddle.net/henbos/to89L6ce/43/ Without fix: 0+2 get bundled, 1+3 don't get bundled. With fix: 0+2 get bundled in first group, 1+3 get bundled in second group. Bug: webrtc:10208 Change-Id: Iaf451fa5459c484730c8018274166ef154b19af8 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214487 Reviewed-by: Taylor <deadbeef@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33838}
2021-04-26 21:04:26 +02:00
auto it = new_bundle_groups_by_mid.find(content_name);
if (it == new_bundle_groups_by_mid.end()) {
auto* content_info = description->GetContentByName(content_name);
if (!content_info || !content_info->rejected) {
return RTCError(RTCErrorType::INVALID_PARAMETER,
Reland "Added mid to error messages reported during SDP apply." This reverts commit 341434e4da2c193b8842917d73afed6eea3a4332. Reason for revert: another attempt to land with Chromium test updated to accept both error messages by CL: https://chromium-review.googlesource.com/c/chromium/src/+/2228545 Original change's description: > Revert "Added mid to error messages reported during SDP apply." > > This reverts commit d2890e8833796f13c4a1243769be966bebdfcaa7. > > Reason for revert: speculative: WebRtcBrowserTest.NegotiateUnsupportedVideoCodec broken on all FYI bots, example: https://ci.chromium.org/p/chromium/builders/webrtc.fyi/WebRTC%20Chromium%20FYI%20Linux%20Tester/6659 > > Original change's description: > > Added mid to error messages reported during SDP apply. > > > > Bug: webrtc:10139 > > Change-Id: I7462b632e00a2da7b189b63022d30f594700b68a > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176400 > > Reviewed-by: Tommi <tommi@webrtc.org> > > Commit-Queue: Yura Yaroshevich <yura.yaroshevich@gmail.com> > > Cr-Commit-Position: refs/heads/master@{#31421} > > TBR=tommi@webrtc.org,yura.yaroshevich@gmail.com > > Change-Id: I18972815df10e2bd7b914ad82df9596009c2fecc > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:10139 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176418 > Reviewed-by: Olga Sharonova <olka@webrtc.org> > Commit-Queue: Olga Sharonova <olka@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#31425} TBR=tommi@webrtc.org,olka@webrtc.org,yura.yaroshevich@gmail.com # Not skipping CQ checks because this is a reland. Bug: webrtc:10139 Change-Id: I603d3891c43ac396bf0ba98c6de189663235c8af Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176448 Reviewed-by: Tommi <tommi@webrtc.org> Commit-Queue: Yura Yaroshevich <yura.yaroshevich@gmail.com> Cr-Commit-Position: refs/heads/master@{#31445}
2020-06-03 21:15:22 +00:00
"Answer cannot remove m= section with mid='" +
content_name +
"' from already-established BUNDLE group.");
}
}
}
}
}
if (config_.bundle_policy ==
PeerConnectionInterface::kBundlePolicyMaxBundle &&
!description->HasGroup(cricket::GROUP_TYPE_BUNDLE)) {
return RTCError(RTCErrorType::INVALID_PARAMETER,
"max-bundle is used but no bundle group found.");
}
Reland "Fix bug where we assume new m= sections will always be bundled." This is a reland of commit 704a834f685eb96c9fcf891ca345557bef4d138a, after it was reverted in order to merge a CL to M93. Original change's description: > Fix bug where we assume new m= sections will always be bundled. > > A recent change [1] assumes that all new m= sections will share the > first BUNDLE group (if one already exists), which avoids generating > ICE candidates that are ultimately unnecessary. This is fine for JSEP > endpoints, but it breaks the following scenarios for non-JSEP endpoints: > > * Remote offer adding a new m= section that's not part of any BUNDLE > group. > * Remote offer adding an m= section to the second BUNDLE group. > > The latter is specifically problematic for any application that wants > to bundle all audio streams in one group and all video streams in > another group when using Unified Plan SDP, to replicate the behavior of > using Plan B without bundling. It may try to add a video stream only > for WebRTC to bundle it with audio. > > This is fixed by doing some minor re-factoring, having BundleManager > update the bundle groups at offer time. > > Also: > * Added some additional validation for multiple bundle groups in a > subsequent offer, since that now becomes relevant. > * Improved rollback support, because now rolling back an offer may need > to not only remove mid->transport mappings but alter them. > > [1]: https://webrtc-review.googlesource.com/c/src/+/221601 > > Bug: webrtc:12906, webrtc:12999 > Change-Id: I4c6e7020c0be33a782d3608dee88e4e2fceb1be1 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/225642 > Reviewed-by: Harald Alvestrand <hta@webrtc.org> > Reviewed-by: Henrik Boström <hbos@webrtc.org> > Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#34544} Bug: webrtc:12906, webrtc:12999 Change-Id: Id6acab2e2d7430c65f4b6a1d7372388a70cc18ab Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/228465 Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/master@{#34728}
2021-08-11 14:56:38 -07:00
bundles_.Update(description, type);
for (const auto& bundle_group : bundles_.bundle_groups()) {
[Unified Plan] Support multiple BUNDLE groups. In this CL, JsepTransportController and MediaSessionDescriptionFactory are updated not to assume that there only exists at most a single BUNDLE group but a list of N groups. This makes it possible to create multiple BUNDLE groups by having multiple "a=group:BUNDLE" lines in the SDP. This makes it possible to have some m= sections in one group and some other m= sections in another group. For example, you could group all audio m= sections in one group and all video m= sections in another group. This enables "send all audio tracks on one transport and all video tracks on another transport" in Unified Plan. This is something that was possible in Plan B because all ssrcs in the same m= section were implicitly bundled together forming a group of audio m= section and video m= section (even without use of the BUNDLE tag). PeerConnection will never create multiple BUNDLE groups by default, but upon setting SDP with multiple BUNDLE groups the PeerConnection will accept them if configured to accept BUNDLE. This makes it possible to accept an SFU's BUNDLE offer without having to SDP munge the answer. C++ unit tests are added. This fix has also been verified manually on: https://jsfiddle.net/henbos/to89L6ce/43/ Without fix: 0+2 get bundled, 1+3 don't get bundled. With fix: 0+2 get bundled in first group, 1+3 get bundled in second group. Bug: webrtc:10208 Change-Id: Iaf451fa5459c484730c8018274166ef154b19af8 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214487 Reviewed-by: Taylor <deadbeef@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33838}
2021-04-26 21:04:26 +02:00
if (!bundle_group->FirstContentName())
continue;
[Unified Plan] Support multiple BUNDLE groups. In this CL, JsepTransportController and MediaSessionDescriptionFactory are updated not to assume that there only exists at most a single BUNDLE group but a list of N groups. This makes it possible to create multiple BUNDLE groups by having multiple "a=group:BUNDLE" lines in the SDP. This makes it possible to have some m= sections in one group and some other m= sections in another group. For example, you could group all audio m= sections in one group and all video m= sections in another group. This enables "send all audio tracks on one transport and all video tracks on another transport" in Unified Plan. This is something that was possible in Plan B because all ssrcs in the same m= section were implicitly bundled together forming a group of audio m= section and video m= section (even without use of the BUNDLE tag). PeerConnection will never create multiple BUNDLE groups by default, but upon setting SDP with multiple BUNDLE groups the PeerConnection will accept them if configured to accept BUNDLE. This makes it possible to accept an SFU's BUNDLE offer without having to SDP munge the answer. C++ unit tests are added. This fix has also been verified manually on: https://jsfiddle.net/henbos/to89L6ce/43/ Without fix: 0+2 get bundled, 1+3 don't get bundled. With fix: 0+2 get bundled in first group, 1+3 get bundled in second group. Bug: webrtc:10208 Change-Id: Iaf451fa5459c484730c8018274166ef154b19af8 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214487 Reviewed-by: Taylor <deadbeef@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33838}
2021-04-26 21:04:26 +02:00
// The first MID in a BUNDLE group is BUNDLE-tagged.
auto bundled_content =
description->GetContentByName(*bundle_group->FirstContentName());
if (!bundled_content) {
return RTCError(
RTCErrorType::INVALID_PARAMETER,
"An m= section associated with the BUNDLE-tag doesn't exist.");
}
Reland "Use backticks not vertical bars to denote variables in comments for /pc" Original change's description: > Revert "Use backticks not vertical bars to denote variables in comments for /pc" > > This reverts commit 37ee0f5e594dd772ec6d620b5e5ea8a751b684f0. > > Reason for revert: Revert in order to be able to revert https://webrtc-review.googlesource.com/c/src/+/225642 > > Original change's description: > > Use backticks not vertical bars to denote variables in comments for /pc > > > > Bug: webrtc:12338 > > Change-Id: I88cf10afa5fc810b95d2a585ab2e895dcc163b63 > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/226953 > > Reviewed-by: Harald Alvestrand <hta@webrtc.org> > > Commit-Queue: Artem Titov <titovartem@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#34575} > > TBR=hta@webrtc.org,titovartem@webrtc.org,webrtc-scoped@luci-project-accounts.iam.gserviceaccount.com > > Change-Id: I5eddd3a14e1f664bf831e5c294fbc4de5f6a88af > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:12338 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/227082 > Reviewed-by: Björn Terelius <terelius@webrtc.org> > Commit-Queue: Björn Terelius <terelius@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#34577} Bug: webrtc:12338 Change-Id: I96bd229b73613c162d11d75fa4f5934e1b4295c7 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/227087 Commit-Queue: Artem Titov <titovartem@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/master@{#34611}
2021-07-30 22:30:23 +02:00
// If the `bundled_content` is rejected, other contents in the bundle group
[Unified Plan] Support multiple BUNDLE groups. In this CL, JsepTransportController and MediaSessionDescriptionFactory are updated not to assume that there only exists at most a single BUNDLE group but a list of N groups. This makes it possible to create multiple BUNDLE groups by having multiple "a=group:BUNDLE" lines in the SDP. This makes it possible to have some m= sections in one group and some other m= sections in another group. For example, you could group all audio m= sections in one group and all video m= sections in another group. This enables "send all audio tracks on one transport and all video tracks on another transport" in Unified Plan. This is something that was possible in Plan B because all ssrcs in the same m= section were implicitly bundled together forming a group of audio m= section and video m= section (even without use of the BUNDLE tag). PeerConnection will never create multiple BUNDLE groups by default, but upon setting SDP with multiple BUNDLE groups the PeerConnection will accept them if configured to accept BUNDLE. This makes it possible to accept an SFU's BUNDLE offer without having to SDP munge the answer. C++ unit tests are added. This fix has also been verified manually on: https://jsfiddle.net/henbos/to89L6ce/43/ Without fix: 0+2 get bundled, 1+3 don't get bundled. With fix: 0+2 get bundled in first group, 1+3 get bundled in second group. Bug: webrtc:10208 Change-Id: Iaf451fa5459c484730c8018274166ef154b19af8 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214487 Reviewed-by: Taylor <deadbeef@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33838}
2021-04-26 21:04:26 +02:00
// must also be rejected.
if (bundled_content->rejected) {
for (const auto& content_name : bundle_group->content_names()) {
auto other_content = description->GetContentByName(content_name);
if (!other_content->rejected) {
return RTCError(RTCErrorType::INVALID_PARAMETER,
"The m= section with mid='" + content_name +
"' should be rejected.");
}
}
}
}
return RTCError::OK();
}
RTCError JsepTransportController::ValidateContent(
const cricket::ContentInfo& content_info) {
if (config_.rtcp_mux_policy ==
PeerConnectionInterface::kRtcpMuxPolicyRequire &&
content_info.type == cricket::MediaProtocolType::kRtp &&
!content_info.media_description()->rtcp_mux()) {
return RTCError(RTCErrorType::INVALID_PARAMETER,
Reland "Added mid to error messages reported during SDP apply." This reverts commit 341434e4da2c193b8842917d73afed6eea3a4332. Reason for revert: another attempt to land with Chromium test updated to accept both error messages by CL: https://chromium-review.googlesource.com/c/chromium/src/+/2228545 Original change's description: > Revert "Added mid to error messages reported during SDP apply." > > This reverts commit d2890e8833796f13c4a1243769be966bebdfcaa7. > > Reason for revert: speculative: WebRtcBrowserTest.NegotiateUnsupportedVideoCodec broken on all FYI bots, example: https://ci.chromium.org/p/chromium/builders/webrtc.fyi/WebRTC%20Chromium%20FYI%20Linux%20Tester/6659 > > Original change's description: > > Added mid to error messages reported during SDP apply. > > > > Bug: webrtc:10139 > > Change-Id: I7462b632e00a2da7b189b63022d30f594700b68a > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176400 > > Reviewed-by: Tommi <tommi@webrtc.org> > > Commit-Queue: Yura Yaroshevich <yura.yaroshevich@gmail.com> > > Cr-Commit-Position: refs/heads/master@{#31421} > > TBR=tommi@webrtc.org,yura.yaroshevich@gmail.com > > Change-Id: I18972815df10e2bd7b914ad82df9596009c2fecc > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:10139 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176418 > Reviewed-by: Olga Sharonova <olka@webrtc.org> > Commit-Queue: Olga Sharonova <olka@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#31425} TBR=tommi@webrtc.org,olka@webrtc.org,yura.yaroshevich@gmail.com # Not skipping CQ checks because this is a reland. Bug: webrtc:10139 Change-Id: I603d3891c43ac396bf0ba98c6de189663235c8af Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176448 Reviewed-by: Tommi <tommi@webrtc.org> Commit-Queue: Yura Yaroshevich <yura.yaroshevich@gmail.com> Cr-Commit-Position: refs/heads/master@{#31445}
2020-06-03 21:15:22 +00:00
"The m= section with mid='" + content_info.name +
"' is invalid. RTCP-MUX is not "
"enabled when it is required.");
}
return RTCError::OK();
}
void JsepTransportController::HandleRejectedContent(
const cricket::ContentInfo& content_info) {
// If the content is rejected, let the
// BaseChannel/SctpTransport change the RtpTransport/DtlsTransport first,
// then destroy the cricket::JsepTransport.
[Unified Plan] Support multiple BUNDLE groups. In this CL, JsepTransportController and MediaSessionDescriptionFactory are updated not to assume that there only exists at most a single BUNDLE group but a list of N groups. This makes it possible to create multiple BUNDLE groups by having multiple "a=group:BUNDLE" lines in the SDP. This makes it possible to have some m= sections in one group and some other m= sections in another group. For example, you could group all audio m= sections in one group and all video m= sections in another group. This enables "send all audio tracks on one transport and all video tracks on another transport" in Unified Plan. This is something that was possible in Plan B because all ssrcs in the same m= section were implicitly bundled together forming a group of audio m= section and video m= section (even without use of the BUNDLE tag). PeerConnection will never create multiple BUNDLE groups by default, but upon setting SDP with multiple BUNDLE groups the PeerConnection will accept them if configured to accept BUNDLE. This makes it possible to accept an SFU's BUNDLE offer without having to SDP munge the answer. C++ unit tests are added. This fix has also been verified manually on: https://jsfiddle.net/henbos/to89L6ce/43/ Without fix: 0+2 get bundled, 1+3 don't get bundled. With fix: 0+2 get bundled in first group, 1+3 get bundled in second group. Bug: webrtc:10208 Change-Id: Iaf451fa5459c484730c8018274166ef154b19af8 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214487 Reviewed-by: Taylor <deadbeef@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33838}
2021-04-26 21:04:26 +02:00
cricket::ContentGroup* bundle_group =
bundles_.LookupGroupByMid(content_info.name);
[Unified Plan] Support multiple BUNDLE groups. In this CL, JsepTransportController and MediaSessionDescriptionFactory are updated not to assume that there only exists at most a single BUNDLE group but a list of N groups. This makes it possible to create multiple BUNDLE groups by having multiple "a=group:BUNDLE" lines in the SDP. This makes it possible to have some m= sections in one group and some other m= sections in another group. For example, you could group all audio m= sections in one group and all video m= sections in another group. This enables "send all audio tracks on one transport and all video tracks on another transport" in Unified Plan. This is something that was possible in Plan B because all ssrcs in the same m= section were implicitly bundled together forming a group of audio m= section and video m= section (even without use of the BUNDLE tag). PeerConnection will never create multiple BUNDLE groups by default, but upon setting SDP with multiple BUNDLE groups the PeerConnection will accept them if configured to accept BUNDLE. This makes it possible to accept an SFU's BUNDLE offer without having to SDP munge the answer. C++ unit tests are added. This fix has also been verified manually on: https://jsfiddle.net/henbos/to89L6ce/43/ Without fix: 0+2 get bundled, 1+3 don't get bundled. With fix: 0+2 get bundled in first group, 1+3 get bundled in second group. Bug: webrtc:10208 Change-Id: Iaf451fa5459c484730c8018274166ef154b19af8 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214487 Reviewed-by: Taylor <deadbeef@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33838}
2021-04-26 21:04:26 +02:00
if (bundle_group && !bundle_group->content_names().empty() &&
content_info.name == *bundle_group->FirstContentName()) {
// Rejecting a BUNDLE group's first mid means we are rejecting the entire
// group.
for (const auto& content_name : bundle_group->content_names()) {
transports_.RemoveTransportForMid(content_name);
}
[Unified Plan] Support multiple BUNDLE groups. In this CL, JsepTransportController and MediaSessionDescriptionFactory are updated not to assume that there only exists at most a single BUNDLE group but a list of N groups. This makes it possible to create multiple BUNDLE groups by having multiple "a=group:BUNDLE" lines in the SDP. This makes it possible to have some m= sections in one group and some other m= sections in another group. For example, you could group all audio m= sections in one group and all video m= sections in another group. This enables "send all audio tracks on one transport and all video tracks on another transport" in Unified Plan. This is something that was possible in Plan B because all ssrcs in the same m= section were implicitly bundled together forming a group of audio m= section and video m= section (even without use of the BUNDLE tag). PeerConnection will never create multiple BUNDLE groups by default, but upon setting SDP with multiple BUNDLE groups the PeerConnection will accept them if configured to accept BUNDLE. This makes it possible to accept an SFU's BUNDLE offer without having to SDP munge the answer. C++ unit tests are added. This fix has also been verified manually on: https://jsfiddle.net/henbos/to89L6ce/43/ Without fix: 0+2 get bundled, 1+3 don't get bundled. With fix: 0+2 get bundled in first group, 1+3 get bundled in second group. Bug: webrtc:10208 Change-Id: Iaf451fa5459c484730c8018274166ef154b19af8 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214487 Reviewed-by: Taylor <deadbeef@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33838}
2021-04-26 21:04:26 +02:00
// Delete the BUNDLE group.
bundles_.DeleteGroup(bundle_group);
[Unified Plan] Support multiple BUNDLE groups. In this CL, JsepTransportController and MediaSessionDescriptionFactory are updated not to assume that there only exists at most a single BUNDLE group but a list of N groups. This makes it possible to create multiple BUNDLE groups by having multiple "a=group:BUNDLE" lines in the SDP. This makes it possible to have some m= sections in one group and some other m= sections in another group. For example, you could group all audio m= sections in one group and all video m= sections in another group. This enables "send all audio tracks on one transport and all video tracks on another transport" in Unified Plan. This is something that was possible in Plan B because all ssrcs in the same m= section were implicitly bundled together forming a group of audio m= section and video m= section (even without use of the BUNDLE tag). PeerConnection will never create multiple BUNDLE groups by default, but upon setting SDP with multiple BUNDLE groups the PeerConnection will accept them if configured to accept BUNDLE. This makes it possible to accept an SFU's BUNDLE offer without having to SDP munge the answer. C++ unit tests are added. This fix has also been verified manually on: https://jsfiddle.net/henbos/to89L6ce/43/ Without fix: 0+2 get bundled, 1+3 don't get bundled. With fix: 0+2 get bundled in first group, 1+3 get bundled in second group. Bug: webrtc:10208 Change-Id: Iaf451fa5459c484730c8018274166ef154b19af8 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214487 Reviewed-by: Taylor <deadbeef@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33838}
2021-04-26 21:04:26 +02:00
} else {
transports_.RemoveTransportForMid(content_info.name);
[Unified Plan] Support multiple BUNDLE groups. In this CL, JsepTransportController and MediaSessionDescriptionFactory are updated not to assume that there only exists at most a single BUNDLE group but a list of N groups. This makes it possible to create multiple BUNDLE groups by having multiple "a=group:BUNDLE" lines in the SDP. This makes it possible to have some m= sections in one group and some other m= sections in another group. For example, you could group all audio m= sections in one group and all video m= sections in another group. This enables "send all audio tracks on one transport and all video tracks on another transport" in Unified Plan. This is something that was possible in Plan B because all ssrcs in the same m= section were implicitly bundled together forming a group of audio m= section and video m= section (even without use of the BUNDLE tag). PeerConnection will never create multiple BUNDLE groups by default, but upon setting SDP with multiple BUNDLE groups the PeerConnection will accept them if configured to accept BUNDLE. This makes it possible to accept an SFU's BUNDLE offer without having to SDP munge the answer. C++ unit tests are added. This fix has also been verified manually on: https://jsfiddle.net/henbos/to89L6ce/43/ Without fix: 0+2 get bundled, 1+3 don't get bundled. With fix: 0+2 get bundled in first group, 1+3 get bundled in second group. Bug: webrtc:10208 Change-Id: Iaf451fa5459c484730c8018274166ef154b19af8 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214487 Reviewed-by: Taylor <deadbeef@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33838}
2021-04-26 21:04:26 +02:00
if (bundle_group) {
Reland "Use backticks not vertical bars to denote variables in comments for /pc" Original change's description: > Revert "Use backticks not vertical bars to denote variables in comments for /pc" > > This reverts commit 37ee0f5e594dd772ec6d620b5e5ea8a751b684f0. > > Reason for revert: Revert in order to be able to revert https://webrtc-review.googlesource.com/c/src/+/225642 > > Original change's description: > > Use backticks not vertical bars to denote variables in comments for /pc > > > > Bug: webrtc:12338 > > Change-Id: I88cf10afa5fc810b95d2a585ab2e895dcc163b63 > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/226953 > > Reviewed-by: Harald Alvestrand <hta@webrtc.org> > > Commit-Queue: Artem Titov <titovartem@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#34575} > > TBR=hta@webrtc.org,titovartem@webrtc.org,webrtc-scoped@luci-project-accounts.iam.gserviceaccount.com > > Change-Id: I5eddd3a14e1f664bf831e5c294fbc4de5f6a88af > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:12338 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/227082 > Reviewed-by: Björn Terelius <terelius@webrtc.org> > Commit-Queue: Björn Terelius <terelius@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#34577} Bug: webrtc:12338 Change-Id: I96bd229b73613c162d11d75fa4f5934e1b4295c7 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/227087 Commit-Queue: Artem Titov <titovartem@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/master@{#34611}
2021-07-30 22:30:23 +02:00
// Remove the rejected content from the `bundle_group`.
bundles_.DeleteMid(bundle_group, content_info.name);
}
}
}
bool JsepTransportController::HandleBundledContent(
[Unified Plan] Support multiple BUNDLE groups. In this CL, JsepTransportController and MediaSessionDescriptionFactory are updated not to assume that there only exists at most a single BUNDLE group but a list of N groups. This makes it possible to create multiple BUNDLE groups by having multiple "a=group:BUNDLE" lines in the SDP. This makes it possible to have some m= sections in one group and some other m= sections in another group. For example, you could group all audio m= sections in one group and all video m= sections in another group. This enables "send all audio tracks on one transport and all video tracks on another transport" in Unified Plan. This is something that was possible in Plan B because all ssrcs in the same m= section were implicitly bundled together forming a group of audio m= section and video m= section (even without use of the BUNDLE tag). PeerConnection will never create multiple BUNDLE groups by default, but upon setting SDP with multiple BUNDLE groups the PeerConnection will accept them if configured to accept BUNDLE. This makes it possible to accept an SFU's BUNDLE offer without having to SDP munge the answer. C++ unit tests are added. This fix has also been verified manually on: https://jsfiddle.net/henbos/to89L6ce/43/ Without fix: 0+2 get bundled, 1+3 don't get bundled. With fix: 0+2 get bundled in first group, 1+3 get bundled in second group. Bug: webrtc:10208 Change-Id: Iaf451fa5459c484730c8018274166ef154b19af8 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214487 Reviewed-by: Taylor <deadbeef@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33838}
2021-04-26 21:04:26 +02:00
const cricket::ContentInfo& content_info,
const cricket::ContentGroup& bundle_group) {
TRACE_EVENT0("webrtc", "JsepTransportController::HandleBundledContent");
[Unified Plan] Support multiple BUNDLE groups. In this CL, JsepTransportController and MediaSessionDescriptionFactory are updated not to assume that there only exists at most a single BUNDLE group but a list of N groups. This makes it possible to create multiple BUNDLE groups by having multiple "a=group:BUNDLE" lines in the SDP. This makes it possible to have some m= sections in one group and some other m= sections in another group. For example, you could group all audio m= sections in one group and all video m= sections in another group. This enables "send all audio tracks on one transport and all video tracks on another transport" in Unified Plan. This is something that was possible in Plan B because all ssrcs in the same m= section were implicitly bundled together forming a group of audio m= section and video m= section (even without use of the BUNDLE tag). PeerConnection will never create multiple BUNDLE groups by default, but upon setting SDP with multiple BUNDLE groups the PeerConnection will accept them if configured to accept BUNDLE. This makes it possible to accept an SFU's BUNDLE offer without having to SDP munge the answer. C++ unit tests are added. This fix has also been verified manually on: https://jsfiddle.net/henbos/to89L6ce/43/ Without fix: 0+2 get bundled, 1+3 don't get bundled. With fix: 0+2 get bundled in first group, 1+3 get bundled in second group. Bug: webrtc:10208 Change-Id: Iaf451fa5459c484730c8018274166ef154b19af8 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214487 Reviewed-by: Taylor <deadbeef@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33838}
2021-04-26 21:04:26 +02:00
RTC_DCHECK(bundle_group.FirstContentName());
auto jsep_transport =
GetJsepTransportByName(*bundle_group.FirstContentName());
RTC_DCHECK(jsep_transport);
// If the content is bundled, let the
// BaseChannel/SctpTransport change the RtpTransport/DtlsTransport first,
// then destroy the cricket::JsepTransport.
// TODO(bugs.webrtc.org/9719) For media transport this is far from ideal,
// because it means that we first create media transport and start
// connecting it, and then we destroy it. We will need to address it before
// video path is enabled.
return transports_.SetTransportForMid(content_info.name, jsep_transport);
}
cricket::JsepTransportDescription
JsepTransportController::CreateJsepTransportDescription(
const cricket::ContentInfo& content_info,
const cricket::TransportInfo& transport_info,
const std::vector<int>& encrypted_extension_ids,
int rtp_abs_sendtime_extn_id) {
TRACE_EVENT0("webrtc",
"JsepTransportController::CreateJsepTransportDescription");
const cricket::MediaContentDescription* content_desc =
content_info.media_description();
RTC_DCHECK(content_desc);
bool rtcp_mux_enabled = content_info.type == cricket::MediaProtocolType::kSctp
? true
: content_desc->rtcp_mux();
return cricket::JsepTransportDescription(
rtcp_mux_enabled, content_desc->cryptos(), encrypted_extension_ids,
rtp_abs_sendtime_extn_id, transport_info.description);
}
std::vector<int> JsepTransportController::GetEncryptedHeaderExtensionIds(
const cricket::ContentInfo& content_info) {
const cricket::MediaContentDescription* content_desc =
content_info.media_description();
Reland "Move CryptoOptions to api/crypto from rtc_base/sslstreamadapter.h" Promotes rtc::CryptoOptions to webrtc::CryptoOptions converting it from class that only handles SRTP configuration to a more generic structure that can be used and extended for all per peer connection CryptoOptions that can be on a given PeerConnection. Now all SRTP related options are under webrtc::CryptoOptions::Srtp and can be accessed as crypto_options.srtp.whatever_option_name. This is more inline with other structures we have in WebRTC such as VideoConfig. As additional features are added over time this will allow the structure to remain compartmentalized and concerned components can only request a subset of the overall configuration structure e.g: void MySrtpFunction(const webrtc::CryptoOptions::Srtp& srtp_config); In addition to this it made little sense for sslstreamadapter.h to hold all Srtp related configuration options. The header has become loo large and takes on too many responsibilities and spilting this up will lead to more maintainable code going forward. This will be used in a future CL to enable configuration options for the newly supported Frame Crypto. Reland Fix: - cryptooptions.h - now has enable_aes128_sha1_32_crypto_cipher as an optional root level configuration. - peerconnectionfactory - If this optional is set will now overwrite the underyling value. This along with the other field will be deprecated once dependent projects are updated. TBR=sakal@webrtc.org,kthelgason@webrtc.org,emadomara@webrtc.org,qingsi@webrtc.org Bug: webrtc:9681 Change-Id: Iaa6b741baafb85d352e42f54226119f19d97151d Reviewed-on: https://webrtc-review.googlesource.com/c/105560 Reviewed-by: Benjamin Wright <benwright@webrtc.org> Reviewed-by: Steve Anton <steveanton@webrtc.org> Reviewed-by: Emad Omara <emadomara@webrtc.org> Commit-Queue: Benjamin Wright <benwright@webrtc.org> Cr-Commit-Position: refs/heads/master@{#25135}
2018-10-11 15:33:17 -07:00
if (!config_.crypto_options.srtp.enable_encrypted_rtp_header_extensions) {
return std::vector<int>();
}
std::vector<int> encrypted_header_extension_ids;
for (const auto& extension : content_desc->rtp_header_extensions()) {
if (!extension.encrypt) {
continue;
}
if (!absl::c_linear_search(encrypted_header_extension_ids, extension.id)) {
encrypted_header_extension_ids.push_back(extension.id);
}
}
return encrypted_header_extension_ids;
}
[Unified Plan] Support multiple BUNDLE groups. In this CL, JsepTransportController and MediaSessionDescriptionFactory are updated not to assume that there only exists at most a single BUNDLE group but a list of N groups. This makes it possible to create multiple BUNDLE groups by having multiple "a=group:BUNDLE" lines in the SDP. This makes it possible to have some m= sections in one group and some other m= sections in another group. For example, you could group all audio m= sections in one group and all video m= sections in another group. This enables "send all audio tracks on one transport and all video tracks on another transport" in Unified Plan. This is something that was possible in Plan B because all ssrcs in the same m= section were implicitly bundled together forming a group of audio m= section and video m= section (even without use of the BUNDLE tag). PeerConnection will never create multiple BUNDLE groups by default, but upon setting SDP with multiple BUNDLE groups the PeerConnection will accept them if configured to accept BUNDLE. This makes it possible to accept an SFU's BUNDLE offer without having to SDP munge the answer. C++ unit tests are added. This fix has also been verified manually on: https://jsfiddle.net/henbos/to89L6ce/43/ Without fix: 0+2 get bundled, 1+3 don't get bundled. With fix: 0+2 get bundled in first group, 1+3 get bundled in second group. Bug: webrtc:10208 Change-Id: Iaf451fa5459c484730c8018274166ef154b19af8 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214487 Reviewed-by: Taylor <deadbeef@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33838}
2021-04-26 21:04:26 +02:00
std::map<const cricket::ContentGroup*, std::vector<int>>
JsepTransportController::MergeEncryptedHeaderExtensionIdsForBundles(
const cricket::SessionDescription* description) {
RTC_DCHECK(description);
RTC_DCHECK(!bundles_.bundle_groups().empty());
[Unified Plan] Support multiple BUNDLE groups. In this CL, JsepTransportController and MediaSessionDescriptionFactory are updated not to assume that there only exists at most a single BUNDLE group but a list of N groups. This makes it possible to create multiple BUNDLE groups by having multiple "a=group:BUNDLE" lines in the SDP. This makes it possible to have some m= sections in one group and some other m= sections in another group. For example, you could group all audio m= sections in one group and all video m= sections in another group. This enables "send all audio tracks on one transport and all video tracks on another transport" in Unified Plan. This is something that was possible in Plan B because all ssrcs in the same m= section were implicitly bundled together forming a group of audio m= section and video m= section (even without use of the BUNDLE tag). PeerConnection will never create multiple BUNDLE groups by default, but upon setting SDP with multiple BUNDLE groups the PeerConnection will accept them if configured to accept BUNDLE. This makes it possible to accept an SFU's BUNDLE offer without having to SDP munge the answer. C++ unit tests are added. This fix has also been verified manually on: https://jsfiddle.net/henbos/to89L6ce/43/ Without fix: 0+2 get bundled, 1+3 don't get bundled. With fix: 0+2 get bundled in first group, 1+3 get bundled in second group. Bug: webrtc:10208 Change-Id: Iaf451fa5459c484730c8018274166ef154b19af8 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214487 Reviewed-by: Taylor <deadbeef@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33838}
2021-04-26 21:04:26 +02:00
std::map<const cricket::ContentGroup*, std::vector<int>>
merged_encrypted_extension_ids_by_bundle;
// Union the encrypted header IDs in the group when bundle is enabled.
for (const cricket::ContentInfo& content_info : description->contents()) {
auto group = bundles_.LookupGroupByMid(content_info.name);
if (!group)
[Unified Plan] Support multiple BUNDLE groups. In this CL, JsepTransportController and MediaSessionDescriptionFactory are updated not to assume that there only exists at most a single BUNDLE group but a list of N groups. This makes it possible to create multiple BUNDLE groups by having multiple "a=group:BUNDLE" lines in the SDP. This makes it possible to have some m= sections in one group and some other m= sections in another group. For example, you could group all audio m= sections in one group and all video m= sections in another group. This enables "send all audio tracks on one transport and all video tracks on another transport" in Unified Plan. This is something that was possible in Plan B because all ssrcs in the same m= section were implicitly bundled together forming a group of audio m= section and video m= section (even without use of the BUNDLE tag). PeerConnection will never create multiple BUNDLE groups by default, but upon setting SDP with multiple BUNDLE groups the PeerConnection will accept them if configured to accept BUNDLE. This makes it possible to accept an SFU's BUNDLE offer without having to SDP munge the answer. C++ unit tests are added. This fix has also been verified manually on: https://jsfiddle.net/henbos/to89L6ce/43/ Without fix: 0+2 get bundled, 1+3 don't get bundled. With fix: 0+2 get bundled in first group, 1+3 get bundled in second group. Bug: webrtc:10208 Change-Id: Iaf451fa5459c484730c8018274166ef154b19af8 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214487 Reviewed-by: Taylor <deadbeef@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33838}
2021-04-26 21:04:26 +02:00
continue;
// Get or create list of IDs for the BUNDLE group.
std::vector<int>& merged_ids =
merged_encrypted_extension_ids_by_bundle[group];
[Unified Plan] Support multiple BUNDLE groups. In this CL, JsepTransportController and MediaSessionDescriptionFactory are updated not to assume that there only exists at most a single BUNDLE group but a list of N groups. This makes it possible to create multiple BUNDLE groups by having multiple "a=group:BUNDLE" lines in the SDP. This makes it possible to have some m= sections in one group and some other m= sections in another group. For example, you could group all audio m= sections in one group and all video m= sections in another group. This enables "send all audio tracks on one transport and all video tracks on another transport" in Unified Plan. This is something that was possible in Plan B because all ssrcs in the same m= section were implicitly bundled together forming a group of audio m= section and video m= section (even without use of the BUNDLE tag). PeerConnection will never create multiple BUNDLE groups by default, but upon setting SDP with multiple BUNDLE groups the PeerConnection will accept them if configured to accept BUNDLE. This makes it possible to accept an SFU's BUNDLE offer without having to SDP munge the answer. C++ unit tests are added. This fix has also been verified manually on: https://jsfiddle.net/henbos/to89L6ce/43/ Without fix: 0+2 get bundled, 1+3 don't get bundled. With fix: 0+2 get bundled in first group, 1+3 get bundled in second group. Bug: webrtc:10208 Change-Id: Iaf451fa5459c484730c8018274166ef154b19af8 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214487 Reviewed-by: Taylor <deadbeef@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33838}
2021-04-26 21:04:26 +02:00
// Add IDs not already in the list.
std::vector<int> extension_ids =
GetEncryptedHeaderExtensionIds(content_info);
for (int id : extension_ids) {
if (!absl::c_linear_search(merged_ids, id)) {
merged_ids.push_back(id);
}
}
}
[Unified Plan] Support multiple BUNDLE groups. In this CL, JsepTransportController and MediaSessionDescriptionFactory are updated not to assume that there only exists at most a single BUNDLE group but a list of N groups. This makes it possible to create multiple BUNDLE groups by having multiple "a=group:BUNDLE" lines in the SDP. This makes it possible to have some m= sections in one group and some other m= sections in another group. For example, you could group all audio m= sections in one group and all video m= sections in another group. This enables "send all audio tracks on one transport and all video tracks on another transport" in Unified Plan. This is something that was possible in Plan B because all ssrcs in the same m= section were implicitly bundled together forming a group of audio m= section and video m= section (even without use of the BUNDLE tag). PeerConnection will never create multiple BUNDLE groups by default, but upon setting SDP with multiple BUNDLE groups the PeerConnection will accept them if configured to accept BUNDLE. This makes it possible to accept an SFU's BUNDLE offer without having to SDP munge the answer. C++ unit tests are added. This fix has also been verified manually on: https://jsfiddle.net/henbos/to89L6ce/43/ Without fix: 0+2 get bundled, 1+3 don't get bundled. With fix: 0+2 get bundled in first group, 1+3 get bundled in second group. Bug: webrtc:10208 Change-Id: Iaf451fa5459c484730c8018274166ef154b19af8 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214487 Reviewed-by: Taylor <deadbeef@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33838}
2021-04-26 21:04:26 +02:00
return merged_encrypted_extension_ids_by_bundle;
}
int JsepTransportController::GetRtpAbsSendTimeHeaderExtensionId(
const cricket::ContentInfo& content_info) {
if (!config_.enable_external_auth) {
return -1;
}
const cricket::MediaContentDescription* content_desc =
content_info.media_description();
const webrtc::RtpExtension* send_time_extension =
webrtc::RtpExtension::FindHeaderExtensionByUri(
content_desc->rtp_header_extensions(),
webrtc::RtpExtension::kAbsSendTimeUri,
config_.crypto_options.srtp.enable_encrypted_rtp_header_extensions
? webrtc::RtpExtension::kPreferEncryptedExtension
: webrtc::RtpExtension::kDiscardEncryptedExtension);
return send_time_extension ? send_time_extension->id : -1;
}
const cricket::JsepTransport* JsepTransportController::GetJsepTransportForMid(
const std::string& mid) const {
return transports_.GetTransportForMid(mid);
}
cricket::JsepTransport* JsepTransportController::GetJsepTransportForMid(
const std::string& mid) {
return transports_.GetTransportForMid(mid);
}
const cricket::JsepTransport* JsepTransportController::GetJsepTransportForMid(
absl::string_view mid) const {
return transports_.GetTransportForMid(mid);
}
cricket::JsepTransport* JsepTransportController::GetJsepTransportForMid(
absl::string_view mid) {
return transports_.GetTransportForMid(mid);
}
const cricket::JsepTransport* JsepTransportController::GetJsepTransportByName(
const std::string& transport_name) const {
return transports_.GetTransportByName(transport_name);
}
cricket::JsepTransport* JsepTransportController::GetJsepTransportByName(
const std::string& transport_name) {
return transports_.GetTransportByName(transport_name);
}
RTCError JsepTransportController::MaybeCreateJsepTransport(
bool local,
const cricket::ContentInfo& content_info,
const cricket::SessionDescription& description) {
cricket::JsepTransport* transport = GetJsepTransportByName(content_info.name);
if (transport) {
return RTCError::OK();
}
const cricket::MediaContentDescription* content_desc =
content_info.media_description();
if (certificate_ && !content_desc->cryptos().empty()) {
return RTCError(RTCErrorType::INVALID_PARAMETER,
"SDES and DTLS-SRTP cannot be enabled at the same time.");
}
rtc::scoped_refptr<webrtc::IceTransportInterface> ice =
CreateIceTransport(content_info.name, /*rtcp=*/false);
RTC_DCHECK(ice);
std::unique_ptr<cricket::DtlsTransportInternal> rtp_dtls_transport =
CreateDtlsTransport(content_info, ice->internal());
std::unique_ptr<cricket::DtlsTransportInternal> rtcp_dtls_transport;
std::unique_ptr<RtpTransport> unencrypted_rtp_transport;
std::unique_ptr<SrtpTransport> sdes_transport;
std::unique_ptr<DtlsSrtpTransport> dtls_srtp_transport;
rtc::scoped_refptr<webrtc::IceTransportInterface> rtcp_ice;
if (config_.rtcp_mux_policy !=
PeerConnectionInterface::kRtcpMuxPolicyRequire &&
content_info.type == cricket::MediaProtocolType::kRtp) {
rtcp_ice = CreateIceTransport(content_info.name, /*rtcp=*/true);
rtcp_dtls_transport =
CreateDtlsTransport(content_info, rtcp_ice->internal());
Reland: Implement true negotiation for DatagramTransport with fallback to RTP. In short, the caller places a x-opaque line in SDP for each m= section that uses datagram transport. If the answerer supports datagram transport, it will parse this line and create a datagram transport. It will then echo the x-opaque line into the answer (to indicate that it accepted use of datagram transport). If the offer and answer contain exactly the same x-opaque line, both peers will use datagram transport. If the x-opaque line is omitted from the answer (or is different in the answer) they will fall back to RTP. Note that a different x-opaque line in the answer means the answerer did not understand something in the negotiation proto. Since WebRTC cannot know what was misunderstood, or whether it's still possible to use the datagram transport, it must fall back to RTP. This may change in the future, possibly by passing the answer to the datagram transport, but it's good enough for now. Negotiation consists of four parts: 1. DatagramTransport exposes transport parameters for both client and server perspectives. The client just echoes what it received from the server (modulo any fields it might not have understood). 2. SDP adds a x-opaque line for opaque transport parameters. Identical to x-mt, but this is specific to datagram transport and goes in each m= section, and appears in the answer as well as the offer. - This is propagated to Jsep as part of the TransportDescription. - SDP files: transport_description.h,cc, transport_description_factory.h,cc, media_session.cc, webrtc_sdp.cc 3. JsepTransport/Controller: - Exposes opaque parameters for each mid (m= section). On offerer, this means pre-allocating a datagram transport and getting its parameters. On the answerer, this means echoing the offerer's parameters. - Uses a composite RTP transport to receive from either default RTP or datagram transport until both offer and answer arrive. - If a provisional answer arrives, sets the composite to send on the provisionally selected transport. - Once both offer and answer are set, deletes the unneeded transports and keeps whichever transport is selected. 4. PeerConnection pulls transport parameters out of Jsep and adds them to SDP. Bug: webrtc:9719 Change-Id: Ifcc428c8d76fb77dcc8abaa79507c620bcfb31b9 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/140920 Reviewed-by: Steve Anton <steveanton@webrtc.org> Commit-Queue: Bjorn Mellem <mellem@webrtc.org> Cr-Commit-Position: refs/heads/master@{#28198}
2019-06-07 10:28:06 -07:00
}
if (config_.disable_encryption) {
RTC_LOG(LS_INFO)
<< "Creating UnencryptedRtpTransport, becayse encryption is disabled.";
unencrypted_rtp_transport = CreateUnencryptedRtpTransport(
content_info.name, rtp_dtls_transport.get(), rtcp_dtls_transport.get());
} else if (!content_desc->cryptos().empty()) {
sdes_transport = CreateSdesTransport(
content_info.name, rtp_dtls_transport.get(), rtcp_dtls_transport.get());
RTC_LOG(LS_INFO) << "Creating SdesTransport.";
} else {
RTC_LOG(LS_INFO) << "Creating DtlsSrtpTransport.";
dtls_srtp_transport = CreateDtlsSrtpTransport(
content_info.name, rtp_dtls_transport.get(), rtcp_dtls_transport.get());
}
Reland "Reland "Refactor SCTP data channels to use DataChannelTransportInterface."" This is a reland of 487f9a17e426fd14bb06b13e861071b3f15d119b Original change's description: > Reland "Refactor SCTP data channels to use DataChannelTransportInterface." > > Also clears SctpTransport before deleting JsepTransport. > > SctpTransport is ref-counted, but the underlying transport is deleted when > JsepTransport clears the rtp_dtls_transport. This results in crashes when > usrsctp attempts to send outgoing packets through a dangling pointer to the > underlying transport. > > Clearing SctpTransport before DtlsTransport removes the pointer to the > underlying transport before it becomes invalid. > > This fixes a crash in chromium's web platform tests (see > https://chromium-review.googlesource.com/c/chromium/src/+/1776711). > > Original change's description: > > Refactor SCTP data channels to use DataChannelTransportInterface. > > > > This change moves SctpTransport to be owned by JsepTransport, which now > > holds a DataChannelTransport implementation for SCTP when it is used for > > data channels. > > > > This simplifies negotiation and fallback to SCTP. Negotiation can now > > use a composite DataChannelTransport, just as negotiation for RTP uses a > > composite RTP transport. > > > > PeerConnection also has one fewer way it needs to manage data channels. > > It now handles SCTP and datagram- or media-transport-based data channels > > the same way. > > > > There are a few leaky abstractions left. For example, PeerConnection > > calls Start() on the SctpTransport at a particular point in negotiation, > > but does not need to call this for other transports. Similarly, PC > > exposes an interface to the SCTP transport directly to the user; there > > is no equivalent for other transports. > > Bug: webrtc:9719 > Change-Id: I64e94b88afb119fdbf5f22750f88c8a084d53937 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/151981 > Reviewed-by: Benjamin Wright <benwright@webrtc.org> > Reviewed-by: Steve Anton <steveanton@webrtc.org> > Commit-Queue: Benjamin Wright <benwright@webrtc.org> > Commit-Queue: Bjorn Mellem <mellem@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#29120} Bug: webrtc:9719 Change-Id: I28481a3de64a3506bc57748106383eeba4ef205c Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/152740 Reviewed-by: Artem Titov <titovartem@webrtc.org> Reviewed-by: Benjamin Wright <benwright@webrtc.org> Reviewed-by: Seth Hampson <shampson@webrtc.org> Commit-Queue: Bjorn Mellem <mellem@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29290}
2019-09-23 14:53:54 -07:00
std::unique_ptr<cricket::SctpTransportInternal> sctp_transport;
if (config_.sctp_factory) {
sctp_transport =
config_.sctp_factory->CreateSctpTransport(rtp_dtls_transport.get());
}
std::unique_ptr<cricket::JsepTransport> jsep_transport =
Use std::make_unique instead of absl::make_unique. WebRTC is now using C++14 so there is no need to use the Abseil version of std::make_unique. This CL has been created with the following steps: git grep -l absl::make_unique | sort | uniq > /tmp/make_unique.txt git grep -l absl::WrapUnique | sort | uniq > /tmp/wrap_unique.txt git grep -l "#include <memory>" | sort | uniq > /tmp/memory.txt diff --new-line-format="" --unchanged-line-format="" \ /tmp/make_unique.txt /tmp/wrap_unique.txt | sort | \ uniq > /tmp/only_make_unique.txt diff --new-line-format="" --unchanged-line-format="" \ /tmp/only_make_unique.txt /tmp/memory.txt | \ xargs grep -l "absl/memory" > /tmp/add-memory.txt git grep -l "\babsl::make_unique\b" | \ xargs sed -i "s/\babsl::make_unique\b/std::make_unique/g" git checkout PRESUBMIT.py abseil-in-webrtc.md cat /tmp/add-memory.txt | \ xargs sed -i \ 's/#include "absl\/memory\/memory.h"/#include <memory>/g' git cl format # Manual fix order of the new inserted #include <memory> cat /tmp/only_make_unique | xargs grep -l "#include <memory>" | \ xargs sed -i '/#include "absl\/memory\/memory.h"/d' git ls-files | grep BUILD.gn | \ xargs sed -i '/\/\/third_party\/abseil-cpp\/absl\/memory/d' python tools_webrtc/gn_check_autofix.py \ -m tryserver.webrtc -b linux_rel # Repead the gn_check_autofix step for other platforms git ls-files | grep BUILD.gn | \ xargs sed -i 's/absl\/memory:memory/absl\/memory/g' git cl format Bug: webrtc:10945 Change-Id: I3fe28ea80f4dd3ba3cf28effd151d5e1f19aff89 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/153221 Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Alessio Bazzica <alessiob@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29209}
2019-09-17 17:06:18 +02:00
std::make_unique<cricket::JsepTransport>(
content_info.name, certificate_, std::move(ice), std::move(rtcp_ice),
std::move(unencrypted_rtp_transport), std::move(sdes_transport),
std::move(dtls_srtp_transport), std::move(rtp_dtls_transport),
std::move(rtcp_dtls_transport), std::move(sctp_transport), [&]() {
RTC_DCHECK_RUN_ON(network_thread_);
UpdateAggregateStates_n();
});
jsep_transport->rtp_transport()->SignalRtcpPacketReceived.connect(
this, &JsepTransportController::OnRtcpPacketReceived_n);
transports_.RegisterTransport(content_info.name, std::move(jsep_transport));
UpdateAggregateStates_n();
return RTCError::OK();
}
void JsepTransportController::DestroyAllJsepTransports_n() {
transports_.DestroyAllTransports();
}
void JsepTransportController::SetIceRole_n(cricket::IceRole ice_role) {
ice_role_ = ice_role;
auto dtls_transports = GetDtlsTransports();
for (auto& dtls : dtls_transports) {
dtls->ice_transport()->SetIceRole(ice_role_);
}
}
cricket::IceRole JsepTransportController::DetermineIceRole(
cricket::JsepTransport* jsep_transport,
const cricket::TransportInfo& transport_info,
SdpType type,
bool local) {
cricket::IceRole ice_role = ice_role_;
auto tdesc = transport_info.description;
if (local) {
// The initial offer side may use ICE Lite, in which case, per RFC5245
// Section 5.1.1, the answer side should take the controlling role if it is
// in the full ICE mode.
//
// When both sides use ICE Lite, the initial offer side must take the
// controlling role, and this is the default logic implemented in
// SetLocalDescription in JsepTransportController.
if (jsep_transport->remote_description() &&
jsep_transport->remote_description()->transport_desc.ice_mode ==
cricket::ICEMODE_LITE &&
ice_role_ == cricket::ICEROLE_CONTROLLED &&
tdesc.ice_mode == cricket::ICEMODE_FULL) {
ice_role = cricket::ICEROLE_CONTROLLING;
}
} else {
// If our role is cricket::ICEROLE_CONTROLLED and the remote endpoint
// supports only ice_lite, this local endpoint should take the CONTROLLING
// role.
// TODO(deadbeef): This is a session-level attribute, so it really shouldn't
// be in a TransportDescription in the first place...
if (ice_role_ == cricket::ICEROLE_CONTROLLED &&
tdesc.ice_mode == cricket::ICEMODE_LITE) {
ice_role = cricket::ICEROLE_CONTROLLING;
}
// If we use ICE Lite and the remote endpoint uses the full implementation
// of ICE, the local endpoint must take the controlled role, and the other
// side must be the controlling role.
if (jsep_transport->local_description() &&
jsep_transport->local_description()->transport_desc.ice_mode ==
cricket::ICEMODE_LITE &&
ice_role_ == cricket::ICEROLE_CONTROLLING &&
tdesc.ice_mode == cricket::ICEMODE_FULL) {
ice_role = cricket::ICEROLE_CONTROLLED;
}
}
return ice_role;
}
void JsepTransportController::OnTransportWritableState_n(
rtc::PacketTransportInternal* transport) {
RTC_LOG(LS_INFO) << " Transport " << transport->transport_name()
<< " writability changed to " << transport->writable()
<< ".";
UpdateAggregateStates_n();
}
void JsepTransportController::OnTransportReceivingState_n(
rtc::PacketTransportInternal* transport) {
UpdateAggregateStates_n();
}
void JsepTransportController::OnTransportGatheringState_n(
cricket::IceTransportInternal* transport) {
UpdateAggregateStates_n();
}
void JsepTransportController::OnTransportCandidateGathered_n(
cricket::IceTransportInternal* transport,
const cricket::Candidate& candidate) {
// We should never signal peer-reflexive candidates.
if (candidate.type() == cricket::PRFLX_PORT_TYPE) {
RTC_DCHECK_NOTREACHED();
return;
}
Reland "Remove thread hops from events provided by JsepTransportController." This reverts commit 6e4fcac31312f2dda5b60d33874ff0cd62f94321. Reason for revert: Parent CL issue has been resolved. Original change's description: > Revert "Remove thread hops from events provided by JsepTransportController." > > This reverts commit f554b3c577f69fa9ffad5c07155898c2d985ac76. > > Reason for revert: Parent CL breaks FYI bots. > See https://webrtc-review.googlesource.com/c/src/+/206466 > > Original change's description: > > Remove thread hops from events provided by JsepTransportController. > > > > Events associated with Subscribe* methods in JTC had trampolines that > > would use an async invoker to fire the events on the signaling thread. > > This was being done for the purposes of PeerConnection but the concept > > of a signaling thread is otherwise not applicable to JTC and use of > > JTC from PC is inconsistent across threads (as has been flagged in > > webrtc:9987). > > > > This change makes all CallbackList members only accessible from the > > network thread and moves the signaling thread related work over to > > PeerConnection, which makes hops there more visible as well as making > > that class easier to refactor for thread efficiency. > > > > This CL removes the AsyncInvoker from JTC (webrtc:12339) > > > > The signaling_thread_ variable is also removed from JTC and more thread > > checks added to catch errors. > > > > Bug: webrtc:12427, webrtc:11988, webrtc:12339 > > Change-Id: Id232aedd00dfd5403b2ba0ca147d3eca7c12c7c5 > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206062 > > Commit-Queue: Tommi <tommi@webrtc.org> > > Reviewed-by: Niels Moller <nisse@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#33195} > > TBR=nisse@webrtc.org,tommi@webrtc.org > > Change-Id: I6134b71b74a9408854b79d44506d513519e9cf4d > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:12427 > Bug: webrtc:11988 > Bug: webrtc:12339 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206467 > Reviewed-by: Guido Urdaneta <guidou@webrtc.org> > Commit-Queue: Guido Urdaneta <guidou@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#33203} TBR=nisse@webrtc.org,tommi@webrtc.org,guidou@webrtc.org # Not skipping CQ checks because original CL landed > 1 day ago. Bug: webrtc:12427 Bug: webrtc:11988 Bug: webrtc:12339 Change-Id: I4e2e1490e1f9a87ed6ac4d722fd3c442e3059ae0 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206809 Reviewed-by: Tommi <tommi@webrtc.org> Commit-Queue: Tommi <tommi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33225}
2021-02-10 17:40:08 +00:00
signal_ice_candidates_gathered_.Send(
transport->transport_name(), std::vector<cricket::Candidate>{candidate});
}
void JsepTransportController::OnTransportCandidateError_n(
cricket::IceTransportInternal* transport,
const cricket::IceCandidateErrorEvent& event) {
Reland "Remove thread hops from events provided by JsepTransportController." This reverts commit 6e4fcac31312f2dda5b60d33874ff0cd62f94321. Reason for revert: Parent CL issue has been resolved. Original change's description: > Revert "Remove thread hops from events provided by JsepTransportController." > > This reverts commit f554b3c577f69fa9ffad5c07155898c2d985ac76. > > Reason for revert: Parent CL breaks FYI bots. > See https://webrtc-review.googlesource.com/c/src/+/206466 > > Original change's description: > > Remove thread hops from events provided by JsepTransportController. > > > > Events associated with Subscribe* methods in JTC had trampolines that > > would use an async invoker to fire the events on the signaling thread. > > This was being done for the purposes of PeerConnection but the concept > > of a signaling thread is otherwise not applicable to JTC and use of > > JTC from PC is inconsistent across threads (as has been flagged in > > webrtc:9987). > > > > This change makes all CallbackList members only accessible from the > > network thread and moves the signaling thread related work over to > > PeerConnection, which makes hops there more visible as well as making > > that class easier to refactor for thread efficiency. > > > > This CL removes the AsyncInvoker from JTC (webrtc:12339) > > > > The signaling_thread_ variable is also removed from JTC and more thread > > checks added to catch errors. > > > > Bug: webrtc:12427, webrtc:11988, webrtc:12339 > > Change-Id: Id232aedd00dfd5403b2ba0ca147d3eca7c12c7c5 > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206062 > > Commit-Queue: Tommi <tommi@webrtc.org> > > Reviewed-by: Niels Moller <nisse@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#33195} > > TBR=nisse@webrtc.org,tommi@webrtc.org > > Change-Id: I6134b71b74a9408854b79d44506d513519e9cf4d > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:12427 > Bug: webrtc:11988 > Bug: webrtc:12339 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206467 > Reviewed-by: Guido Urdaneta <guidou@webrtc.org> > Commit-Queue: Guido Urdaneta <guidou@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#33203} TBR=nisse@webrtc.org,tommi@webrtc.org,guidou@webrtc.org # Not skipping CQ checks because original CL landed > 1 day ago. Bug: webrtc:12427 Bug: webrtc:11988 Bug: webrtc:12339 Change-Id: I4e2e1490e1f9a87ed6ac4d722fd3c442e3059ae0 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206809 Reviewed-by: Tommi <tommi@webrtc.org> Commit-Queue: Tommi <tommi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33225}
2021-02-10 17:40:08 +00:00
signal_ice_candidate_error_.Send(event);
}
void JsepTransportController::OnTransportCandidatesRemoved_n(
cricket::IceTransportInternal* transport,
const cricket::Candidates& candidates) {
Reland "Remove thread hops from events provided by JsepTransportController." This reverts commit 6e4fcac31312f2dda5b60d33874ff0cd62f94321. Reason for revert: Parent CL issue has been resolved. Original change's description: > Revert "Remove thread hops from events provided by JsepTransportController." > > This reverts commit f554b3c577f69fa9ffad5c07155898c2d985ac76. > > Reason for revert: Parent CL breaks FYI bots. > See https://webrtc-review.googlesource.com/c/src/+/206466 > > Original change's description: > > Remove thread hops from events provided by JsepTransportController. > > > > Events associated with Subscribe* methods in JTC had trampolines that > > would use an async invoker to fire the events on the signaling thread. > > This was being done for the purposes of PeerConnection but the concept > > of a signaling thread is otherwise not applicable to JTC and use of > > JTC from PC is inconsistent across threads (as has been flagged in > > webrtc:9987). > > > > This change makes all CallbackList members only accessible from the > > network thread and moves the signaling thread related work over to > > PeerConnection, which makes hops there more visible as well as making > > that class easier to refactor for thread efficiency. > > > > This CL removes the AsyncInvoker from JTC (webrtc:12339) > > > > The signaling_thread_ variable is also removed from JTC and more thread > > checks added to catch errors. > > > > Bug: webrtc:12427, webrtc:11988, webrtc:12339 > > Change-Id: Id232aedd00dfd5403b2ba0ca147d3eca7c12c7c5 > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206062 > > Commit-Queue: Tommi <tommi@webrtc.org> > > Reviewed-by: Niels Moller <nisse@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#33195} > > TBR=nisse@webrtc.org,tommi@webrtc.org > > Change-Id: I6134b71b74a9408854b79d44506d513519e9cf4d > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:12427 > Bug: webrtc:11988 > Bug: webrtc:12339 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206467 > Reviewed-by: Guido Urdaneta <guidou@webrtc.org> > Commit-Queue: Guido Urdaneta <guidou@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#33203} TBR=nisse@webrtc.org,tommi@webrtc.org,guidou@webrtc.org # Not skipping CQ checks because original CL landed > 1 day ago. Bug: webrtc:12427 Bug: webrtc:11988 Bug: webrtc:12339 Change-Id: I4e2e1490e1f9a87ed6ac4d722fd3c442e3059ae0 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206809 Reviewed-by: Tommi <tommi@webrtc.org> Commit-Queue: Tommi <tommi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33225}
2021-02-10 17:40:08 +00:00
signal_ice_candidates_removed_.Send(candidates);
}
void JsepTransportController::OnTransportCandidatePairChanged_n(
const cricket::CandidatePairChangeEvent& event) {
Reland "Remove thread hops from events provided by JsepTransportController." This reverts commit 6e4fcac31312f2dda5b60d33874ff0cd62f94321. Reason for revert: Parent CL issue has been resolved. Original change's description: > Revert "Remove thread hops from events provided by JsepTransportController." > > This reverts commit f554b3c577f69fa9ffad5c07155898c2d985ac76. > > Reason for revert: Parent CL breaks FYI bots. > See https://webrtc-review.googlesource.com/c/src/+/206466 > > Original change's description: > > Remove thread hops from events provided by JsepTransportController. > > > > Events associated with Subscribe* methods in JTC had trampolines that > > would use an async invoker to fire the events on the signaling thread. > > This was being done for the purposes of PeerConnection but the concept > > of a signaling thread is otherwise not applicable to JTC and use of > > JTC from PC is inconsistent across threads (as has been flagged in > > webrtc:9987). > > > > This change makes all CallbackList members only accessible from the > > network thread and moves the signaling thread related work over to > > PeerConnection, which makes hops there more visible as well as making > > that class easier to refactor for thread efficiency. > > > > This CL removes the AsyncInvoker from JTC (webrtc:12339) > > > > The signaling_thread_ variable is also removed from JTC and more thread > > checks added to catch errors. > > > > Bug: webrtc:12427, webrtc:11988, webrtc:12339 > > Change-Id: Id232aedd00dfd5403b2ba0ca147d3eca7c12c7c5 > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206062 > > Commit-Queue: Tommi <tommi@webrtc.org> > > Reviewed-by: Niels Moller <nisse@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#33195} > > TBR=nisse@webrtc.org,tommi@webrtc.org > > Change-Id: I6134b71b74a9408854b79d44506d513519e9cf4d > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:12427 > Bug: webrtc:11988 > Bug: webrtc:12339 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206467 > Reviewed-by: Guido Urdaneta <guidou@webrtc.org> > Commit-Queue: Guido Urdaneta <guidou@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#33203} TBR=nisse@webrtc.org,tommi@webrtc.org,guidou@webrtc.org # Not skipping CQ checks because original CL landed > 1 day ago. Bug: webrtc:12427 Bug: webrtc:11988 Bug: webrtc:12339 Change-Id: I4e2e1490e1f9a87ed6ac4d722fd3c442e3059ae0 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206809 Reviewed-by: Tommi <tommi@webrtc.org> Commit-Queue: Tommi <tommi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33225}
2021-02-10 17:40:08 +00:00
signal_ice_candidate_pair_changed_.Send(event);
}
void JsepTransportController::OnTransportRoleConflict_n(
cricket::IceTransportInternal* transport) {
// Note: since the role conflict is handled entirely on the network thread,
// we don't need to worry about role conflicts occurring on two ports at
// once. The first one encountered should immediately reverse the role.
cricket::IceRole reversed_role = (ice_role_ == cricket::ICEROLE_CONTROLLING)
? cricket::ICEROLE_CONTROLLED
: cricket::ICEROLE_CONTROLLING;
RTC_LOG(LS_INFO) << "Got role conflict; switching to "
<< (reversed_role == cricket::ICEROLE_CONTROLLING
? "controlling"
: "controlled")
<< " role.";
SetIceRole_n(reversed_role);
}
void JsepTransportController::OnTransportStateChanged_n(
cricket::IceTransportInternal* transport) {
RTC_LOG(LS_INFO) << transport->transport_name() << " Transport "
<< transport->component()
<< " state changed. Check if state is complete.";
UpdateAggregateStates_n();
}
void JsepTransportController::UpdateAggregateStates_n() {
TRACE_EVENT0("webrtc", "JsepTransportController::UpdateAggregateStates_n");
Reland "Fix bug where we assume new m= sections will always be bundled." This is a reland of commit 704a834f685eb96c9fcf891ca345557bef4d138a, after it was reverted in order to merge a CL to M93. Original change's description: > Fix bug where we assume new m= sections will always be bundled. > > A recent change [1] assumes that all new m= sections will share the > first BUNDLE group (if one already exists), which avoids generating > ICE candidates that are ultimately unnecessary. This is fine for JSEP > endpoints, but it breaks the following scenarios for non-JSEP endpoints: > > * Remote offer adding a new m= section that's not part of any BUNDLE > group. > * Remote offer adding an m= section to the second BUNDLE group. > > The latter is specifically problematic for any application that wants > to bundle all audio streams in one group and all video streams in > another group when using Unified Plan SDP, to replicate the behavior of > using Plan B without bundling. It may try to add a video stream only > for WebRTC to bundle it with audio. > > This is fixed by doing some minor re-factoring, having BundleManager > update the bundle groups at offer time. > > Also: > * Added some additional validation for multiple bundle groups in a > subsequent offer, since that now becomes relevant. > * Improved rollback support, because now rolling back an offer may need > to not only remove mid->transport mappings but alter them. > > [1]: https://webrtc-review.googlesource.com/c/src/+/221601 > > Bug: webrtc:12906, webrtc:12999 > Change-Id: I4c6e7020c0be33a782d3608dee88e4e2fceb1be1 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/225642 > Reviewed-by: Harald Alvestrand <hta@webrtc.org> > Reviewed-by: Henrik Boström <hbos@webrtc.org> > Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#34544} Bug: webrtc:12906, webrtc:12999 Change-Id: Id6acab2e2d7430c65f4b6a1d7372388a70cc18ab Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/228465 Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/master@{#34728}
2021-08-11 14:56:38 -07:00
auto dtls_transports = GetActiveDtlsTransports();
cricket::IceConnectionState new_connection_state =
cricket::kIceConnectionConnecting;
PeerConnectionInterface::IceConnectionState new_ice_connection_state =
PeerConnectionInterface::IceConnectionState::kIceConnectionNew;
PeerConnectionInterface::PeerConnectionState new_combined_state =
PeerConnectionInterface::PeerConnectionState::kNew;
cricket::IceGatheringState new_gathering_state = cricket::kIceGatheringNew;
bool any_failed = false;
bool all_connected = !dtls_transports.empty();
bool all_completed = !dtls_transports.empty();
bool any_gathering = false;
bool all_done_gathering = !dtls_transports.empty();
std::map<IceTransportState, int> ice_state_counts;
std::map<DtlsTransportState, int> dtls_state_counts;
for (const auto& dtls : dtls_transports) {
any_failed = any_failed || dtls->ice_transport()->GetState() ==
cricket::IceTransportState::STATE_FAILED;
all_connected = all_connected && dtls->writable();
all_completed =
all_completed && dtls->writable() &&
dtls->ice_transport()->GetState() ==
cricket::IceTransportState::STATE_COMPLETED &&
dtls->ice_transport()->GetIceRole() == cricket::ICEROLE_CONTROLLING &&
dtls->ice_transport()->gathering_state() ==
cricket::kIceGatheringComplete;
any_gathering = any_gathering || dtls->ice_transport()->gathering_state() !=
cricket::kIceGatheringNew;
all_done_gathering =
all_done_gathering && dtls->ice_transport()->gathering_state() ==
cricket::kIceGatheringComplete;
dtls_state_counts[dtls->dtls_state()]++;
ice_state_counts[dtls->ice_transport()->GetIceTransportState()]++;
}
if (any_failed) {
new_connection_state = cricket::kIceConnectionFailed;
} else if (all_completed) {
new_connection_state = cricket::kIceConnectionCompleted;
} else if (all_connected) {
new_connection_state = cricket::kIceConnectionConnected;
}
if (ice_connection_state_ != new_connection_state) {
ice_connection_state_ = new_connection_state;
Reland "Remove thread hops from events provided by JsepTransportController." This reverts commit 6e4fcac31312f2dda5b60d33874ff0cd62f94321. Reason for revert: Parent CL issue has been resolved. Original change's description: > Revert "Remove thread hops from events provided by JsepTransportController." > > This reverts commit f554b3c577f69fa9ffad5c07155898c2d985ac76. > > Reason for revert: Parent CL breaks FYI bots. > See https://webrtc-review.googlesource.com/c/src/+/206466 > > Original change's description: > > Remove thread hops from events provided by JsepTransportController. > > > > Events associated with Subscribe* methods in JTC had trampolines that > > would use an async invoker to fire the events on the signaling thread. > > This was being done for the purposes of PeerConnection but the concept > > of a signaling thread is otherwise not applicable to JTC and use of > > JTC from PC is inconsistent across threads (as has been flagged in > > webrtc:9987). > > > > This change makes all CallbackList members only accessible from the > > network thread and moves the signaling thread related work over to > > PeerConnection, which makes hops there more visible as well as making > > that class easier to refactor for thread efficiency. > > > > This CL removes the AsyncInvoker from JTC (webrtc:12339) > > > > The signaling_thread_ variable is also removed from JTC and more thread > > checks added to catch errors. > > > > Bug: webrtc:12427, webrtc:11988, webrtc:12339 > > Change-Id: Id232aedd00dfd5403b2ba0ca147d3eca7c12c7c5 > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206062 > > Commit-Queue: Tommi <tommi@webrtc.org> > > Reviewed-by: Niels Moller <nisse@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#33195} > > TBR=nisse@webrtc.org,tommi@webrtc.org > > Change-Id: I6134b71b74a9408854b79d44506d513519e9cf4d > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:12427 > Bug: webrtc:11988 > Bug: webrtc:12339 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206467 > Reviewed-by: Guido Urdaneta <guidou@webrtc.org> > Commit-Queue: Guido Urdaneta <guidou@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#33203} TBR=nisse@webrtc.org,tommi@webrtc.org,guidou@webrtc.org # Not skipping CQ checks because original CL landed > 1 day ago. Bug: webrtc:12427 Bug: webrtc:11988 Bug: webrtc:12339 Change-Id: I4e2e1490e1f9a87ed6ac4d722fd3c442e3059ae0 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206809 Reviewed-by: Tommi <tommi@webrtc.org> Commit-Queue: Tommi <tommi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33225}
2021-02-10 17:40:08 +00:00
signal_ice_connection_state_.Send(new_connection_state);
}
// Compute the current RTCIceConnectionState as described in
// https://www.w3.org/TR/webrtc/#dom-rtciceconnectionstate.
// The PeerConnection is responsible for handling the "closed" state.
int total_ice_checking = ice_state_counts[IceTransportState::kChecking];
int total_ice_connected = ice_state_counts[IceTransportState::kConnected];
int total_ice_completed = ice_state_counts[IceTransportState::kCompleted];
int total_ice_failed = ice_state_counts[IceTransportState::kFailed];
int total_ice_disconnected =
ice_state_counts[IceTransportState::kDisconnected];
int total_ice_closed = ice_state_counts[IceTransportState::kClosed];
int total_ice_new = ice_state_counts[IceTransportState::kNew];
int total_ice = dtls_transports.size();
if (total_ice_failed > 0) {
// Any RTCIceTransports are in the "failed" state.
new_ice_connection_state = PeerConnectionInterface::kIceConnectionFailed;
} else if (total_ice_disconnected > 0) {
// None of the previous states apply and any RTCIceTransports are in the
// "disconnected" state.
new_ice_connection_state =
PeerConnectionInterface::kIceConnectionDisconnected;
} else if (total_ice_new + total_ice_closed == total_ice) {
// None of the previous states apply and all RTCIceTransports are in the
// "new" or "closed" state, or there are no transports.
new_ice_connection_state = PeerConnectionInterface::kIceConnectionNew;
} else if (total_ice_new + total_ice_checking > 0) {
// None of the previous states apply and any RTCIceTransports are in the
// "new" or "checking" state.
new_ice_connection_state = PeerConnectionInterface::kIceConnectionChecking;
} else if (total_ice_completed + total_ice_closed == total_ice ||
all_completed) {
// None of the previous states apply and all RTCIceTransports are in the
// "completed" or "closed" state.
//
// TODO(https://bugs.webrtc.org/10356): The all_completed condition is added
// to mimic the behavior of the old ICE connection state, and should be
// removed once we get end-of-candidates signaling in place.
new_ice_connection_state = PeerConnectionInterface::kIceConnectionCompleted;
} else if (total_ice_connected + total_ice_completed + total_ice_closed ==
total_ice) {
// None of the previous states apply and all RTCIceTransports are in the
// "connected", "completed" or "closed" state.
new_ice_connection_state = PeerConnectionInterface::kIceConnectionConnected;
} else {
RTC_DCHECK_NOTREACHED();
}
if (standardized_ice_connection_state_ != new_ice_connection_state) {
if (standardized_ice_connection_state_ ==
PeerConnectionInterface::kIceConnectionChecking &&
new_ice_connection_state ==
PeerConnectionInterface::kIceConnectionCompleted) {
// Ensure that we never skip over the "connected" state.
Reland "Remove thread hops from events provided by JsepTransportController." This reverts commit 6e4fcac31312f2dda5b60d33874ff0cd62f94321. Reason for revert: Parent CL issue has been resolved. Original change's description: > Revert "Remove thread hops from events provided by JsepTransportController." > > This reverts commit f554b3c577f69fa9ffad5c07155898c2d985ac76. > > Reason for revert: Parent CL breaks FYI bots. > See https://webrtc-review.googlesource.com/c/src/+/206466 > > Original change's description: > > Remove thread hops from events provided by JsepTransportController. > > > > Events associated with Subscribe* methods in JTC had trampolines that > > would use an async invoker to fire the events on the signaling thread. > > This was being done for the purposes of PeerConnection but the concept > > of a signaling thread is otherwise not applicable to JTC and use of > > JTC from PC is inconsistent across threads (as has been flagged in > > webrtc:9987). > > > > This change makes all CallbackList members only accessible from the > > network thread and moves the signaling thread related work over to > > PeerConnection, which makes hops there more visible as well as making > > that class easier to refactor for thread efficiency. > > > > This CL removes the AsyncInvoker from JTC (webrtc:12339) > > > > The signaling_thread_ variable is also removed from JTC and more thread > > checks added to catch errors. > > > > Bug: webrtc:12427, webrtc:11988, webrtc:12339 > > Change-Id: Id232aedd00dfd5403b2ba0ca147d3eca7c12c7c5 > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206062 > > Commit-Queue: Tommi <tommi@webrtc.org> > > Reviewed-by: Niels Moller <nisse@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#33195} > > TBR=nisse@webrtc.org,tommi@webrtc.org > > Change-Id: I6134b71b74a9408854b79d44506d513519e9cf4d > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:12427 > Bug: webrtc:11988 > Bug: webrtc:12339 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206467 > Reviewed-by: Guido Urdaneta <guidou@webrtc.org> > Commit-Queue: Guido Urdaneta <guidou@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#33203} TBR=nisse@webrtc.org,tommi@webrtc.org,guidou@webrtc.org # Not skipping CQ checks because original CL landed > 1 day ago. Bug: webrtc:12427 Bug: webrtc:11988 Bug: webrtc:12339 Change-Id: I4e2e1490e1f9a87ed6ac4d722fd3c442e3059ae0 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206809 Reviewed-by: Tommi <tommi@webrtc.org> Commit-Queue: Tommi <tommi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33225}
2021-02-10 17:40:08 +00:00
signal_standardized_ice_connection_state_.Send(
PeerConnectionInterface::kIceConnectionConnected);
}
standardized_ice_connection_state_ = new_ice_connection_state;
Reland "Remove thread hops from events provided by JsepTransportController." This reverts commit 6e4fcac31312f2dda5b60d33874ff0cd62f94321. Reason for revert: Parent CL issue has been resolved. Original change's description: > Revert "Remove thread hops from events provided by JsepTransportController." > > This reverts commit f554b3c577f69fa9ffad5c07155898c2d985ac76. > > Reason for revert: Parent CL breaks FYI bots. > See https://webrtc-review.googlesource.com/c/src/+/206466 > > Original change's description: > > Remove thread hops from events provided by JsepTransportController. > > > > Events associated with Subscribe* methods in JTC had trampolines that > > would use an async invoker to fire the events on the signaling thread. > > This was being done for the purposes of PeerConnection but the concept > > of a signaling thread is otherwise not applicable to JTC and use of > > JTC from PC is inconsistent across threads (as has been flagged in > > webrtc:9987). > > > > This change makes all CallbackList members only accessible from the > > network thread and moves the signaling thread related work over to > > PeerConnection, which makes hops there more visible as well as making > > that class easier to refactor for thread efficiency. > > > > This CL removes the AsyncInvoker from JTC (webrtc:12339) > > > > The signaling_thread_ variable is also removed from JTC and more thread > > checks added to catch errors. > > > > Bug: webrtc:12427, webrtc:11988, webrtc:12339 > > Change-Id: Id232aedd00dfd5403b2ba0ca147d3eca7c12c7c5 > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206062 > > Commit-Queue: Tommi <tommi@webrtc.org> > > Reviewed-by: Niels Moller <nisse@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#33195} > > TBR=nisse@webrtc.org,tommi@webrtc.org > > Change-Id: I6134b71b74a9408854b79d44506d513519e9cf4d > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:12427 > Bug: webrtc:11988 > Bug: webrtc:12339 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206467 > Reviewed-by: Guido Urdaneta <guidou@webrtc.org> > Commit-Queue: Guido Urdaneta <guidou@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#33203} TBR=nisse@webrtc.org,tommi@webrtc.org,guidou@webrtc.org # Not skipping CQ checks because original CL landed > 1 day ago. Bug: webrtc:12427 Bug: webrtc:11988 Bug: webrtc:12339 Change-Id: I4e2e1490e1f9a87ed6ac4d722fd3c442e3059ae0 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206809 Reviewed-by: Tommi <tommi@webrtc.org> Commit-Queue: Tommi <tommi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33225}
2021-02-10 17:40:08 +00:00
signal_standardized_ice_connection_state_.Send(new_ice_connection_state);
}
// Compute the current RTCPeerConnectionState as described in
// https://www.w3.org/TR/webrtc/#dom-rtcpeerconnectionstate.
// The PeerConnection is responsible for handling the "closed" state.
// Note that "connecting" is only a valid state for DTLS transports while
// "checking", "completed" and "disconnected" are only valid for ICE
// transports.
int total_connected =
total_ice_connected + dtls_state_counts[DtlsTransportState::kConnected];
int total_dtls_connecting =
dtls_state_counts[DtlsTransportState::kConnecting];
int total_failed =
total_ice_failed + dtls_state_counts[DtlsTransportState::kFailed];
int total_closed =
total_ice_closed + dtls_state_counts[DtlsTransportState::kClosed];
int total_new = total_ice_new + dtls_state_counts[DtlsTransportState::kNew];
int total_transports = total_ice * 2;
if (total_failed > 0) {
// Any of the RTCIceTransports or RTCDtlsTransports are in a "failed" state.
new_combined_state = PeerConnectionInterface::PeerConnectionState::kFailed;
} else if (total_ice_disconnected > 0) {
// None of the previous states apply and any RTCIceTransports or
// RTCDtlsTransports are in the "disconnected" state.
new_combined_state =
PeerConnectionInterface::PeerConnectionState::kDisconnected;
} else if (total_new + total_closed == total_transports) {
// None of the previous states apply and all RTCIceTransports and
// RTCDtlsTransports are in the "new" or "closed" state, or there are no
// transports.
new_combined_state = PeerConnectionInterface::PeerConnectionState::kNew;
} else if (total_new + total_dtls_connecting + total_ice_checking > 0) {
// None of the previous states apply and all RTCIceTransports or
// RTCDtlsTransports are in the "new", "connecting" or "checking" state.
new_combined_state =
PeerConnectionInterface::PeerConnectionState::kConnecting;
} else if (total_connected + total_ice_completed + total_closed ==
total_transports) {
// None of the previous states apply and all RTCIceTransports and
// RTCDtlsTransports are in the "connected", "completed" or "closed" state.
new_combined_state =
PeerConnectionInterface::PeerConnectionState::kConnected;
} else {
RTC_DCHECK_NOTREACHED();
}
if (combined_connection_state_ != new_combined_state) {
combined_connection_state_ = new_combined_state;
Reland "Remove thread hops from events provided by JsepTransportController." This reverts commit 6e4fcac31312f2dda5b60d33874ff0cd62f94321. Reason for revert: Parent CL issue has been resolved. Original change's description: > Revert "Remove thread hops from events provided by JsepTransportController." > > This reverts commit f554b3c577f69fa9ffad5c07155898c2d985ac76. > > Reason for revert: Parent CL breaks FYI bots. > See https://webrtc-review.googlesource.com/c/src/+/206466 > > Original change's description: > > Remove thread hops from events provided by JsepTransportController. > > > > Events associated with Subscribe* methods in JTC had trampolines that > > would use an async invoker to fire the events on the signaling thread. > > This was being done for the purposes of PeerConnection but the concept > > of a signaling thread is otherwise not applicable to JTC and use of > > JTC from PC is inconsistent across threads (as has been flagged in > > webrtc:9987). > > > > This change makes all CallbackList members only accessible from the > > network thread and moves the signaling thread related work over to > > PeerConnection, which makes hops there more visible as well as making > > that class easier to refactor for thread efficiency. > > > > This CL removes the AsyncInvoker from JTC (webrtc:12339) > > > > The signaling_thread_ variable is also removed from JTC and more thread > > checks added to catch errors. > > > > Bug: webrtc:12427, webrtc:11988, webrtc:12339 > > Change-Id: Id232aedd00dfd5403b2ba0ca147d3eca7c12c7c5 > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206062 > > Commit-Queue: Tommi <tommi@webrtc.org> > > Reviewed-by: Niels Moller <nisse@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#33195} > > TBR=nisse@webrtc.org,tommi@webrtc.org > > Change-Id: I6134b71b74a9408854b79d44506d513519e9cf4d > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:12427 > Bug: webrtc:11988 > Bug: webrtc:12339 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206467 > Reviewed-by: Guido Urdaneta <guidou@webrtc.org> > Commit-Queue: Guido Urdaneta <guidou@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#33203} TBR=nisse@webrtc.org,tommi@webrtc.org,guidou@webrtc.org # Not skipping CQ checks because original CL landed > 1 day ago. Bug: webrtc:12427 Bug: webrtc:11988 Bug: webrtc:12339 Change-Id: I4e2e1490e1f9a87ed6ac4d722fd3c442e3059ae0 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206809 Reviewed-by: Tommi <tommi@webrtc.org> Commit-Queue: Tommi <tommi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33225}
2021-02-10 17:40:08 +00:00
signal_connection_state_.Send(new_combined_state);
}
// Compute the gathering state.
if (dtls_transports.empty()) {
new_gathering_state = cricket::kIceGatheringNew;
} else if (all_done_gathering) {
new_gathering_state = cricket::kIceGatheringComplete;
} else if (any_gathering) {
new_gathering_state = cricket::kIceGatheringGathering;
}
if (ice_gathering_state_ != new_gathering_state) {
ice_gathering_state_ = new_gathering_state;
Reland "Remove thread hops from events provided by JsepTransportController." This reverts commit 6e4fcac31312f2dda5b60d33874ff0cd62f94321. Reason for revert: Parent CL issue has been resolved. Original change's description: > Revert "Remove thread hops from events provided by JsepTransportController." > > This reverts commit f554b3c577f69fa9ffad5c07155898c2d985ac76. > > Reason for revert: Parent CL breaks FYI bots. > See https://webrtc-review.googlesource.com/c/src/+/206466 > > Original change's description: > > Remove thread hops from events provided by JsepTransportController. > > > > Events associated with Subscribe* methods in JTC had trampolines that > > would use an async invoker to fire the events on the signaling thread. > > This was being done for the purposes of PeerConnection but the concept > > of a signaling thread is otherwise not applicable to JTC and use of > > JTC from PC is inconsistent across threads (as has been flagged in > > webrtc:9987). > > > > This change makes all CallbackList members only accessible from the > > network thread and moves the signaling thread related work over to > > PeerConnection, which makes hops there more visible as well as making > > that class easier to refactor for thread efficiency. > > > > This CL removes the AsyncInvoker from JTC (webrtc:12339) > > > > The signaling_thread_ variable is also removed from JTC and more thread > > checks added to catch errors. > > > > Bug: webrtc:12427, webrtc:11988, webrtc:12339 > > Change-Id: Id232aedd00dfd5403b2ba0ca147d3eca7c12c7c5 > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206062 > > Commit-Queue: Tommi <tommi@webrtc.org> > > Reviewed-by: Niels Moller <nisse@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#33195} > > TBR=nisse@webrtc.org,tommi@webrtc.org > > Change-Id: I6134b71b74a9408854b79d44506d513519e9cf4d > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:12427 > Bug: webrtc:11988 > Bug: webrtc:12339 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206467 > Reviewed-by: Guido Urdaneta <guidou@webrtc.org> > Commit-Queue: Guido Urdaneta <guidou@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#33203} TBR=nisse@webrtc.org,tommi@webrtc.org,guidou@webrtc.org # Not skipping CQ checks because original CL landed > 1 day ago. Bug: webrtc:12427 Bug: webrtc:11988 Bug: webrtc:12339 Change-Id: I4e2e1490e1f9a87ed6ac4d722fd3c442e3059ae0 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206809 Reviewed-by: Tommi <tommi@webrtc.org> Commit-Queue: Tommi <tommi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33225}
2021-02-10 17:40:08 +00:00
signal_ice_gathering_state_.Send(new_gathering_state);
}
}
void JsepTransportController::OnRtcpPacketReceived_n(
rtc::CopyOnWriteBuffer* packet,
int64_t packet_time_us) {
RTC_DCHECK(config_.rtcp_handler);
config_.rtcp_handler(*packet, packet_time_us);
}
void JsepTransportController::OnDtlsHandshakeError(
rtc::SSLHandshakeError error) {
config_.on_dtls_handshake_error_(error);
}
bool JsepTransportController::OnTransportChanged(
const std::string& mid,
cricket::JsepTransport* jsep_transport) {
if (config_.transport_observer) {
if (jsep_transport) {
return config_.transport_observer->OnTransportChanged(
mid, jsep_transport->rtp_transport(),
jsep_transport->RtpDtlsTransport(),
jsep_transport->data_channel_transport());
} else {
return config_.transport_observer->OnTransportChanged(mid, nullptr,
nullptr, nullptr);
}
}
return false;
}
} // namespace webrtc