Commit graph

111 commits

Author SHA1 Message Date
Steve Anton
bb19276a32 Use AsyncInvoker in PeerConnection instead of MessageHandler
Bug: webrtc:9702
Change-Id: I89d66d1165a096601aed37b8febad60620073899
Reviewed-on: https://webrtc-review.googlesource.com/97180
Reviewed-by: Seth Hampson <shampson@webrtc.org>
Commit-Queue: Steve Anton <steveanton@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24515}
2018-08-31 20:10:30 +00:00
Niels Möller
f06f923ef0 Delete almost all use of MediaConstraintsInterface in the PeerConnection API
Bug: webrtc:9239
Change-Id: I04f4370f624346bf72c7e4e090b57987b558213b
Reviewed-on: https://webrtc-review.googlesource.com/74420
Commit-Queue: Niels Moller <nisse@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24396}
2018-08-23 07:14:37 +00:00
Zach Stein
e20867ff6d Add AsyncResolverFactory interface and basic implementation.
The factory is plumbed down to P2PTransportChannel and will eventually
be used to resolve hostnames. Uses of PacketSocketFacotry::CreateAsyncResolver
will eventually be migrated to use this factory instead.

Bug: webrtc:4165
Change-Id: I1c48b2ffb8649609a831eba291f67ce544bb10eb
Reviewed-on: https://webrtc-review.googlesource.com/91300
Commit-Queue: Zach Stein <zstein@webrtc.org>
Reviewed-by: Emad Omara <emadomara@webrtc.org>
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Reviewed-by: Qingsi Wang <qingsi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24176}
2018-08-02 21:20:15 +00:00
Harald Alvestrand
7a1c7f782a Modified peerconnection's "observer" slot to be nulled on close.
This prevents usage of the observer post-close; modified the "usage
report notification" handler to not report when called post-close.
This fits the description of the original bug, so likely fixes it.

Bug: chromium:868337
Change-Id: Ic6757d2fb335203a6a6aacb2c9b52854b40332f7
Reviewed-on: https://webrtc-review.googlesource.com/91121
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Guido Urdaneta <guidou@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24164}
2018-08-01 09:44:57 +00:00
Steve Anton
24db573bea Step 1: Add RemoveTrackNew which returns an RTCError
Bug: webrtc:9534
Change-Id: I400bdcd0eb2e993b3f2252a2c7606cd105854e6b
Reviewed-on: https://webrtc-review.googlesource.com/89480
Commit-Queue: Steve Anton <steveanton@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24070}
2018-07-23 19:34:59 +00:00
Qingsi Wang
ee01a839d2 Remove MetricsObserverInterface.
The usage of MetricsObserverInterface to log metrics has been replaced
by RTC_HISTOGRAM_* macros in WebRTC.

Bug: webrtc:9409
Change-Id: I67df74a18942ac7ea4227e4affdf84f06258a287
Reviewed-on: https://webrtc-review.googlesource.com/86780
Commit-Queue: Qingsi Wang <qingsi@google.com>
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Qingsi Wang <qingsi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24048}
2018-07-19 23:00:20 +00:00
Steve Anton
0f5400acfa [Unified Plan] Implement FiredDirection for RtpTransceiver
Bug: webrtc:9236
Change-Id: Ib5a8215f3762f35b68d2a285c7d676f93f1212c5
Reviewed-on: https://webrtc-review.googlesource.com/88921
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24010}
2018-07-17 23:56:04 +00:00
Harald Alvestrand
056d811b6a Add counting of PCs with private IP addresses exposed
Bug: chromium:718508
Change-Id: I37f166808297c565cbb4b4393a23f7a18ab2862d
Reviewed-on: https://webrtc-review.googlesource.com/88640
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23990}
2018-07-16 18:04:09 +00:00
Qingsi Wang
7fc821d42d Reland "Reland "Replace the usage of MetricsObserverInterface by RTC_HISTOGRAM_*.""
This is a reland of 1a2cc0acba

Original change's description:
> Reland "Replace the usage of MetricsObserverInterface by RTC_HISTOGRAM_*."
>
> This is a reland of 870bca1f41
>
> Original change's description:
> > Replace the usage of MetricsObserverInterface by RTC_HISTOGRAM_*.
> >
> > We now use RTC_HISTOGRAM_* macros in system_wrappers/include/metrics.h
> > to report the metrics in pc/ and p2p/ that are currently been reported
> > using MetricsObserverInterface.
> >
> > TBR=tommi@webrtc.org
> >
> > Bug: webrtc:9409
> > Change-Id: I47c9975402293c72250203fa1ec19eb1668766f6
> > Reviewed-on: https://webrtc-review.googlesource.com/83782
> > Commit-Queue: Qingsi Wang <qingsi@google.com>
> > Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> > Reviewed-by: Taylor (left Google) <deadbeef@webrtc.org>
> > Reviewed-by: Steve Anton <steveanton@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#23914}
>
> TBR=steveanton@webrtc.org,hta@webrtc.org,tommi@webrtc.org
>
> Bug: webrtc:9409
> Change-Id: I37fc95ced60dea25aa9b4f5ad44bdf7174c8bd5c
> Reviewed-on: https://webrtc-review.googlesource.com/88060
> Reviewed-by: Qingsi Wang <qingsi@webrtc.org>
> Commit-Queue: Qingsi Wang <qingsi@google.com>
> Cr-Commit-Position: refs/heads/master@{#23919}

TBR=steveanton@webrtc.org,tommi@webrtc.org

Bug: webrtc:9409
Change-Id: Ib55f0b6c9bcb9d9585924a4dfac5cf643ff4d76b
Reviewed-on: https://webrtc-review.googlesource.com/88343
Commit-Queue: Qingsi Wang <qingsi@google.com>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23957}
2018-07-12 21:35:47 +00:00
Steve Anton
d78323faba Remove AddTrack override with MediaStreams
Bug: None
Change-Id: I992d356a7271fd89a174b0f458f9030092953b3e
Reviewed-on: https://webrtc-review.googlesource.com/88302
Reviewed-by: Seth Hampson <shampson@webrtc.org>
Commit-Queue: Steve Anton <steveanton@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23943}
2018-07-11 20:17:09 +00:00
Qingsi Wang
78fef76e6a Revert "Reland "Replace the usage of MetricsObserverInterface by RTC_HISTOGRAM_*.""
This reverts commit 1a2cc0acba.

Reason for revert: It breaks internal Android debug build. Need further investigation.

Original change's description:
> Reland "Replace the usage of MetricsObserverInterface by RTC_HISTOGRAM_*."
> 
> This is a reland of 870bca1f41
> 
> Original change's description:
> > Replace the usage of MetricsObserverInterface by RTC_HISTOGRAM_*.
> >
> > We now use RTC_HISTOGRAM_* macros in system_wrappers/include/metrics.h
> > to report the metrics in pc/ and p2p/ that are currently been reported
> > using MetricsObserverInterface.
> >
> > TBR=tommi@webrtc.org
> >
> > Bug: webrtc:9409
> > Change-Id: I47c9975402293c72250203fa1ec19eb1668766f6
> > Reviewed-on: https://webrtc-review.googlesource.com/83782
> > Commit-Queue: Qingsi Wang <qingsi@google.com>
> > Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> > Reviewed-by: Taylor (left Google) <deadbeef@webrtc.org>
> > Reviewed-by: Steve Anton <steveanton@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#23914}
> 
> TBR=steveanton@webrtc.org,hta@webrtc.org,tommi@webrtc.org
> 
> Bug: webrtc:9409
> Change-Id: I37fc95ced60dea25aa9b4f5ad44bdf7174c8bd5c
> Reviewed-on: https://webrtc-review.googlesource.com/88060
> Reviewed-by: Qingsi Wang <qingsi@webrtc.org>
> Commit-Queue: Qingsi Wang <qingsi@google.com>
> Cr-Commit-Position: refs/heads/master@{#23919}

TBR=steveanton@webrtc.org,deadbeef@webrtc.org,tommi@webrtc.org,hta@webrtc.org,qingsi@google.com,qingsi@webrtc.org

Change-Id: I4a75fc7f52bfd0780526537a5a9a016fb9c20d6a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:9409
Reviewed-on: https://webrtc-review.googlesource.com/88320
Reviewed-by: Qingsi Wang <qingsi@webrtc.org>
Commit-Queue: Qingsi Wang <qingsi@google.com>
Cr-Commit-Position: refs/heads/master@{#23938}
2018-07-11 18:37:36 +00:00
Qingsi Wang
1a2cc0acba Reland "Replace the usage of MetricsObserverInterface by RTC_HISTOGRAM_*."
This is a reland of 870bca1f41

Original change's description:
> Replace the usage of MetricsObserverInterface by RTC_HISTOGRAM_*.
>
> We now use RTC_HISTOGRAM_* macros in system_wrappers/include/metrics.h
> to report the metrics in pc/ and p2p/ that are currently been reported
> using MetricsObserverInterface.
>
> TBR=tommi@webrtc.org
>
> Bug: webrtc:9409
> Change-Id: I47c9975402293c72250203fa1ec19eb1668766f6
> Reviewed-on: https://webrtc-review.googlesource.com/83782
> Commit-Queue: Qingsi Wang <qingsi@google.com>
> Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> Reviewed-by: Taylor (left Google) <deadbeef@webrtc.org>
> Reviewed-by: Steve Anton <steveanton@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#23914}

TBR=steveanton@webrtc.org,hta@webrtc.org,tommi@webrtc.org

Bug: webrtc:9409
Change-Id: I37fc95ced60dea25aa9b4f5ad44bdf7174c8bd5c
Reviewed-on: https://webrtc-review.googlesource.com/88060
Reviewed-by: Qingsi Wang <qingsi@webrtc.org>
Commit-Queue: Qingsi Wang <qingsi@google.com>
Cr-Commit-Position: refs/heads/master@{#23919}
2018-07-11 04:40:26 +00:00
Qingsi Wang
13f4c896d5 Revert "Replace the usage of MetricsObserverInterface by RTC_HISTOGRAM_*."
This reverts commit 870bca1f41.

Reason for revert: it breaks internal tests and builds

Original change's description:
> Replace the usage of MetricsObserverInterface by RTC_HISTOGRAM_*.
>
> We now use RTC_HISTOGRAM_* macros in system_wrappers/include/metrics.h
> to report the metrics in pc/ and p2p/ that are currently been reported
> using MetricsObserverInterface.
>
> TBR=tommi@webrtc.org
>
> Bug: webrtc:9409
> Change-Id: I47c9975402293c72250203fa1ec19eb1668766f6
> Reviewed-on: https://webrtc-review.googlesource.com/83782
> Commit-Queue: Qingsi Wang <qingsi@google.com>
> Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> Reviewed-by: Taylor (left Google) <deadbeef@webrtc.org>
> Reviewed-by: Steve Anton <steveanton@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#23914}

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

Change-Id: I1afd92d44f3b8cf3ae9aa6e6daa9a3a272e8097f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:9409
Reviewed-on: https://webrtc-review.googlesource.com/88040
Reviewed-by: Qingsi Wang <qingsi@webrtc.org>
Commit-Queue: Qingsi Wang <qingsi@google.com>
Cr-Commit-Position: refs/heads/master@{#23916}
2018-07-10 21:26:28 +00:00
Qingsi Wang
870bca1f41 Replace the usage of MetricsObserverInterface by RTC_HISTOGRAM_*.
We now use RTC_HISTOGRAM_* macros in system_wrappers/include/metrics.h
to report the metrics in pc/ and p2p/ that are currently been reported
using MetricsObserverInterface.

TBR=tommi@webrtc.org

Bug: webrtc:9409
Change-Id: I47c9975402293c72250203fa1ec19eb1668766f6
Reviewed-on: https://webrtc-review.googlesource.com/83782
Commit-Queue: Qingsi Wang <qingsi@google.com>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Taylor (left Google) <deadbeef@webrtc.org>
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23914}
2018-07-10 20:02:16 +00:00
Harald Alvestrand
b2a7478221 Fix usage logging of TURN and STUN servers
Also adds tests, and adds a bit of logging in ParseIceServers.

Bug: chromium:718508
Change-Id: Id41ccb7cccbdab5af76e380b32b4d8ba0c4a0a72
Reviewed-on: https://webrtc-review.googlesource.com/86121
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23769}
2018-06-28 12:52:07 +00:00
Steve Anton
111fdfd732 Refactor RtpSender to take the sender ID as a constructor argument
This change also standardizes the RtpSender to a single constructor
and moves the |track| and |stream_ids| arguments to setter methods.

Bug: webrtc:8734
Change-Id: I227a84868a80797f6cc2a1af6eec6d76da8ea159
Reviewed-on: https://webrtc-review.googlesource.com/84248
Commit-Queue: Steve Anton <steveanton@webrtc.org>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Reviewed-by: Seth Hampson <shampson@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23730}
2018-06-25 21:01:02 +00:00
Harald Alvestrand
1979384e40 Ensure that PC usage is recorded if a PC is alive for 60 seconds.
Bug: chromium:718508
Change-Id: Id2cbcb370b56cb8a6a6c821e0f89c51089cc8e6b
Reviewed-on: https://webrtc-review.googlesource.com/83140
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23723}
2018-06-25 10:25:38 +00:00
Steve Anton
b983bae923 Remove unused/deprecated DTMF methods
PeerConnectionInterface::CreateDtmfSender
DtmfSenderInterface::track

Bug: webrtc:9426
Change-Id: I7d151d8e0bdd60750ed60466083245631d540a91
Reviewed-on: https://webrtc-review.googlesource.com/84244
Commit-Queue: Steve Anton <steveanton@webrtc.org>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23690}
2018-06-20 21:00:10 +00:00
Danil Chapovalov
66cadcc6b9 Replace rtc::Optional with absl::optional in pc
This is a no-op change because rtc::Optional is an alias to absl::optional

This CL generated by running script with parameter 'pc'

find $@ -type f \( -name \*.h -o -name \*.cc \) \
-exec sed -i 's|rtc::Optional|absl::optional|g' {} \+ \
-exec sed -i 's|rtc::nullopt|absl::nullopt|g' {} \+ \
-exec sed -i 's|#include "api/optional.h"|#include "absl/types/optional.h"|' {} \+

find $@ -type f -name BUILD.gn \
-exec sed -r -i 's|"[\./api]*:optional"|"//third_party/abseil-cpp/absl/types:optional"|' {} \+;

git cl format

Bug: webrtc:9078
Change-Id: Ide3b9eb32df7f25991f898ac58fcb119c9f8ae12
Reviewed-on: https://webrtc-review.googlesource.com/84181
Reviewed-by: Per Kjellander <perkj@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23669}
2018-06-19 20:55:07 +00:00
Taylor Brandstetter
cdd05f0cc1 Implement proper SCTP data channel closing procedure.
The proper closing procedure is:
1. Alice resets outgoing stream.
2. Bob receives incoming stream reset, resets his outgoing stream.
3. Alice receives incoming stream reset; channel closed!
4. Bob receives acknowledgement of reset; channel closed!

https://tools.ietf.org/html/draft-ietf-rtcweb-data-channel-13#section-6.7

However, up until now we've been sending both an incoming and outgoing reset
from the side initiating the closing procedure, and doing nothing on the remote
side.

This means that if you call "Close" and the remote endpoint is using an old
version of WebRTC, the channel's state will be stuck at "closing" since the
remote endpoint won't send a reset. Which is already what happens when Firefox
is talking to Chrome.

This CL also fixes an issue where the DataChannel's state prematurely went to
"closed" before the closing procedure was complete. Which could result in a
new DataChannel attempting to re-use the ID and failing.

TBR=magjed@webrtc.org

Bug: chromium:449934, webrtc:4453
Change-Id: Ic1ba813e46538c6c65868961aae6a9780d68a5e2
Reviewed-on: https://webrtc-review.googlesource.com/79061
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23478}
2018-05-31 21:01:53 +00:00
Harald Alvestrand
8ebba7420c Add collection of usage signatures on PeerConnections
This generates a number that represent a set of bits that
indicates how a PeerConnection has been used over time.

Bug: chromium:718508
Change-Id: I6df177684c50bc825bc41ea97996574292084d41
Reviewed-on: https://webrtc-review.googlesource.com/79823
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Fredrik Solenberg <solenberg@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23471}
2018-05-31 13:07:09 +00:00
Benjamin Wright
d6f86e8fca This changeset adds dependency injection support for SSL Root Certs.
This extends the API surface so that
custom certificates can be provided by an API user in both the standalone and
factory creation paths for the OpenSSLAdapter. Prior to this change the SSL
roots were hardcoded in a header file and directly included into
openssladapter.cc. This forces the 100 kilobytes of certificates to always be
compiled into the library. This is undesirable in certain linking cases where
these certificates can be shared from another binary that already has an
equivalent set of trusted roots hard coded into the binary.

Support for removing the hard coded SSL roots has also been added through a new
build flag. By default the hard coded SSL roots will be included and will be
used if no other trusted root certificates are provided.

The main goal of this CL is to reduce total binary size requirements of WebRTC
by about 100kb in certain applications where adding these certificates is
redundant.

Change-Id: Ifd36d92b5cb32d1b3098a61ddfc244d76df8f30f

Bug: chromium:526260
Change-Id: Ifd36d92b5cb32d1b3098a61ddfc244d76df8f30f
Reviewed-on: https://webrtc-review.googlesource.com/64841
Commit-Queue: Benjamin Wright <benwright@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23180}
2018-05-09 00:24:05 +00:00
Niels Möller
0c4f7beb25 New api struct BitrateSettings.
Replaces both BitrateConstraintsMask and
PeerConnectionInterface::BitrateParameters. The latter is kept
temporarily for backwards compatibility.

Bug: None
Change-Id: Ibe1d043f2a76e56ff67809774e9c0f5e0ec9e00f
Reviewed-on: https://webrtc-review.googlesource.com/74020
Commit-Queue: Niels Moller <nisse@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23148}
2018-05-07 15:01:28 +00:00
Benjamin Wright
cab58888ad Integrated PeerConnectionDependencies into PeerConnection::Initialize
Integrates the new PeerConnectionDependencies structure into
PeerConnection::Initialize to simplify future injections.

Bug: webrtc:7913
Change-Id: Ida1feae8b81819dfbfe5b79ed7807a63b091e73f
Reviewed-on: https://webrtc-review.googlesource.com/73960
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Commit-Queue: Benjamin Wright <benwright@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23130}
2018-05-04 19:18:05 +00:00
Steve Anton
c79268f15a Add IsClosed checks to various PeerConnection methods
This brings the implementations in line with the WebRTC
specification.

Bug: chromium:829238
Change-Id: I7ef64e7b6ccf0e9f60f017443565494239ff19cc
Reviewed-on: https://webrtc-review.googlesource.com/71961
Commit-Queue: Steve Anton <steveanton@webrtc.org>
Reviewed-by: Seth Hampson <shampson@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23013}
2018-04-24 23:07:21 +00:00
Taylor Brandstetter
cbaa254641 Attempting to fix lingering issues with BUNDLE negotiation.
I found one additional way a crash could occur: "OnRtpTransportChanged"
being called instead of "OnDtlsTransportChanged", due to a mixup of m=
section types. I could reproduce this by:

1. Applying description with RTP data channel m= section.
2. Applying description with both a rejected RTP data channel m=
   section and rejected SCTP m= section.

This is a very strange scenario, but maybe there are other ways to
reproduce that I haven't thought of.

The solution is to combine "OnRtpTransportChanged" and
"OnDtlsTransportChanged", and not do anything with the content type.
This simplifies the code a bit as well.

Bug: chromium:827917
Change-Id: If6818ea0c41573255831534060b30c76a6544e04
Reviewed-on: https://webrtc-review.googlesource.com/70360
Reviewed-by: Zhi Huang <zhihuang@webrtc.org>
Commit-Queue: Zhi Huang <zhihuang@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22893}
2018-04-17 01:04:12 +00:00
Qingsi Wang
a2d60679c9 Reland "Add thread checker to PortAllocator and its subclasses and fix a bug causing memory contention by threads."
This is a reland of fc43d11717

Original change's description:
> Add thread checker to PortAllocator and its subclasses and fix a bug
> causing memory contention by threads.
>
> PortAllocator and its subclasses assume all of their methods except the
> constructor must be called on the same thread (the network thread in
> practice). This CL adds a thread checker to PortAllocator and its
> subclasses for thread safety, and fixes bugs of invoking some of their
> methods in PeerConnection on the signaling thread.
>
> Bug: webrtc:9112
> Change-Id: I33ba9bae72ec09a45ec70435962f3f25cd31583c
> Reviewed-on: https://webrtc-review.googlesource.com/66945
> Commit-Queue: Qingsi Wang <qingsi@google.com>
> Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#22814}

Bug: webrtc:9112
Change-Id: I5c7377f05c0daccbe469e2fdbdfacabc5c222f4c
Reviewed-on: https://webrtc-review.googlesource.com/69422
Commit-Queue: Qingsi Wang <qingsi@google.com>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22889}
2018-04-16 21:44:28 +00:00
Zhi Huang
365381fdf1 Replace BundleFilter with RtpDemuxer in RtpTransport.
BundleFilter is replaced by RtpDemuxer in RtpTransport for payload
type-based demuxing. RtpTransport will support MID-based demuxing later.

Each BaseChannel has its own RTP demuxing criteria and when connecting
to the RtpTransport, BaseChannel will register itself as a demuxer sink.

The inheritance model is changed. New inheritance chain:
DtlsSrtpTransport->SrtpTransport->RtpTranpsort

The JsepTransport2 is renamed to JsepTransport.

NOTE:
When RTCP packets are received, Call::DeliverRtcp will be called for
multiple times (webrtc:9035) which is an existing issue. With this CL,
it will become more of a problem and should be fixed.

Bug: webrtc:8587
Change-Id: Ibd880e7b744bd912336a691309950bc18e42cf62
Reviewed-on: https://webrtc-review.googlesource.com/65786
Commit-Queue: Zhi Huang <zhihuang@webrtc.org>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Reviewed-by: Benjamin Wright <benwright@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22867}
2018-04-14 00:57:11 +00:00
Patrik Höglund
3dc41069ef Revert "Add thread checker to PortAllocator and its subclasses and fix a bug"
This reverts commit fc43d11717.

Reason for revert: Crashes downstream tests

Original change's description:
> Add thread checker to PortAllocator and its subclasses and fix a bug
> causing memory contention by threads.
> 
> PortAllocator and its subclasses assume all of their methods except the
> constructor must be called on the same thread (the network thread in
> practice). This CL adds a thread checker to PortAllocator and its
> subclasses for thread safety, and fixes bugs of invoking some of their
> methods in PeerConnection on the signaling thread.
> 
> Bug: webrtc:9112
> Change-Id: I33ba9bae72ec09a45ec70435962f3f25cd31583c
> Reviewed-on: https://webrtc-review.googlesource.com/66945
> Commit-Queue: Qingsi Wang <qingsi@google.com>
> Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#22814}

TBR=deadbeef@webrtc.org,pthatcher@google.com,pthatcher@webrtc.org,qingsi@google.com,honghaiz@webrtc.org

Change-Id: I2db6561d5d6366d38caa58c3e719d0d48eda70c2
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:9112
Reviewed-on: https://webrtc-review.googlesource.com/69200
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Commit-Queue: Patrik Höglund <phoglund@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22818}
2018-04-11 11:15:08 +00:00
Qingsi Wang
fc43d11717 Add thread checker to PortAllocator and its subclasses and fix a bug
causing memory contention by threads.

PortAllocator and its subclasses assume all of their methods except the
constructor must be called on the same thread (the network thread in
practice). This CL adds a thread checker to PortAllocator and its
subclasses for thread safety, and fixes bugs of invoking some of their
methods in PeerConnection on the signaling thread.

Bug: webrtc:9112
Change-Id: I33ba9bae72ec09a45ec70435962f3f25cd31583c
Reviewed-on: https://webrtc-review.googlesource.com/66945
Commit-Queue: Qingsi Wang <qingsi@google.com>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22814}
2018-04-11 00:06:40 +00:00
Zhi Huang
e830e683c4 Use new TransportController implementation in PeerConnection.
The TransportController will be replaced by the JsepTransportController
and JsepTransport will be replace be JsepTransport2.

The JsepTransportController will take the entire SessionDescription
and handle the RtcpMux, Sdes and BUNDLE internally.

The ownership model is also changed. The P2P layer transports are not
ref-counted and will be owned by the JsepTransport2.

In ORTC aspect, RtpTransportAdapter is now a wrapper over RtpTransport
or SrtpTransport and it implements the public and internal interface
by calling the transport underneath.

Bug: webrtc:8587
Change-Id: Ia7fa61288a566f211f8560072ea0eecaf19e48df
Reviewed-on: https://webrtc-review.googlesource.com/59586
Commit-Queue: Zhi Huang <zhihuang@webrtc.org>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22693}
2018-03-30 18:41:19 +00:00
Emircan Uysaler
bc609eaab1 Revert "Adds support for multiple or no media stream ids."
This reverts commit 1550292efe.

Reason for revert: 

webkit_layout_tests:fast/peerconnection/RTCPeerConnection-sdpSemantics.html is broken, see below. WebRTC roll isn't going through because of it. This CL looks the most suspicious within the 5 in the range. 

https://chromium-review.googlesource.com/c/chromium/src/+/981899
https://webrtc.googlesource.com/src.git/+log/bb50ce5bb6d5..27f3bf512827
https://ci.chromium.org/p/chromium/builders/luci.chromium.try/linux_chromium_rel_ng/54616

Original change's description:
> Adds support for multiple or no media stream ids.
> 
> With Unified Plan SDP semantics, this adds support for specifying
> either no media stream ids or multiple media stream ids for a
> transceiver/sender/receiver. This includes serializing/deserializing
> SDPs with multiple a=msid lines in a m section, or an "a=msid:-
> <appdata>" line to indicate the no stream case. Note that this does
> not synchronize between multiple streams, this is still just supported
> based upon the first media stream id.
> 
> Bug: webrtc:7932, webrtc:7933
> Change-Id: Ib7433929af7b2925abe2824b485b360cec12f275
> Reviewed-on: https://webrtc-review.googlesource.com/61341
> Commit-Queue: Seth Hampson <shampson@webrtc.org>
> Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
> Reviewed-by: Steve Anton <steveanton@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#22611}

TBR=steveanton@webrtc.org,deadbeef@webrtc.org,shampson@webrtc.org

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

Bug: webrtc:7932, webrtc:7933
Change-Id: I1d4e4332b518ec32b305c8af07679650059d02bb
Reviewed-on: https://webrtc-review.googlesource.com/65000
Reviewed-by: Emircan Uysaler <emircan@webrtc.org>
Commit-Queue: Emircan Uysaler <emircan@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22634}
2018-03-27 23:01:55 +00:00
Seth Hampson
1550292efe Adds support for multiple or no media stream ids.
With Unified Plan SDP semantics, this adds support for specifying
either no media stream ids or multiple media stream ids for a
transceiver/sender/receiver. This includes serializing/deserializing
SDPs with multiple a=msid lines in a m section, or an "a=msid:-
<appdata>" line to indicate the no stream case. Note that this does
not synchronize between multiple streams, this is still just supported
based upon the first media stream id.

Bug: webrtc:7932, webrtc:7933
Change-Id: Ib7433929af7b2925abe2824b485b360cec12f275
Reviewed-on: https://webrtc-review.googlesource.com/61341
Commit-Queue: Seth Hampson <shampson@webrtc.org>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22611}
2018-03-26 21:21:50 +00:00
Henrik Boström
1df1bf8551 PeerConnectionInterface::GetStats() with selector argument added.
This exposes the stats selection algorithm[1] on the PeerConnection.

Per-spec, there are four flavors of getStats():
1. RTCPeerConnection.getStats().
2. RTCPeerConnection.getStats(MediaStreamTrack selector).
3. RTCRtpSender.getStats().
4. RTCRtpReceiver.getStats().

1) is the parameterless getStats() which is already shipped.
2) is the same as 3) and 4) except the track is used to look up the
corresponding sender/receiver to use as the selector.
3) and 4) perform stats collection with a filter, which is implemented
in RTCStatsCollector.GetStatsReport(selector).

For technical reasons, it is easier to place GetStats() on the
PeerConnection where the RTCStatsCollector lives than to place it on the
sender/receiver. Passing the selector as an argument or as a "this"
makes little difference other than style. Wiring Chrome up such that the
JavaScript APIs is like the spec is trivial after GetStats() is added to
PeerConnectionInterface.

This CL also adds comments documenting our intent to deprecate and
remove the legacy GetStats() APIs some time in the future.

[1] https://w3c.github.io/webrtc-pc/#dfn-stats-selection-algorithm

Bug: chromium:680172
Change-Id: I09316ba6f20b25d4f9c11785d0a1a1262d6062a1
Reviewed-on: https://webrtc-review.googlesource.com/62900
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22602}
2018-03-26 12:08:20 +00:00
Harald Alvestrand
5081c0cc6d Change error handlers for Set*Description to use RTCError
Needed in order to return error codes to Chromium.

Bug: chromium:819629, chromium:589455
Change-Id: Iab22250db62a348eee21c6d8bfc44020a7380586
Reviewed-on: https://webrtc-review.googlesource.com/60522
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Fredrik Solenberg <solenberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22367}
2018-03-09 15:37:34 +00:00
Steve Anton
8e20f17d1d Report UMA metrics for received SDP format
This change adds UMA stats that record the format of the remote offered
SDP. There are three classifications for the SDP format:
- Simple: No more than one audio and one video. Should be compatible
    with both Plan B and Unified Plan endpoints.
- ComplexPlanB: More than one audio or more than one video in the Plan B
    format (e.g., one audio mline with multiple streams).
- ComplexUnifiedPlan: More than one audio or more than one video in the
    Unified Plan format (e.g., two audio mlines).

Bug: chromium:811683
Change-Id: If46394edfa6a812ef313d632e27ec27516c18867
Reviewed-on: https://webrtc-review.googlesource.com/57220
Commit-Queue: Steve Anton <steveanton@webrtc.org>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22315}
2018-03-06 21:22:51 +00:00
Seth Hampson
845e87877e Name change from stream label to stream id for spec compliance.
Bug: webrtc:7932
Change-Id: I66f33597342394083256f050cac2a00a68042302
Reviewed-on: https://webrtc-review.googlesource.com/59280
Commit-Queue: Seth Hampson <shampson@webrtc.org>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22276}
2018-03-02 20:44:48 +00:00
Steve Anton
0ffaaa26f9 Report negotiated SDP semantics for local answers also
Bug: chromium:811683
Change-Id: I8c51a3a1f58190c9dcd849ef451254ce230ea710
Reviewed-on: https://webrtc-review.googlesource.com/57128
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Steve Anton <steveanton@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22216}
2018-02-28 02:47:57 +00:00
Taylor Brandstetter
c392866d86 Implement certificate chain stats.
There was an implementation, but it relied on SSLCertificate::GetChain,
which was never implemented. Except in the fake certificate classes
used by the stats collector tests, hence the tests were passing.

Instead of implementing GetChain, we decided (in
https://webrtc-review.googlesource.com/c/src/+/6500) to add
methods that return a SSLCertChain directly, since it results in a
somewhat cleaner object model.

So this CL switches everything to use the "chain" methods, and gets
rid of the obsolete methods and member variables.

Bug: webrtc:8920
Change-Id: Ie9d7d53654ba859535462521b54c788adec7badf
Reviewed-on: https://webrtc-review.googlesource.com/56961
Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org>
Reviewed-by: Zhi Huang <zhihuang@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22177}
2018-02-24 00:44:06 +00:00
Steve Anton
52d86774c2 Fire OnRenegotiationNeeded when changing transceiver direction
This is specified by the WebRTC specification:
https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-direction

Bug: webrtc:7600
Change-Id: If45ba0383e5040d250cd3c1c2525ff3b03b1eb4f
Reviewed-on: https://webrtc-review.googlesource.com/55880
Reviewed-by: Seth Hampson <shampson@webrtc.org>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Commit-Queue: Steve Anton <steveanton@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22139}
2018-02-21 19:15:09 +00:00
Qingsi Wang
72a43a1d2c Collect packet loss and RTT stats of STUN binding requests.
STUN candidates use STUN binding requests to keep NAT bindings open.
Related stats including packet loss and RTT can be now collected via the
legacy GetStats in PeerConnection.

Bug: None
Change-Id: I7b0eee1ccb07eb670a32ee303c9590047b25f31c
Reviewed-on: https://webrtc-review.googlesource.com/54100
Commit-Queue: Qingsi Wang <qingsi@google.com>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22113}
2018-02-21 00:49:26 +00:00
Steve Anton
afb0bb73de Remove PeerConnection voice_channel/video_channel methods
These methods no longer work with Unified Plan and have been
replaced by iterating over RtpTransceivers to get all the
VoiceChannels and VideoChannels.

Bug: webrtc:8587
Change-Id: I66ec282ee9f7eb987c32e30957733c13c6cf45b8
Reviewed-on: https://webrtc-review.googlesource.com/55760
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Commit-Queue: Steve Anton <steveanton@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22110}
2018-02-20 23:40:16 +00:00
Qingsi Wang
db53f8e604 Add configurable STUN binding request interval.
STUN candidates use STUN binding requests to keep NAT bindings open. The
interval at which the STUN keepalive pings are sent is configurable now
via RTCConfiguration.

TBR=sakal@webrtc.org

Bug: None
Change-Id: I5f99ea3fe1e9042fa2bf7dcab0aace78f57739e6
Reviewed-on: https://webrtc-review.googlesource.com/54180
Commit-Queue: Qingsi Wang <qingsi@google.com>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22109}
2018-02-20 23:32:46 +00:00
Steve Anton
8b815cddca Add OnTrack PeerConnection callback for Unified Plan
This adds a callback corresponding to the ontrack event as defined
in the WebRTC specification.

Bug: webrtc:7600
Change-Id: Ied8c55e11dcea864428fb194623c1595c21657c7
Reviewed-on: https://webrtc-review.googlesource.com/52660
Commit-Queue: Steve Anton <steveanton@webrtc.org>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22066}
2018-02-17 01:03:59 +00:00
Seth Hampson
ae8a90a1d4 Fixes to PeerConnection for Unified Plan sdp & transceiver logic.
This change includes updates to the sdp logic, and transceiver
dissociation and also tests these updates. The sdp validation for
unified plan is updated to consider both the stored remote and local
descriptions for an offer, because either could be the most up to date.
This is important when considering a recycled m section. This also
updates to only dissociate a transceiver when we are setting the remote
or local description from an offer. The final small update allows us to
properly create a media description for a transceiver that is not new
but is part of a recycled m section that has only been set locally for
an offer and we are re-offering.

Bug: webrtc:8765
Change-Id: Ia86e54fcd977478824cfa88ebaf992215ed68aae
Reviewed-on: https://webrtc-review.googlesource.com/52080
Commit-Queue: Seth Hampson <shampson@webrtc.org>
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22025}
2018-02-14 17:58:09 +00:00
Steve Anton
b8867115a7 Prepare StatsCollector to work with RtpTransceivers
This changes the StatsCollector to handle stats from multiple
MediaChannels of the same type (e.g., audio or video).

Bug: webrtc:8764
Change-Id: I91ba50d10cf469420189a311acdafbf6f78579b2
Reviewed-on: https://webrtc-review.googlesource.com/49560
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Commit-Queue: Steve Anton <steveanton@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22009}
2018-02-14 03:42:04 +00:00
Steve Anton
5dfde18c77 Change PeerConnection stats interface to be more flexible
This removes the SessionStats object and replaces it with two
methods on PeerConnection: GetTransportNamesByMid and
GetTransportStatsByNames for use by the stats collectors. These
methods are more flexible and can cover cases where there are more
than one video/audio channel.

Bug: webrtc:8764
Change-Id: Id400cc548fc43675462ff6175a7fa9c9f4fd5948
Reviewed-on: https://webrtc-review.googlesource.com/47244
Commit-Queue: Steve Anton <steveanton@webrtc.org>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21921}
2018-02-06 19:02:44 +00:00
Steve Anton
c7b964cd71 Report cipher usage to UMA for all media types on a transport
Previously, the code which reported cipher stats to UMA for all
transports would classify the media type based on the transport name,
which is brittle and misleading with BUNDLE. This corrects the code to
track all media types (audio, video, data) which use the transport and
report once for each.

Bug: None
Change-Id: I8506f64f0011788b744b8386ac58518a21914b52
Reviewed-on: https://webrtc-review.googlesource.com/47247
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Commit-Queue: Steve Anton <steveanton@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21863}
2018-02-02 00:56:44 +00:00
Zhi Huang
70b820fefe Implemented the GetRemoteAudioSSLCertificate method.
This method returns the DTLS SSL certificate chain associated with the
audio transport on the remote side. This will become populated once the
DTLS connection with the peer has been completed.

TBR=deadbeef@webrtc.org

Bug: webrtc:8800
Change-Id: Ib90ccb3463415e798c17c187c5bdbfc4da26f11f
Reviewed-on: https://webrtc-review.googlesource.com/44140
Commit-Queue: Zhi Huang <zhihuang@webrtc.org>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21785}
2018-01-27 23:48:36 +00:00
Steve Anton
22da89f502 Implement legacy offer_to_receive options for Unified Plan
This implements the WebRTC specification for handling
the legacy offer options offer_to_receive_audio and
offer_to_receive_video. They are not implemented for CreateAnswer.

With Unified Plan semantics, clients should switch to the
RtpTransceiver API for ensuring the correct media sections are
offered.

Bug: webrtc:7600
Change-Id: I6ced00b86b165a352bd0ca3d64b48fadcfd12235
Reviewed-on: https://webrtc-review.googlesource.com/41341
Reviewed-by: Peter Thatcher <pthatcher@webrtc.org>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Commit-Queue: Steve Anton <steveanton@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21784}
2018-01-27 02:20:29 +00:00