Commit graph

65 commits

Author SHA1 Message Date
Harald Alvestrand
6431a64f02 Reland "Run IWYU on some files I intend to work on"
This reverts commit fe34363ca0.

Reason for revert: Downstream error fixed.

Original change's description:
> Revert "Run IWYU on some files I intend to work on"
>
> This reverts commit 827da15f14.
>
> Reason for revert: Breaks downstream project
>
> Original change's description:
> > Run IWYU on some files I intend to work on
> >
> > and files that broke when I fixed the first set.
> >
> > Bug: webrtc:42226242
> > Change-Id: I321cd63537ab3002098c7bdecd889a6fc5a1eb25
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/353421
> > Commit-Queue: Harald Alvestrand <hta@webrtc.org>
> > Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
> > Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
> > Auto-Submit: Harald Alvestrand <hta@webrtc.org>
> > Cr-Commit-Position: refs/heads/main@{#42429}
>
> Bug: webrtc:42226242
> Change-Id: I6b18dced08669c6741c6a51768fbb8b9072c6e82
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/353580
> Owners-Override: Mirko Bonadei <mbonadei@webrtc.org>
> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
> Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
> Cr-Commit-Position: refs/heads/main@{#42430}

Bug: webrtc:42226242
Change-Id: I8ba51da47ea34d6bbf868e5ebc0037c6cffec8ba
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/353660
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42437}
2024-06-05 08:59:49 +00:00
Mirko Bonadei
fe34363ca0 Revert "Run IWYU on some files I intend to work on"
This reverts commit 827da15f14.

Reason for revert: Breaks downstream project

Original change's description:
> Run IWYU on some files I intend to work on
>
> and files that broke when I fixed the first set.
>
> Bug: webrtc:42226242
> Change-Id: I321cd63537ab3002098c7bdecd889a6fc5a1eb25
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/353421
> Commit-Queue: Harald Alvestrand <hta@webrtc.org>
> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
> Auto-Submit: Harald Alvestrand <hta@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#42429}

Bug: webrtc:42226242
Change-Id: I6b18dced08669c6741c6a51768fbb8b9072c6e82
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/353580
Owners-Override: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#42430}
2024-06-04 11:36:06 +00:00
Harald Alvestrand
827da15f14 Run IWYU on some files I intend to work on
and files that broke when I fixed the first set.

Bug: webrtc:42226242
Change-Id: I321cd63537ab3002098c7bdecd889a6fc5a1eb25
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/353421
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Auto-Submit: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42429}
2024-06-04 10:59:05 +00:00
Harald Alvestrand
a6544377bc Remove not-needed webrtc:: prefixes in pc/
This test drives the new tools_webrtc/remove_extra_namespace.py tool.

Bug: None
Change-Id: I9b590aa1213e4cace2d64d555f4dafd893f03606
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/327021
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41141}
2023-11-13 13:23:04 +00:00
Tommi
2919075ce3 Remove an invoke for datahannel transport uninitialization during Close.
Bug: none
Change-Id: Ic0d482a8a045d3aa0fcaf13e43f8a156fa3560d6
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/324301
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40982}
2023-10-21 16:39:05 +00:00
Tommi
840cf78600 Move Destroy/Create steps for DataChannelTransport to PeerConnection.
This moves steps from the sdp code for pc state over to the PC class
and slightly simplifies the contract between the two classes.
Moving forward it's easier to consolidate those steps in the PC
class with other grouped operations e.g. during teardown.

Also removing GetDataMid() method in favor of the sctp_mid() property.

Bug: none
Change-Id: I938f953099d327377abd94e6b2c9ece803d88e40
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/324300
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40981}
2023-10-21 16:25:11 +00:00
Tommi
335d084b3b Remove GetSctpSslRole, only use GetSctpSslRole_n
This updates DataChannelController and test classes to use
GetSctpSslRole_n instead and query the role on the network thread.

Along the way this CL makes the init config struct for when constructing
data channels, mandatory. It's now passed via const& instead of by pointer. In practice a valid pointer was always being passed.

Bug: webrtc:11547
Change-Id: I0f4bbf364969cc2dec07871c297ddbef0c175f86
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/298307
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#39676}
2023-03-25 11:40:35 +00:00
Tommi
c61eee28f3 Split up GetSctpSslRole to include an _n variant.
This allows the SslRole to be queried from the network thread which
will simplify some code paths and avoid thread hopping.

The next steps will be to remove GetSctpSslRole and only query the
DTLS role on the network thread and start combining other operations.

Bug: webrtc:11547
Change-Id: I222dc838fc5ee274a294c8d81d38b5a4ea8fea1f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/298302
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#39642}
2023-03-22 16:47:28 +00:00
Yaowen Guo
999fff45ed Delete ChannelManager class declaration.
ChannelManager has been deleted, these declaration should also be deleted.

Bug: webrtc:13931
Change-Id: I2739a0424f61d6e659cb694a3f51bb6b90911cf9
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/282520
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38579}
2022-11-08 10:32:47 +00:00
Henrik Boström
41263fab8f Delete UMA histograms relating to Plan B vs Unified Plan.
Plan B having been deleted from Chrome, there is no need to collect UMAs
relating to Plan B vs Unified Plan setups.

Bug: chromium:1357994
Change-Id: Icb5d16823ea9d849798583cd1c82683014b8a15c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/275309
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38069}
2022-09-13 14:19:29 +00:00
Niels Möller
6189207e1a Delete some unused sigslot dependencies
Bug: webrtc:11943
Change-Id: Idc0d7aa0f63088810131ed0eebef2f165e66d646
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/266495
Auto-Submit: Niels Moller <nisse@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37314}
2022-06-23 12:30:22 +00:00
Harald Alvestrand
8101e7b79b Reland "Don't create channel_manager++ when media_engine is not set"
This reverts commit c6c02efb56.

Reason for revert: Test now passes (and channel manager is gone)

Original change's description:
> Revert "Don't create channel_manager when media_engine is not set"
>
> This reverts commit c48ad732d6.
>
> Reason for revert: breaks downstream project
>
> Original change's description:
> > Don't create channel_manager when media_engine is not set
> >
> > Also remove a bunch of functions in ChannelManager that were just
> > forwarding to MediaEngineInterface.
> >
> > Bug: webrtc:13931
> > Change-Id: Ia38591fd22c665cace16d032f5c1e384e413cded
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/261304
> > Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
> > Reviewed-by: Henrik Boström <hbos@webrtc.org>
> > Commit-Queue: Harald Alvestrand <hta@webrtc.org>
> > Cr-Commit-Position: refs/heads/main@{#36801}
>
> Bug: webrtc:13931
> Change-Id: I1e260a2489547bd9483b50e043c28d2805b0fa5a
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/261660
> Commit-Queue: Artem Titov <titovartem@webrtc.org>
> Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> Owners-Override: Artem Titov <titovartem@webrtc.org>
> Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
> Cr-Commit-Position: refs/heads/main@{#36811}

Bug: webrtc:13931
Change-Id: I7b5b45b46095c18d489b6a9fe4c625971d6b3da6
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/261661
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36976}
2022-05-23 15:51:21 +00:00
Harald Alvestrand
35f4b4c755 Remove more trampoline functions from ChannelManager
Bug: webrtc:13931
Change-Id: I3a1b48aeffd91ee6abaf78eb1ec69c1653b210e6
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/262640
Reviewed-by: Florent Castelli <orphis@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36898}
2022-05-16 15:12:27 +00:00
Artem Titov
c6c02efb56 Revert "Don't create channel_manager when media_engine is not set"
This reverts commit c48ad732d6.

Reason for revert: breaks downstream project

Original change's description:
> Don't create channel_manager when media_engine is not set
>
> Also remove a bunch of functions in ChannelManager that were just
> forwarding to MediaEngineInterface.
>
> Bug: webrtc:13931
> Change-Id: Ia38591fd22c665cace16d032f5c1e384e413cded
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/261304
> Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
> Reviewed-by: Henrik Boström <hbos@webrtc.org>
> Commit-Queue: Harald Alvestrand <hta@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#36801}

Bug: webrtc:13931
Change-Id: I1e260a2489547bd9483b50e043c28d2805b0fa5a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/261660
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Owners-Override: Artem Titov <titovartem@webrtc.org>
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#36811}
2022-05-09 09:52:34 +00:00
Harald Alvestrand
c48ad732d6 Don't create channel_manager when media_engine is not set
Also remove a bunch of functions in ChannelManager that were just
forwarding to MediaEngineInterface.

Bug: webrtc:13931
Change-Id: Ia38591fd22c665cace16d032f5c1e384e413cded
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/261304
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36801}
2022-05-06 22:48:22 +00:00
Harald Alvestrand
9e334b7d99 Remove channel_manager.h from most .h files
This ensures that only the compilation units that actually need
ChannelManager details can see it.

Bug: webrtc:13931
Change-Id: Iddd37580c0ceceba5b7095e84b981e6a525b2800
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/261200
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36762}
2022-05-04 16:35:17 +00:00
Harald Alvestrand
8f42992787 Move channel creation functions into RtpTransceiver
This breaks the link from sdp_offer_answer.cc to channel.h.

Bug: webrtc:13931
Change-Id: I75608f75713bf4e69013ac5f5b17c19e53d07519
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/261060
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36757}
2022-05-04 11:57:50 +00:00
Harald Alvestrand
3af79d1768 Move ownership of the Channel class to RTCRtpTransceiver
This makes the channel manager object into a factory, not a manager.

Bug: webrtc:13931
Change-Id: I59f7d818a739797a7c0a7a32e6583450834df122
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/260467
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36718}
2022-04-30 19:21:11 +00:00
Harald Alvestrand
65685a65f2 Move pc/channel.h to only be used in .cc files
This is an implementation API, user classes should in principle
only use the channel_interface.h

Bug: webrtc:13931
Change-Id: I85c285217858dc087c90a50792e980f731f4439f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/260185
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36674}
2022-04-27 17:13:11 +00:00
Harald Alvestrand
09bdd95b3e Remove some dependencies that aren't needed
This was a side effect of testing out the "gn_check_autofix.py" tool
after running "apply-iwyu -r" on a few files.
Seems worth committing.

Bug: none
Change-Id: I3df446c640d4c4e3d6b15eddbdf66a1a40135f69
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/258024
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36446}
2022-04-05 14:55:39 +00:00
Niels Möller
be74b8058b Fix spelling of receiver and transceiver.
Bug: None
Change-Id: I439e217d67283b182833e48da15af9ae367ac14e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/256015
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36257}
2022-03-18 14:54:10 +00:00
Jonas Oreland
ed99dae422 WebRTC-DeprecateGlobalFieldTrialString/Enabled/ - part 1
This cl/
1) move WebRtcKeyValueConfig from api/transport to api/ directory.
2) add a test/ScopedKeyValueConfig (compare ScopedFieldTrials).
3) removes usage of webrtc::field_trial:: from the pc/ directory.
4) removes a few unused includes of system_wrappers/field_trial.h.

Bug: webrtc:10335
Change-Id: If29c07900dbe791050b0a5ad05332bedfad035f2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/253903
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36160}
2022-03-09 13:23:21 +00:00
Harald Alvestrand
c24a2189d7 Update IWYU tool with a mapping file
Also apply IWYU to all .cc files in pc/, and correct BUILD file to match.
Note: Some files came out wrong when iwyu was applied. These are not included.

Bug: none
Change-Id: Ib5ea46b8fcc505414d0447cca7218ad3afc2e321
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/252280
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36064}
2022-02-24 11:05:06 +00:00
Harald Alvestrand
981c572eab Updated apply-iwyu to autogenerate compile_commands.json
Also deleted iwyu script that was not maintained, and deleted
some options that made the script more complex.

Bug: none
Change-Id: I39d8eaa37f12c72ddc127ae145e6a3a80f328316
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/251384
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35966}
2022-02-09 14:30:57 +00:00
Harald Alvestrand
bc32c56f83 Move pc.transport_controller_ to be network thread only
A pointer to the transport controller is now maintained on
both the network thread and the signaling thread. We use
thread specific accessors to make it explicit which copy we
are accessing at any given time.

We also move the initial offerer value to the SDP offer/answer
class; this is determined on the basis of SDP offer/answer, so
there is no need to hop to the network thread for that.

Work in progress.

Bug: webrtc:9987
Change-Id: Idbe5a7fbf44f667adcd119e486133cf6e43ab1f5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/251382
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35965}
2022-02-09 13:06:15 +00:00
Harald Alvestrand
8e3441933f Break out sdp_offer_answer from peerconnection
Bug: webrtc:13634
Change-Id: I4400c4d1a6aaf751774dbd8a9f697fd9fee1d297
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/251324
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35954}
2022-02-08 15:23:44 +00:00
Harald Alvestrand
66c4036d1b Access threads from SdpOfferAnswerHandler via ConnectionContext
This removes a couple of methods from the PeerConnectionSdpMethods
interface.

Bug: webrtc:11995
Change-Id: I0a68178b1f0a99e779e6d7f94d03b493d811f500
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/249794
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35841}
2022-01-31 09:22:08 +00:00
Harald Alvestrand
5b66130209 Refactor PeerConnectionInternal to break SdpOfferAnswer dependency
This CL changes the SdpOfferAnswerHandler class to depend on a new class
PerConnectionInternalMethods, which is implemented by PeerConnection.
This means that SdpOfferAnswerHandler no longer depends on
PeerConnectionInterface.

This opens the way for refactoring PeerConnection so that
PeerConnectionInternalMethods is a member object (encapsulation not
inheritance), which will make it possible to break some of the
dependency cycles that make the "peerconnection" target in the BUILD
file so huge.

Bug: webrtc:11995
Change-Id: Ib8413a31c0148b8d8602764b7367dfd3068da58a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/249785
Reviewed-by: Niels Moller <nisse@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35828}
2022-01-28 15:18:36 +00:00
Tomas Gunnarsson
16de21696a Delete channel objects asynchronously from the transceiver.
Move deletion of channel objects over to the RtpTransceiver instead
of having it done by SdpOfferAnswer.

The deletion is now also done via PostTask rather than Invoke.

Bug: webrtc:11992, webrtc:13540
Change-Id: I5aff14956d5e572ca8816bbfef8739bb609b4484
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/248170
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35798}
2022-01-26 10:39:00 +00:00
Tomas Gunnarsson
5411b174c8 Add a channel factory interface.
The interface is implemented by the ChannelManager and contains methods
to create and destroy media channel objects as used by a transceiver.

This will subsequently allow us to delete the channel objects from
the transceiver class where ownership really lies rather than from
the outside - which is currently required by some tests that keep
channel objects on the stack. We'll furthermore be able to do the
destruction asynchronously without additional Invoke()s as we do now
which will remove an Invoke when making sdp changes.

With introducing the interface, the following simplifications were made:
* ChannelManager constructed on the signaling thread.
  Before, there was an Invoke in the context class, which existed
  for the purposes of calling MediaEngine::Init() (which in turn is
  only needed for the VoiceEngine). This Invoke has now been moved
  into the CM (more tbd).
* The CM now has a pointer to the signaling thread (since that's the
  construction thread). That allows us to remove the signaling thread
  parameter from the CreateFooChannel methods.
* The ssrc_generator (UniqueRandomIdGenerator) instance for SSRCs moved
  from SdpOfferAnswerHandler to the CM, as it's always used in
  combination with the CM. This simplifies the CreateFooChannel methods
  as well as a couple of other classes that have a CM dependency.
* Removed DestroyFooChannel related code from SdpOfferAnswerHandler since
  the channel type detail can be taken care of by the CM.

Bug: webrtc:11992, webrtc:13540
Change-Id: I04938a803734de8489ba31e6212d9eaecc244126
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/247904
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35766}
2022-01-24 08:50:30 +00:00
Tomas Gunnarsson
0dd7539ca7 Split ApplyRemoteDescription up into smaller functions.
This is a followup to [1] that moves parts of the SetRemoteDescription
operation into a subclass of SdpOfferAnswerHandler.

[1] https://webrtc-review.googlesource.com/c/src/+/244980/

Bug: webrtc:13540
Change-Id: Ic5d97f9bfd30763f3988f2f6832703ffb819a51d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/245641
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35714}
2022-01-17 19:10:34 +00:00
Tomas Gunnarsson
1c7c09bcfa Introduce SdpOfferAnswerHandler::RemoteDescriptionOperation.
This is an operation specific subclass of SdpOfferAnswerHandler that in
this first step, takes over the implementation details that before this
CL were implemented in SdpOfferAnswerHandler::DoSetRemoteDescription.

This CL does not change the behavior of the implementation but it does
break up DoSetRemoteDescription into smaller methods and moves the state
related to the SRD operation, into a class that in upcoming steps can
be passed around asynchronously as needed, which will allow us to avoid
blocking threads.

Bug: webrtc:13540
Change-Id: Id2002d2390a4a13725f5967df5b82064b37c7490
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/244980
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35669}
2022-01-12 14:38:25 +00:00
Tomas Gunnarsson
651586c4e1 Move a part of ApplyRemoteDescription() into a separate function.
This part is specific to unified plan and doesn't need most of
the state related to the remote description (and doesn't return an
error).

Bug: none
Change-Id: I0de66bdb2e925072a6d9010e4444e75d4574ae04
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/245102
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Auto-Submit: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35642}
2022-01-07 19:50:46 +00:00
Tomas Gunnarsson
b625edfa47 Move one part of ApplyRemoteDescription out to a separate function.
This is just a step to reduce the size of ApplyRemoteDescription to make
refactoring it easier (and ultimately support async operations).

Bug: none
Change-Id: Idb950c35f585a887d6640278b6edfdd0c7cec3fa
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/245101
Auto-Submit: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35641}
2022-01-07 18:23:06 +00:00
Harald Alvestrand
42b983a606 Add some RTC_GUARDED_BY statements
These seem to have been forgotten when modifying
sdp_offer_answer.h. It's nice to be consistent.

Bug: none
Change-Id: Iffc4acbc48c0052141e029dcff4faebedbb22784
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/235726
Reviewed-by: Niels Moller <nisse@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35243}
2021-10-20 07:19:43 +00:00
Artem Titov
880fa8169b 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 37ee0f5e59.
>
> 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:13:59 +00:00
Björn Terelius
fd05d6f504 Revert "Use backticks not vertical bars to denote variables in comments for /pc"
This reverts commit 37ee0f5e59.

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}
2021-07-27 22:10:24 +00:00
Artem Titov
37ee0f5e59 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}
2021-07-27 20:52:02 +00:00
Florent Castelli
dcb9ffc6f2 DataChannel: Propagate SCTP transport errors to the channels
When the transport is terminated, if an error has occured, it will
be propagated to the channels.
When such errors can happen at the SCTP level (e.g. out of resources),
RTCError may contain an error code matching the definition at
https://www.iana.org/assignments/sctp-parameters/sctp-parameters.xhtml#sctp-parameters-24
If the m= line is rejected or removed from SDP, an error will again be sent
to the data channels, signaling their unexpected transition to closed.

Bug: webrtc:12904
Change-Id: Iea3d8aba0a57bbedb5d03f0fb6f7aba292e92fe8
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/223541
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Florent Castelli <orphis@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34386}
2021-06-29 14:37:32 +00:00
Henrik Boström
4ea80f35f1 Disable PT based demuxing if MID header extension is present.
We want to turn off PT based demux because SSRC-based endpoints that
send media prematurely (which is a popular non-standard behavior still
heavily in use) can otherwise get incorrect mappings and unsignalled
ssrc issues because of the PT demux path.

This CL disables PT based demuxing when the MID header extension is
present on all m= sections in the SDP for that kind (audio/video), not
caring if it was in the offer or answer. However if PT demuxing has been
used in the past then it is always allowed. This ensures PT is off by
default but that either offer or answer can enable PT and once it has
been on it is also possible to get early media with PT.

- Want PT-based demux? The MID header extension has to be removed in
  either the offer or the answer. Follow-up O/As allow PT demuxing if
  possible.
- Want to use MID or SSRC demuxing? Great, you don't need PT-based demux
  and won't mind that we turned it off for you.

The reason for disabling PT demux at offer time (if MID is present)
instead of waiting for the SDP answer is because by the time the SDP
answer arrives, early media could have triggered PT demux and caused
incorrect mappings. The safe thing is to assume a spec-compliant
endpoint until proven otherwise.

However if PT demux is ever enabled, then from that point on we always
allow PT-based demux in follow-up O/A exchanges. This ensures we don't
drop packets in follow-up exchanges. The fact that PT-based demux is
disabled during the initial offer should not matter because before the
initial O/A exchange we don't have fingerprints.

This change only affects Unified Plan and bundled groups. Existing test
coverage ensuring we do not break legacy endpoints:
[1] https://source.chromium.org/chromium/chromium/src/+/main:third_party/webrtc/pc/peer_connection_integrationtest.cc;l=1156
[2] https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/web_tests/external/wpt/webrtc/protocol/rtp-demuxing.html;l=59

UnsignaledStreamTest is also updated to test the interesting setups.
A kill-switch is added in case we want to disable this change.

Bug: webrtc:12814
Change-Id: I807a82a543325753633aaef698e06cb4c9dfebaa
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/221101
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34251}
2021-06-09 09:25:59 +00:00
Henrik Boström
f8187e0a82 [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-27 05:53:37 +00:00
Harald Alvestrand
48171ec264 Remove more mentions of RTP datachannels
Bug: webtc:6625
Change-Id: I38c51c4c10df8a5f517733f211e030359d33e787
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/215783
Reviewed-by: Florent Castelli <orphis@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33799}
2021-04-21 10:16:43 +00:00
Harald Alvestrand
8546666cb9 Add threading assertions to TransceiverList
Also add a function for accessing the list as internal transceivers
rather than accessing the proxy objects; this exposes where the
internal objects are accessed and where we need external references.

Used the new list function in sdp_offer_answer wherever possible.

Adds an UnsafeList function that is not thread guarded, so that the
job of rooting out those instances can be done in a later CL.

Bug: webrtc:12692
Change-Id: Ia591f22a1c8f82ec452a1a66a94fbf9ab9debd14
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/215581
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33781}
2021-04-20 06:44:40 +00:00
Harald Alvestrand
7af57c6e48 Remove RTP data implementation
Bug: webrtc:6625
Change-Id: Ie68d7a938d8b7be95a01cca74a176104e4e44e1b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/215321
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33759}
2021-04-16 13:10:54 +00:00
Tomas Gunnarsson
64099bcbe7 Add locking to UniqueRandomIdGenerator.
The SdpOfferAnswerHandler::ssrc_generator_ variable is used from
multiple threads.

Adding thread checks + tests for UniqueNumberGenerator along the way.

Bug: webrtc:12666
Change-Id: Id2973362a27fc1d2c7db60de2ea447d84d18ae3e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214702
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33668}
2021-04-09 10:04:25 +00:00
Tomas Gunnarsson
2efb8a5ec6 Invalidate weak pointers in SdpOfferAnswerHandler::Close().
This stops pending internal callbacks from performing unnecessary
operations when closed.

Also update tests pc tests to call Close().
This will allow PeerConnection to be able to expect the
normal path to be that IsClosed() be true in the dtor
once all 'normal' paths do that

Bug: webrtc:12633
Change-Id: I3882bedf200feda0d04594adeb0fdac85bfef652
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/213426
Commit-Queue: Tommi <tommi@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33617}
2021-04-01 21:33:52 +00:00
Tomas Gunnarsson
3278a71343 Delete unused method SdpOfferAnswerHandler::GetTransportName.
Bug: none
Change-Id: Ib6ef3c161b0d9e210d65200c4bff10f4582200bf
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/213186
Reviewed-by: Niels Moller <nisse@webrtc.org>
Commit-Queue: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33611}
2021-04-01 10:36:47 +00:00
Tomas Gunnarsson
8cb9706288 AddRemoteCandidate on the network thread
SdpOfferAnswerHandler now hands over most of the work of adding a
remote candidate over to PeerConnection where the work will be
carried out asynchronously on the network thread (was
synchronous/blocking).

Once added, reporting (ReportRemoteIceCandidateAdded) continues on the
signaling thread as before. The difference is though that we don't
block the UseCandidate() operation which is a part of applying the
local and remote descriptions.

Besides now being asynchronous, there's one behavioural change:
Before starting the 'add' operation, the validity of the candidate
instance to be added, is checked. Previously if such an error occurred,
the error was silently ignored.

Bug: webrtc:9987
Change-Id: Ic1bfb8e27670fc81038b6ccec95ff36c65d12262
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206063
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33230}
2021-02-11 09:54:45 +00:00
Artem Titov
d15a575ec3 Use SequenceChecker from public API
Bug: webrtc:12419
Change-Id: I00cca16a0ec70246156ba00b97aa7ae5ccbf5364
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/205323
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33220}
2021-02-10 15:04:55 +00:00
Taylor Brandstetter
d0acbd8645 Revert "Do all BaseChannel operations within a single Thread::Invoke."
This reverts commit c1ad1ff178.

Reason for revert: This blocks the worker thread for a longer 
contiguous period of time which can lead to delays in processing
packets. And due to other recent changes, the need to speed up
SetLocalDescription/SetRemoteDescription is reduced.

Still plan to reland some of the changes from the CL, just not the 
part that groups the Invokes.

Original change's description:
> Do all BaseChannel operations within a single Thread::Invoke.
>
> Instead of doing a separate Invoke for each channel, this CL first
> gathers a list of operations to be performed on the signaling thread,
> then does a single Invoke on the worker thread (and nested Invoke
> on the network thread) to update all channels at once.
>
> This includes the methods:
> * Enable
> * SetLocalContent/SetRemoteContent
> * RegisterRtpDemuxerSink
> * UpdateRtpHeaderExtensionMap
>
> Also, removed the need for a network thread Invoke in
> IsReadyToSendMedia_w by moving ownership of was_ever_writable_ to the
> worker thread.
>
> Bug: webrtc:12266
> Change-Id: I31e61fe0758aeb053b09db84f234deb58dfb3d05
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/194181
> Commit-Queue: Taylor <deadbeef@webrtc.org>
> Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#32817}

TBR=deadbeef@webrtc.org,hta@webrtc.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: webrtc:12266
Change-Id: I40ec519a614dc740133219f775b5638a488529b1
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/203860
Reviewed-by: Taylor <deadbeef@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Taylor <deadbeef@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33111}
2021-01-29 21:56:38 +00:00