webrtc_m130/pc/peerconnection_rtp_unittest.cc

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

442 lines
19 KiB
C++
Raw Normal View History

Reland "Added PeerConnectionObserver::OnRemoveTrack." This reverts commit 6c0c55c31817ecfa32409424495eb68b31828c40. Reason for revert: Fixed the flake. Original change's description: > Revert "Added PeerConnectionObserver::OnRemoveTrack." > > This reverts commit ba97ba7af917d4152f5f3363aba1c1561c6673dc. > > Reason for revert: The new tests have caused several test failures on the test bots; the method FakeAudioMediaStreamTrack:GetSignalLevel, which is not supposed to be called is sometimes called anyway. > > Original change's description: > > Added PeerConnectionObserver::OnRemoveTrack. > > > > This corresponds to processing the removal of a remote track step of > > the spec, with processing the addition of a remote track already > > covered by OnAddTrack. > > https://w3c.github.io/webrtc-pc/#processing-remote-mediastreamtracks > > > > Bug: webrtc:8260, webrtc:8315 > > Change-Id: Ica8be92369733eb3cf1397fb60385d45a9b58700 > > Reviewed-on: https://webrtc-review.googlesource.com/4722 > > Commit-Queue: Henrik Boström <hbos@webrtc.org> > > Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> > > Reviewed-by: Steve Anton <steveanton@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#20214} > > TBR=steveanton@webrtc.org,deadbeef@webrtc.org,hbos@webrtc.org > > Change-Id: Id2d9533e27227254769b4280a8ff10a47313e714 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:8260, webrtc:8315 > Reviewed-on: https://webrtc-review.googlesource.com/7940 > Reviewed-by: Alex Loiko <aleloi@webrtc.org> > Commit-Queue: Alex Loiko <aleloi@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20218} TBR=steveanton@webrtc.org,deadbeef@webrtc.org,aleloi@webrtc.org,hbos@webrtc.org Change-Id: Iab7500bebf98535754b102874259de43831fff6b No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:8260, webrtc:8315 Reviewed-on: https://webrtc-review.googlesource.com/8180 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20227}
2017-10-10 10:05:16 -07:00
/*
* 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 <memory>
#include <vector>
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
#include "api/audio_codecs/builtin_audio_encoder_factory.h"
Reland "Added PeerConnectionObserver::OnRemoveTrack." This reverts commit 6c0c55c31817ecfa32409424495eb68b31828c40. Reason for revert: Fixed the flake. Original change's description: > Revert "Added PeerConnectionObserver::OnRemoveTrack." > > This reverts commit ba97ba7af917d4152f5f3363aba1c1561c6673dc. > > Reason for revert: The new tests have caused several test failures on the test bots; the method FakeAudioMediaStreamTrack:GetSignalLevel, which is not supposed to be called is sometimes called anyway. > > Original change's description: > > Added PeerConnectionObserver::OnRemoveTrack. > > > > This corresponds to processing the removal of a remote track step of > > the spec, with processing the addition of a remote track already > > covered by OnAddTrack. > > https://w3c.github.io/webrtc-pc/#processing-remote-mediastreamtracks > > > > Bug: webrtc:8260, webrtc:8315 > > Change-Id: Ica8be92369733eb3cf1397fb60385d45a9b58700 > > Reviewed-on: https://webrtc-review.googlesource.com/4722 > > Commit-Queue: Henrik Boström <hbos@webrtc.org> > > Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> > > Reviewed-by: Steve Anton <steveanton@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#20214} > > TBR=steveanton@webrtc.org,deadbeef@webrtc.org,hbos@webrtc.org > > Change-Id: Id2d9533e27227254769b4280a8ff10a47313e714 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:8260, webrtc:8315 > Reviewed-on: https://webrtc-review.googlesource.com/7940 > Reviewed-by: Alex Loiko <aleloi@webrtc.org> > Commit-Queue: Alex Loiko <aleloi@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20218} TBR=steveanton@webrtc.org,deadbeef@webrtc.org,aleloi@webrtc.org,hbos@webrtc.org Change-Id: Iab7500bebf98535754b102874259de43831fff6b No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:8260, webrtc:8315 Reviewed-on: https://webrtc-review.googlesource.com/8180 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20227}
2017-10-10 10:05:16 -07:00
#include "api/jsep.h"
#include "api/mediastreaminterface.h"
#include "api/peerconnectioninterface.h"
#include "pc/mediastream.h"
#include "pc/mediastreamtrack.h"
#include "pc/peerconnectionwrapper.h"
#include "pc/test/fakeaudiocapturemodule.h"
#include "pc/test/mockpeerconnectionobservers.h"
#include "rtc_base/checks.h"
#include "rtc_base/gunit.h"
#include "rtc_base/ptr_util.h"
#include "rtc_base/refcountedobject.h"
#include "rtc_base/scoped_ref_ptr.h"
#include "rtc_base/thread.h"
// This file contains tests for RTP Media API-related behavior of
// |webrtc::PeerConnection|, see https://w3c.github.io/webrtc-pc/#rtp-media-api.
Revert "Add AddTransceiver and GetTransceivers to PeerConnection" This reverts commit f93d2800d9b0d5818a5a383def0aaef3d441df3a. Reason for revert: https://logs.chromium.org/v/?s=chromium%2Fbb%2Fchromium.webrtc.fyi%2Fios-device%2F5804%2F%2B%2Frecipes%2Fsteps%2Fcompile%2F0%2Fstdout Original change's description: > Add AddTransceiver and GetTransceivers to PeerConnection > > WebRTC 1.0 has added the transceiver API to PeerConnection. This > is the first step towards exposing this to WebRTC consumers. For > now, transceivers can be added and fetched but there is not yet > support for creating offers/answers or setting local/remote > descriptions. That support ("Unified Plan") will be added in > follow-up CLs. > > The transceiver API is currently only available if the application > opts in by specifying the kUnifiedPlan SDP semantics when creating > the PeerConnection. > > Bug: webrtc:7600 > Change-Id: I0b8ee24b489b45bb4c5f60b699bd20c61af01d8e > Reviewed-on: https://webrtc-review.googlesource.com/23880 > Commit-Queue: Steve Anton <steveanton@webrtc.org> > Reviewed-by: Peter Thatcher <pthatcher@webrtc.org> > Reviewed-by: Henrik Boström <hbos@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20896} TBR=steveanton@webrtc.org,zhihuang@webrtc.org,hbos@webrtc.org,pthatcher@webrtc.org Change-Id: Ie91ea4988dba25c20e2532114d3a9d859a932d4c No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:7600 Reviewed-on: https://webrtc-review.googlesource.com/26400 Reviewed-by: Steve Anton <steveanton@webrtc.org> Commit-Queue: Steve Anton <steveanton@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20897}
2017-11-27 20:55:38 +00:00
namespace {
Reland "Added PeerConnectionObserver::OnRemoveTrack." This reverts commit 6c0c55c31817ecfa32409424495eb68b31828c40. Reason for revert: Fixed the flake. Original change's description: > Revert "Added PeerConnectionObserver::OnRemoveTrack." > > This reverts commit ba97ba7af917d4152f5f3363aba1c1561c6673dc. > > Reason for revert: The new tests have caused several test failures on the test bots; the method FakeAudioMediaStreamTrack:GetSignalLevel, which is not supposed to be called is sometimes called anyway. > > Original change's description: > > Added PeerConnectionObserver::OnRemoveTrack. > > > > This corresponds to processing the removal of a remote track step of > > the spec, with processing the addition of a remote track already > > covered by OnAddTrack. > > https://w3c.github.io/webrtc-pc/#processing-remote-mediastreamtracks > > > > Bug: webrtc:8260, webrtc:8315 > > Change-Id: Ica8be92369733eb3cf1397fb60385d45a9b58700 > > Reviewed-on: https://webrtc-review.googlesource.com/4722 > > Commit-Queue: Henrik Boström <hbos@webrtc.org> > > Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> > > Reviewed-by: Steve Anton <steveanton@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#20214} > > TBR=steveanton@webrtc.org,deadbeef@webrtc.org,hbos@webrtc.org > > Change-Id: Id2d9533e27227254769b4280a8ff10a47313e714 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:8260, webrtc:8315 > Reviewed-on: https://webrtc-review.googlesource.com/7940 > Reviewed-by: Alex Loiko <aleloi@webrtc.org> > Commit-Queue: Alex Loiko <aleloi@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20218} TBR=steveanton@webrtc.org,deadbeef@webrtc.org,aleloi@webrtc.org,hbos@webrtc.org Change-Id: Iab7500bebf98535754b102874259de43831fff6b No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:8260, webrtc:8315 Reviewed-on: https://webrtc-review.googlesource.com/8180 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20227}
2017-10-10 10:05:16 -07:00
Reland "SetRemoteDescriptionObserverInterface added." Description for changes from the original CL: Calling legacy SRD, implemented using SetRemoteDescriptionObserverAdapter wrapping the old observer, was meant to have the exact same behavior as the legacy SRD implementation which invokes the callbacks in a Post. However, in the CL that landed and got reverted (PS1), the Adapter had its own message handler, and callbacks would be invoked even if the PC was destroyed. In PS2 I've changed the Adapter to use the PeerConnection's message handler. If the PC is destroyed, the callback will not be invoked. This gives identical behavior to before this CL, and the legacy behavior is covered by a new unittest. I changed the adapter to be an implementation detail of peerconnection.cc, therefor some stuff was moved, and the only tests covering this is now in peerconnection_rtp_unittest.cc. This is a reland of 6c7ec32bd63ab2b45d4d83ae1de817ee946b4d72 Original change's description: > SetRemoteDescriptionObserverInterface added. > > The new observer replaced SetSessionDescriptionObserver for > SetRemoteDescription. Unlike SetSessionDescriptionObserver, > SetRemoteDescriptionObserverInterface is invoked synchronously so > that the you can rely on the state of the PeerConnection to represent > the result of the SetRemoteDescription call in the callback. > > The new observer succeeds or fails with an RTCError. > > This deprecates the need for PeerConnectionObserver::OnAdd/RemoveTrack > and SetSessionDescriptionObserver, with the benefit that all media > object changes can be processed in a single callback by the application > in a synchronous callback. This will help Chromium keep objects in-sync > across layers and threads in a non-racy and straight-forward way, see > design doc (Proposal 2): > https://docs.google.com/a/google.com/document/d/1-cDDC82mgU5zrHacfFz720p3xwRtuBkOPSRchh07Ho0/edit?usp=sharing > > An adapter for SetSessionDescriptionObserver is added to allow calling > the old SetRemoteDescription signature and get the old behavior > (OnSuccess/OnFailure callback in a Post) until third parties switch. > > Bug: webrtc:8473 > Change-Id: I3d4eb60da6dd34615f2c9f384aeaf4634e648c99 > Reviewed-on: https://webrtc-review.googlesource.com/17523 > Commit-Queue: Henrik Boström <hbos@webrtc.org> > Reviewed-by: Peter Thatcher <pthatcher@webrtc.org> > Reviewed-by: Guido Urdaneta <guidou@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20841} TBR=pthatcher@webrtc.org Bug: webrtc:8473 Change-Id: If2b1a1929663b0e77fcc9c2ebeef043e6f73adf5 Reviewed-on: https://webrtc-review.googlesource.com/25640 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Guido Urdaneta <guidou@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20854}
2017-11-23 17:48:32 +01:00
const uint32_t kDefaultTimeout = 10000u;
template <typename MethodFunctor>
class OnSuccessObserver : public rtc::RefCountedObject<
webrtc::SetRemoteDescriptionObserverInterface> {
public:
explicit OnSuccessObserver(MethodFunctor on_success)
: on_success_(std::move(on_success)) {}
// webrtc::SetRemoteDescriptionObserverInterface implementation.
void OnSetRemoteDescriptionComplete(webrtc::RTCError error) override {
RTC_CHECK(error.ok());
on_success_();
}
private:
MethodFunctor on_success_;
};
Reland "Added PeerConnectionObserver::OnRemoveTrack." This reverts commit 6c0c55c31817ecfa32409424495eb68b31828c40. Reason for revert: Fixed the flake. Original change's description: > Revert "Added PeerConnectionObserver::OnRemoveTrack." > > This reverts commit ba97ba7af917d4152f5f3363aba1c1561c6673dc. > > Reason for revert: The new tests have caused several test failures on the test bots; the method FakeAudioMediaStreamTrack:GetSignalLevel, which is not supposed to be called is sometimes called anyway. > > Original change's description: > > Added PeerConnectionObserver::OnRemoveTrack. > > > > This corresponds to processing the removal of a remote track step of > > the spec, with processing the addition of a remote track already > > covered by OnAddTrack. > > https://w3c.github.io/webrtc-pc/#processing-remote-mediastreamtracks > > > > Bug: webrtc:8260, webrtc:8315 > > Change-Id: Ica8be92369733eb3cf1397fb60385d45a9b58700 > > Reviewed-on: https://webrtc-review.googlesource.com/4722 > > Commit-Queue: Henrik Boström <hbos@webrtc.org> > > Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> > > Reviewed-by: Steve Anton <steveanton@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#20214} > > TBR=steveanton@webrtc.org,deadbeef@webrtc.org,hbos@webrtc.org > > Change-Id: Id2d9533e27227254769b4280a8ff10a47313e714 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:8260, webrtc:8315 > Reviewed-on: https://webrtc-review.googlesource.com/7940 > Reviewed-by: Alex Loiko <aleloi@webrtc.org> > Commit-Queue: Alex Loiko <aleloi@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20218} TBR=steveanton@webrtc.org,deadbeef@webrtc.org,aleloi@webrtc.org,hbos@webrtc.org Change-Id: Iab7500bebf98535754b102874259de43831fff6b No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:8260, webrtc:8315 Reviewed-on: https://webrtc-review.googlesource.com/8180 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20227}
2017-10-10 10:05:16 -07:00
class PeerConnectionRtpTest : public testing::Test {
public:
PeerConnectionRtpTest()
Revert "Add AddTransceiver and GetTransceivers to PeerConnection" This reverts commit f93d2800d9b0d5818a5a383def0aaef3d441df3a. Reason for revert: https://logs.chromium.org/v/?s=chromium%2Fbb%2Fchromium.webrtc.fyi%2Fios-device%2F5804%2F%2B%2Frecipes%2Fsteps%2Fcompile%2F0%2Fstdout Original change's description: > Add AddTransceiver and GetTransceivers to PeerConnection > > WebRTC 1.0 has added the transceiver API to PeerConnection. This > is the first step towards exposing this to WebRTC consumers. For > now, transceivers can be added and fetched but there is not yet > support for creating offers/answers or setting local/remote > descriptions. That support ("Unified Plan") will be added in > follow-up CLs. > > The transceiver API is currently only available if the application > opts in by specifying the kUnifiedPlan SDP semantics when creating > the PeerConnection. > > Bug: webrtc:7600 > Change-Id: I0b8ee24b489b45bb4c5f60b699bd20c61af01d8e > Reviewed-on: https://webrtc-review.googlesource.com/23880 > Commit-Queue: Steve Anton <steveanton@webrtc.org> > Reviewed-by: Peter Thatcher <pthatcher@webrtc.org> > Reviewed-by: Henrik Boström <hbos@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20896} TBR=steveanton@webrtc.org,zhihuang@webrtc.org,hbos@webrtc.org,pthatcher@webrtc.org Change-Id: Ie91ea4988dba25c20e2532114d3a9d859a932d4c No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:7600 Reviewed-on: https://webrtc-review.googlesource.com/26400 Reviewed-by: Steve Anton <steveanton@webrtc.org> Commit-Queue: Steve Anton <steveanton@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20897}
2017-11-27 20:55:38 +00:00
: pc_factory_(webrtc::CreatePeerConnectionFactory(
rtc::Thread::Current(),
rtc::Thread::Current(),
rtc::Thread::Current(),
FakeAudioCaptureModule::Create(),
webrtc::CreateBuiltinAudioEncoderFactory(),
webrtc::CreateBuiltinAudioDecoderFactory(),
nullptr,
nullptr)) {}
std::unique_ptr<webrtc::PeerConnectionWrapper> CreatePeerConnection() {
webrtc::PeerConnectionInterface::RTCConfiguration config;
auto observer = rtc::MakeUnique<webrtc::MockPeerConnectionObserver>();
Reland "Added PeerConnectionObserver::OnRemoveTrack." This reverts commit 6c0c55c31817ecfa32409424495eb68b31828c40. Reason for revert: Fixed the flake. Original change's description: > Revert "Added PeerConnectionObserver::OnRemoveTrack." > > This reverts commit ba97ba7af917d4152f5f3363aba1c1561c6673dc. > > Reason for revert: The new tests have caused several test failures on the test bots; the method FakeAudioMediaStreamTrack:GetSignalLevel, which is not supposed to be called is sometimes called anyway. > > Original change's description: > > Added PeerConnectionObserver::OnRemoveTrack. > > > > This corresponds to processing the removal of a remote track step of > > the spec, with processing the addition of a remote track already > > covered by OnAddTrack. > > https://w3c.github.io/webrtc-pc/#processing-remote-mediastreamtracks > > > > Bug: webrtc:8260, webrtc:8315 > > Change-Id: Ica8be92369733eb3cf1397fb60385d45a9b58700 > > Reviewed-on: https://webrtc-review.googlesource.com/4722 > > Commit-Queue: Henrik Boström <hbos@webrtc.org> > > Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> > > Reviewed-by: Steve Anton <steveanton@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#20214} > > TBR=steveanton@webrtc.org,deadbeef@webrtc.org,hbos@webrtc.org > > Change-Id: Id2d9533e27227254769b4280a8ff10a47313e714 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:8260, webrtc:8315 > Reviewed-on: https://webrtc-review.googlesource.com/7940 > Reviewed-by: Alex Loiko <aleloi@webrtc.org> > Commit-Queue: Alex Loiko <aleloi@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20218} TBR=steveanton@webrtc.org,deadbeef@webrtc.org,aleloi@webrtc.org,hbos@webrtc.org Change-Id: Iab7500bebf98535754b102874259de43831fff6b No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:8260, webrtc:8315 Reviewed-on: https://webrtc-review.googlesource.com/8180 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20227}
2017-10-10 10:05:16 -07:00
auto pc = pc_factory_->CreatePeerConnection(config, nullptr, nullptr,
observer.get());
Revert "Add AddTransceiver and GetTransceivers to PeerConnection" This reverts commit f93d2800d9b0d5818a5a383def0aaef3d441df3a. Reason for revert: https://logs.chromium.org/v/?s=chromium%2Fbb%2Fchromium.webrtc.fyi%2Fios-device%2F5804%2F%2B%2Frecipes%2Fsteps%2Fcompile%2F0%2Fstdout Original change's description: > Add AddTransceiver and GetTransceivers to PeerConnection > > WebRTC 1.0 has added the transceiver API to PeerConnection. This > is the first step towards exposing this to WebRTC consumers. For > now, transceivers can be added and fetched but there is not yet > support for creating offers/answers or setting local/remote > descriptions. That support ("Unified Plan") will be added in > follow-up CLs. > > The transceiver API is currently only available if the application > opts in by specifying the kUnifiedPlan SDP semantics when creating > the PeerConnection. > > Bug: webrtc:7600 > Change-Id: I0b8ee24b489b45bb4c5f60b699bd20c61af01d8e > Reviewed-on: https://webrtc-review.googlesource.com/23880 > Commit-Queue: Steve Anton <steveanton@webrtc.org> > Reviewed-by: Peter Thatcher <pthatcher@webrtc.org> > Reviewed-by: Henrik Boström <hbos@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20896} TBR=steveanton@webrtc.org,zhihuang@webrtc.org,hbos@webrtc.org,pthatcher@webrtc.org Change-Id: Ie91ea4988dba25c20e2532114d3a9d859a932d4c No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:7600 Reviewed-on: https://webrtc-review.googlesource.com/26400 Reviewed-by: Steve Anton <steveanton@webrtc.org> Commit-Queue: Steve Anton <steveanton@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20897}
2017-11-27 20:55:38 +00:00
return std::unique_ptr<webrtc::PeerConnectionWrapper>(
new webrtc::PeerConnectionWrapper(pc_factory_, pc,
std::move(observer)));
Reland "Added PeerConnectionObserver::OnRemoveTrack." This reverts commit 6c0c55c31817ecfa32409424495eb68b31828c40. Reason for revert: Fixed the flake. Original change's description: > Revert "Added PeerConnectionObserver::OnRemoveTrack." > > This reverts commit ba97ba7af917d4152f5f3363aba1c1561c6673dc. > > Reason for revert: The new tests have caused several test failures on the test bots; the method FakeAudioMediaStreamTrack:GetSignalLevel, which is not supposed to be called is sometimes called anyway. > > Original change's description: > > Added PeerConnectionObserver::OnRemoveTrack. > > > > This corresponds to processing the removal of a remote track step of > > the spec, with processing the addition of a remote track already > > covered by OnAddTrack. > > https://w3c.github.io/webrtc-pc/#processing-remote-mediastreamtracks > > > > Bug: webrtc:8260, webrtc:8315 > > Change-Id: Ica8be92369733eb3cf1397fb60385d45a9b58700 > > Reviewed-on: https://webrtc-review.googlesource.com/4722 > > Commit-Queue: Henrik Boström <hbos@webrtc.org> > > Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> > > Reviewed-by: Steve Anton <steveanton@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#20214} > > TBR=steveanton@webrtc.org,deadbeef@webrtc.org,hbos@webrtc.org > > Change-Id: Id2d9533e27227254769b4280a8ff10a47313e714 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:8260, webrtc:8315 > Reviewed-on: https://webrtc-review.googlesource.com/7940 > Reviewed-by: Alex Loiko <aleloi@webrtc.org> > Commit-Queue: Alex Loiko <aleloi@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20218} TBR=steveanton@webrtc.org,deadbeef@webrtc.org,aleloi@webrtc.org,hbos@webrtc.org Change-Id: Iab7500bebf98535754b102874259de43831fff6b No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:8260, webrtc:8315 Reviewed-on: https://webrtc-review.googlesource.com/8180 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20227}
2017-10-10 10:05:16 -07:00
}
protected:
Revert "Add AddTransceiver and GetTransceivers to PeerConnection" This reverts commit f93d2800d9b0d5818a5a383def0aaef3d441df3a. Reason for revert: https://logs.chromium.org/v/?s=chromium%2Fbb%2Fchromium.webrtc.fyi%2Fios-device%2F5804%2F%2B%2Frecipes%2Fsteps%2Fcompile%2F0%2Fstdout Original change's description: > Add AddTransceiver and GetTransceivers to PeerConnection > > WebRTC 1.0 has added the transceiver API to PeerConnection. This > is the first step towards exposing this to WebRTC consumers. For > now, transceivers can be added and fetched but there is not yet > support for creating offers/answers or setting local/remote > descriptions. That support ("Unified Plan") will be added in > follow-up CLs. > > The transceiver API is currently only available if the application > opts in by specifying the kUnifiedPlan SDP semantics when creating > the PeerConnection. > > Bug: webrtc:7600 > Change-Id: I0b8ee24b489b45bb4c5f60b699bd20c61af01d8e > Reviewed-on: https://webrtc-review.googlesource.com/23880 > Commit-Queue: Steve Anton <steveanton@webrtc.org> > Reviewed-by: Peter Thatcher <pthatcher@webrtc.org> > Reviewed-by: Henrik Boström <hbos@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20896} TBR=steveanton@webrtc.org,zhihuang@webrtc.org,hbos@webrtc.org,pthatcher@webrtc.org Change-Id: Ie91ea4988dba25c20e2532114d3a9d859a932d4c No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:7600 Reviewed-on: https://webrtc-review.googlesource.com/26400 Reviewed-by: Steve Anton <steveanton@webrtc.org> Commit-Queue: Steve Anton <steveanton@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20897}
2017-11-27 20:55:38 +00:00
rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface> pc_factory_;
Reland "Added PeerConnectionObserver::OnRemoveTrack." This reverts commit 6c0c55c31817ecfa32409424495eb68b31828c40. Reason for revert: Fixed the flake. Original change's description: > Revert "Added PeerConnectionObserver::OnRemoveTrack." > > This reverts commit ba97ba7af917d4152f5f3363aba1c1561c6673dc. > > Reason for revert: The new tests have caused several test failures on the test bots; the method FakeAudioMediaStreamTrack:GetSignalLevel, which is not supposed to be called is sometimes called anyway. > > Original change's description: > > Added PeerConnectionObserver::OnRemoveTrack. > > > > This corresponds to processing the removal of a remote track step of > > the spec, with processing the addition of a remote track already > > covered by OnAddTrack. > > https://w3c.github.io/webrtc-pc/#processing-remote-mediastreamtracks > > > > Bug: webrtc:8260, webrtc:8315 > > Change-Id: Ica8be92369733eb3cf1397fb60385d45a9b58700 > > Reviewed-on: https://webrtc-review.googlesource.com/4722 > > Commit-Queue: Henrik Boström <hbos@webrtc.org> > > Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> > > Reviewed-by: Steve Anton <steveanton@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#20214} > > TBR=steveanton@webrtc.org,deadbeef@webrtc.org,hbos@webrtc.org > > Change-Id: Id2d9533e27227254769b4280a8ff10a47313e714 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:8260, webrtc:8315 > Reviewed-on: https://webrtc-review.googlesource.com/7940 > Reviewed-by: Alex Loiko <aleloi@webrtc.org> > Commit-Queue: Alex Loiko <aleloi@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20218} TBR=steveanton@webrtc.org,deadbeef@webrtc.org,aleloi@webrtc.org,hbos@webrtc.org Change-Id: Iab7500bebf98535754b102874259de43831fff6b No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:8260, webrtc:8315 Reviewed-on: https://webrtc-review.googlesource.com/8180 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20227}
2017-10-10 10:05:16 -07:00
};
Reland "SetRemoteDescriptionObserverInterface added." Description for changes from the original CL: Calling legacy SRD, implemented using SetRemoteDescriptionObserverAdapter wrapping the old observer, was meant to have the exact same behavior as the legacy SRD implementation which invokes the callbacks in a Post. However, in the CL that landed and got reverted (PS1), the Adapter had its own message handler, and callbacks would be invoked even if the PC was destroyed. In PS2 I've changed the Adapter to use the PeerConnection's message handler. If the PC is destroyed, the callback will not be invoked. This gives identical behavior to before this CL, and the legacy behavior is covered by a new unittest. I changed the adapter to be an implementation detail of peerconnection.cc, therefor some stuff was moved, and the only tests covering this is now in peerconnection_rtp_unittest.cc. This is a reland of 6c7ec32bd63ab2b45d4d83ae1de817ee946b4d72 Original change's description: > SetRemoteDescriptionObserverInterface added. > > The new observer replaced SetSessionDescriptionObserver for > SetRemoteDescription. Unlike SetSessionDescriptionObserver, > SetRemoteDescriptionObserverInterface is invoked synchronously so > that the you can rely on the state of the PeerConnection to represent > the result of the SetRemoteDescription call in the callback. > > The new observer succeeds or fails with an RTCError. > > This deprecates the need for PeerConnectionObserver::OnAdd/RemoveTrack > and SetSessionDescriptionObserver, with the benefit that all media > object changes can be processed in a single callback by the application > in a synchronous callback. This will help Chromium keep objects in-sync > across layers and threads in a non-racy and straight-forward way, see > design doc (Proposal 2): > https://docs.google.com/a/google.com/document/d/1-cDDC82mgU5zrHacfFz720p3xwRtuBkOPSRchh07Ho0/edit?usp=sharing > > An adapter for SetSessionDescriptionObserver is added to allow calling > the old SetRemoteDescription signature and get the old behavior > (OnSuccess/OnFailure callback in a Post) until third parties switch. > > Bug: webrtc:8473 > Change-Id: I3d4eb60da6dd34615f2c9f384aeaf4634e648c99 > Reviewed-on: https://webrtc-review.googlesource.com/17523 > Commit-Queue: Henrik Boström <hbos@webrtc.org> > Reviewed-by: Peter Thatcher <pthatcher@webrtc.org> > Reviewed-by: Guido Urdaneta <guidou@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20841} TBR=pthatcher@webrtc.org Bug: webrtc:8473 Change-Id: If2b1a1929663b0e77fcc9c2ebeef043e6f73adf5 Reviewed-on: https://webrtc-review.googlesource.com/25640 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Guido Urdaneta <guidou@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20854}
2017-11-23 17:48:32 +01:00
// These tests cover |webrtc::PeerConnectionObserver| callbacks firing upon
// setting the remote description.
class PeerConnectionRtpCallbacksTest : public PeerConnectionRtpTest {};
TEST_F(PeerConnectionRtpCallbacksTest, AddTrackWithoutStreamFiresOnAddTrack) {
Reland "Added PeerConnectionObserver::OnRemoveTrack." This reverts commit 6c0c55c31817ecfa32409424495eb68b31828c40. Reason for revert: Fixed the flake. Original change's description: > Revert "Added PeerConnectionObserver::OnRemoveTrack." > > This reverts commit ba97ba7af917d4152f5f3363aba1c1561c6673dc. > > Reason for revert: The new tests have caused several test failures on the test bots; the method FakeAudioMediaStreamTrack:GetSignalLevel, which is not supposed to be called is sometimes called anyway. > > Original change's description: > > Added PeerConnectionObserver::OnRemoveTrack. > > > > This corresponds to processing the removal of a remote track step of > > the spec, with processing the addition of a remote track already > > covered by OnAddTrack. > > https://w3c.github.io/webrtc-pc/#processing-remote-mediastreamtracks > > > > Bug: webrtc:8260, webrtc:8315 > > Change-Id: Ica8be92369733eb3cf1397fb60385d45a9b58700 > > Reviewed-on: https://webrtc-review.googlesource.com/4722 > > Commit-Queue: Henrik Boström <hbos@webrtc.org> > > Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> > > Reviewed-by: Steve Anton <steveanton@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#20214} > > TBR=steveanton@webrtc.org,deadbeef@webrtc.org,hbos@webrtc.org > > Change-Id: Id2d9533e27227254769b4280a8ff10a47313e714 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:8260, webrtc:8315 > Reviewed-on: https://webrtc-review.googlesource.com/7940 > Reviewed-by: Alex Loiko <aleloi@webrtc.org> > Commit-Queue: Alex Loiko <aleloi@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20218} TBR=steveanton@webrtc.org,deadbeef@webrtc.org,aleloi@webrtc.org,hbos@webrtc.org Change-Id: Iab7500bebf98535754b102874259de43831fff6b No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:8260, webrtc:8315 Reviewed-on: https://webrtc-review.googlesource.com/8180 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20227}
2017-10-10 10:05:16 -07:00
auto caller = CreatePeerConnection();
auto callee = CreatePeerConnection();
Revert "Add AddTransceiver and GetTransceivers to PeerConnection" This reverts commit f93d2800d9b0d5818a5a383def0aaef3d441df3a. Reason for revert: https://logs.chromium.org/v/?s=chromium%2Fbb%2Fchromium.webrtc.fyi%2Fios-device%2F5804%2F%2B%2Frecipes%2Fsteps%2Fcompile%2F0%2Fstdout Original change's description: > Add AddTransceiver and GetTransceivers to PeerConnection > > WebRTC 1.0 has added the transceiver API to PeerConnection. This > is the first step towards exposing this to WebRTC consumers. For > now, transceivers can be added and fetched but there is not yet > support for creating offers/answers or setting local/remote > descriptions. That support ("Unified Plan") will be added in > follow-up CLs. > > The transceiver API is currently only available if the application > opts in by specifying the kUnifiedPlan SDP semantics when creating > the PeerConnection. > > Bug: webrtc:7600 > Change-Id: I0b8ee24b489b45bb4c5f60b699bd20c61af01d8e > Reviewed-on: https://webrtc-review.googlesource.com/23880 > Commit-Queue: Steve Anton <steveanton@webrtc.org> > Reviewed-by: Peter Thatcher <pthatcher@webrtc.org> > Reviewed-by: Henrik Boström <hbos@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20896} TBR=steveanton@webrtc.org,zhihuang@webrtc.org,hbos@webrtc.org,pthatcher@webrtc.org Change-Id: Ie91ea4988dba25c20e2532114d3a9d859a932d4c No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:7600 Reviewed-on: https://webrtc-review.googlesource.com/26400 Reviewed-by: Steve Anton <steveanton@webrtc.org> Commit-Queue: Steve Anton <steveanton@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20897}
2017-11-27 20:55:38 +00:00
rtc::scoped_refptr<webrtc::AudioTrackInterface> audio_track(
Reland "Added PeerConnectionObserver::OnRemoveTrack." This reverts commit 6c0c55c31817ecfa32409424495eb68b31828c40. Reason for revert: Fixed the flake. Original change's description: > Revert "Added PeerConnectionObserver::OnRemoveTrack." > > This reverts commit ba97ba7af917d4152f5f3363aba1c1561c6673dc. > > Reason for revert: The new tests have caused several test failures on the test bots; the method FakeAudioMediaStreamTrack:GetSignalLevel, which is not supposed to be called is sometimes called anyway. > > Original change's description: > > Added PeerConnectionObserver::OnRemoveTrack. > > > > This corresponds to processing the removal of a remote track step of > > the spec, with processing the addition of a remote track already > > covered by OnAddTrack. > > https://w3c.github.io/webrtc-pc/#processing-remote-mediastreamtracks > > > > Bug: webrtc:8260, webrtc:8315 > > Change-Id: Ica8be92369733eb3cf1397fb60385d45a9b58700 > > Reviewed-on: https://webrtc-review.googlesource.com/4722 > > Commit-Queue: Henrik Boström <hbos@webrtc.org> > > Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> > > Reviewed-by: Steve Anton <steveanton@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#20214} > > TBR=steveanton@webrtc.org,deadbeef@webrtc.org,hbos@webrtc.org > > Change-Id: Id2d9533e27227254769b4280a8ff10a47313e714 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:8260, webrtc:8315 > Reviewed-on: https://webrtc-review.googlesource.com/7940 > Reviewed-by: Alex Loiko <aleloi@webrtc.org> > Commit-Queue: Alex Loiko <aleloi@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20218} TBR=steveanton@webrtc.org,deadbeef@webrtc.org,aleloi@webrtc.org,hbos@webrtc.org Change-Id: Iab7500bebf98535754b102874259de43831fff6b No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:8260, webrtc:8315 Reviewed-on: https://webrtc-review.googlesource.com/8180 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20227}
2017-10-10 10:05:16 -07:00
pc_factory_->CreateAudioTrack("audio_track", nullptr));
EXPECT_TRUE(caller->pc()->AddTrack(audio_track.get(), {}));
Reland "SetRemoteDescriptionObserverInterface added." Description for changes from the original CL: Calling legacy SRD, implemented using SetRemoteDescriptionObserverAdapter wrapping the old observer, was meant to have the exact same behavior as the legacy SRD implementation which invokes the callbacks in a Post. However, in the CL that landed and got reverted (PS1), the Adapter had its own message handler, and callbacks would be invoked even if the PC was destroyed. In PS2 I've changed the Adapter to use the PeerConnection's message handler. If the PC is destroyed, the callback will not be invoked. This gives identical behavior to before this CL, and the legacy behavior is covered by a new unittest. I changed the adapter to be an implementation detail of peerconnection.cc, therefor some stuff was moved, and the only tests covering this is now in peerconnection_rtp_unittest.cc. This is a reland of 6c7ec32bd63ab2b45d4d83ae1de817ee946b4d72 Original change's description: > SetRemoteDescriptionObserverInterface added. > > The new observer replaced SetSessionDescriptionObserver for > SetRemoteDescription. Unlike SetSessionDescriptionObserver, > SetRemoteDescriptionObserverInterface is invoked synchronously so > that the you can rely on the state of the PeerConnection to represent > the result of the SetRemoteDescription call in the callback. > > The new observer succeeds or fails with an RTCError. > > This deprecates the need for PeerConnectionObserver::OnAdd/RemoveTrack > and SetSessionDescriptionObserver, with the benefit that all media > object changes can be processed in a single callback by the application > in a synchronous callback. This will help Chromium keep objects in-sync > across layers and threads in a non-racy and straight-forward way, see > design doc (Proposal 2): > https://docs.google.com/a/google.com/document/d/1-cDDC82mgU5zrHacfFz720p3xwRtuBkOPSRchh07Ho0/edit?usp=sharing > > An adapter for SetSessionDescriptionObserver is added to allow calling > the old SetRemoteDescription signature and get the old behavior > (OnSuccess/OnFailure callback in a Post) until third parties switch. > > Bug: webrtc:8473 > Change-Id: I3d4eb60da6dd34615f2c9f384aeaf4634e648c99 > Reviewed-on: https://webrtc-review.googlesource.com/17523 > Commit-Queue: Henrik Boström <hbos@webrtc.org> > Reviewed-by: Peter Thatcher <pthatcher@webrtc.org> > Reviewed-by: Guido Urdaneta <guidou@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20841} TBR=pthatcher@webrtc.org Bug: webrtc:8473 Change-Id: If2b1a1929663b0e77fcc9c2ebeef043e6f73adf5 Reviewed-on: https://webrtc-review.googlesource.com/25640 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Guido Urdaneta <guidou@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20854}
2017-11-23 17:48:32 +01:00
ASSERT_TRUE(
callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal(),
static_cast<webrtc::RTCError*>(nullptr)));
Reland "Added PeerConnectionObserver::OnRemoveTrack." This reverts commit 6c0c55c31817ecfa32409424495eb68b31828c40. Reason for revert: Fixed the flake. Original change's description: > Revert "Added PeerConnectionObserver::OnRemoveTrack." > > This reverts commit ba97ba7af917d4152f5f3363aba1c1561c6673dc. > > Reason for revert: The new tests have caused several test failures on the test bots; the method FakeAudioMediaStreamTrack:GetSignalLevel, which is not supposed to be called is sometimes called anyway. > > Original change's description: > > Added PeerConnectionObserver::OnRemoveTrack. > > > > This corresponds to processing the removal of a remote track step of > > the spec, with processing the addition of a remote track already > > covered by OnAddTrack. > > https://w3c.github.io/webrtc-pc/#processing-remote-mediastreamtracks > > > > Bug: webrtc:8260, webrtc:8315 > > Change-Id: Ica8be92369733eb3cf1397fb60385d45a9b58700 > > Reviewed-on: https://webrtc-review.googlesource.com/4722 > > Commit-Queue: Henrik Boström <hbos@webrtc.org> > > Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> > > Reviewed-by: Steve Anton <steveanton@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#20214} > > TBR=steveanton@webrtc.org,deadbeef@webrtc.org,hbos@webrtc.org > > Change-Id: Id2d9533e27227254769b4280a8ff10a47313e714 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:8260, webrtc:8315 > Reviewed-on: https://webrtc-review.googlesource.com/7940 > Reviewed-by: Alex Loiko <aleloi@webrtc.org> > Commit-Queue: Alex Loiko <aleloi@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20218} TBR=steveanton@webrtc.org,deadbeef@webrtc.org,aleloi@webrtc.org,hbos@webrtc.org Change-Id: Iab7500bebf98535754b102874259de43831fff6b No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:8260, webrtc:8315 Reviewed-on: https://webrtc-review.googlesource.com/8180 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20227}
2017-10-10 10:05:16 -07:00
Reland "SetRemoteDescriptionObserverInterface added." Description for changes from the original CL: Calling legacy SRD, implemented using SetRemoteDescriptionObserverAdapter wrapping the old observer, was meant to have the exact same behavior as the legacy SRD implementation which invokes the callbacks in a Post. However, in the CL that landed and got reverted (PS1), the Adapter had its own message handler, and callbacks would be invoked even if the PC was destroyed. In PS2 I've changed the Adapter to use the PeerConnection's message handler. If the PC is destroyed, the callback will not be invoked. This gives identical behavior to before this CL, and the legacy behavior is covered by a new unittest. I changed the adapter to be an implementation detail of peerconnection.cc, therefor some stuff was moved, and the only tests covering this is now in peerconnection_rtp_unittest.cc. This is a reland of 6c7ec32bd63ab2b45d4d83ae1de817ee946b4d72 Original change's description: > SetRemoteDescriptionObserverInterface added. > > The new observer replaced SetSessionDescriptionObserver for > SetRemoteDescription. Unlike SetSessionDescriptionObserver, > SetRemoteDescriptionObserverInterface is invoked synchronously so > that the you can rely on the state of the PeerConnection to represent > the result of the SetRemoteDescription call in the callback. > > The new observer succeeds or fails with an RTCError. > > This deprecates the need for PeerConnectionObserver::OnAdd/RemoveTrack > and SetSessionDescriptionObserver, with the benefit that all media > object changes can be processed in a single callback by the application > in a synchronous callback. This will help Chromium keep objects in-sync > across layers and threads in a non-racy and straight-forward way, see > design doc (Proposal 2): > https://docs.google.com/a/google.com/document/d/1-cDDC82mgU5zrHacfFz720p3xwRtuBkOPSRchh07Ho0/edit?usp=sharing > > An adapter for SetSessionDescriptionObserver is added to allow calling > the old SetRemoteDescription signature and get the old behavior > (OnSuccess/OnFailure callback in a Post) until third parties switch. > > Bug: webrtc:8473 > Change-Id: I3d4eb60da6dd34615f2c9f384aeaf4634e648c99 > Reviewed-on: https://webrtc-review.googlesource.com/17523 > Commit-Queue: Henrik Boström <hbos@webrtc.org> > Reviewed-by: Peter Thatcher <pthatcher@webrtc.org> > Reviewed-by: Guido Urdaneta <guidou@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20841} TBR=pthatcher@webrtc.org Bug: webrtc:8473 Change-Id: If2b1a1929663b0e77fcc9c2ebeef043e6f73adf5 Reviewed-on: https://webrtc-review.googlesource.com/25640 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Guido Urdaneta <guidou@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20854}
2017-11-23 17:48:32 +01:00
ASSERT_EQ(callee->observer()->add_track_events_.size(), 1u);
// TODO(hbos): When "no stream" is handled correctly we would expect
Reland "Added PeerConnectionObserver::OnRemoveTrack." This reverts commit 6c0c55c31817ecfa32409424495eb68b31828c40. Reason for revert: Fixed the flake. Original change's description: > Revert "Added PeerConnectionObserver::OnRemoveTrack." > > This reverts commit ba97ba7af917d4152f5f3363aba1c1561c6673dc. > > Reason for revert: The new tests have caused several test failures on the test bots; the method FakeAudioMediaStreamTrack:GetSignalLevel, which is not supposed to be called is sometimes called anyway. > > Original change's description: > > Added PeerConnectionObserver::OnRemoveTrack. > > > > This corresponds to processing the removal of a remote track step of > > the spec, with processing the addition of a remote track already > > covered by OnAddTrack. > > https://w3c.github.io/webrtc-pc/#processing-remote-mediastreamtracks > > > > Bug: webrtc:8260, webrtc:8315 > > Change-Id: Ica8be92369733eb3cf1397fb60385d45a9b58700 > > Reviewed-on: https://webrtc-review.googlesource.com/4722 > > Commit-Queue: Henrik Boström <hbos@webrtc.org> > > Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> > > Reviewed-by: Steve Anton <steveanton@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#20214} > > TBR=steveanton@webrtc.org,deadbeef@webrtc.org,hbos@webrtc.org > > Change-Id: Id2d9533e27227254769b4280a8ff10a47313e714 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:8260, webrtc:8315 > Reviewed-on: https://webrtc-review.googlesource.com/7940 > Reviewed-by: Alex Loiko <aleloi@webrtc.org> > Commit-Queue: Alex Loiko <aleloi@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20218} TBR=steveanton@webrtc.org,deadbeef@webrtc.org,aleloi@webrtc.org,hbos@webrtc.org Change-Id: Iab7500bebf98535754b102874259de43831fff6b No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:8260, webrtc:8315 Reviewed-on: https://webrtc-review.googlesource.com/8180 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20227}
2017-10-10 10:05:16 -07:00
// |add_track_events_[0].streams| to be empty. https://crbug.com/webrtc/7933
auto& add_track_event = callee->observer()->add_track_events_[0];
Reland "SetRemoteDescriptionObserverInterface added." Description for changes from the original CL: Calling legacy SRD, implemented using SetRemoteDescriptionObserverAdapter wrapping the old observer, was meant to have the exact same behavior as the legacy SRD implementation which invokes the callbacks in a Post. However, in the CL that landed and got reverted (PS1), the Adapter had its own message handler, and callbacks would be invoked even if the PC was destroyed. In PS2 I've changed the Adapter to use the PeerConnection's message handler. If the PC is destroyed, the callback will not be invoked. This gives identical behavior to before this CL, and the legacy behavior is covered by a new unittest. I changed the adapter to be an implementation detail of peerconnection.cc, therefor some stuff was moved, and the only tests covering this is now in peerconnection_rtp_unittest.cc. This is a reland of 6c7ec32bd63ab2b45d4d83ae1de817ee946b4d72 Original change's description: > SetRemoteDescriptionObserverInterface added. > > The new observer replaced SetSessionDescriptionObserver for > SetRemoteDescription. Unlike SetSessionDescriptionObserver, > SetRemoteDescriptionObserverInterface is invoked synchronously so > that the you can rely on the state of the PeerConnection to represent > the result of the SetRemoteDescription call in the callback. > > The new observer succeeds or fails with an RTCError. > > This deprecates the need for PeerConnectionObserver::OnAdd/RemoveTrack > and SetSessionDescriptionObserver, with the benefit that all media > object changes can be processed in a single callback by the application > in a synchronous callback. This will help Chromium keep objects in-sync > across layers and threads in a non-racy and straight-forward way, see > design doc (Proposal 2): > https://docs.google.com/a/google.com/document/d/1-cDDC82mgU5zrHacfFz720p3xwRtuBkOPSRchh07Ho0/edit?usp=sharing > > An adapter for SetSessionDescriptionObserver is added to allow calling > the old SetRemoteDescription signature and get the old behavior > (OnSuccess/OnFailure callback in a Post) until third parties switch. > > Bug: webrtc:8473 > Change-Id: I3d4eb60da6dd34615f2c9f384aeaf4634e648c99 > Reviewed-on: https://webrtc-review.googlesource.com/17523 > Commit-Queue: Henrik Boström <hbos@webrtc.org> > Reviewed-by: Peter Thatcher <pthatcher@webrtc.org> > Reviewed-by: Guido Urdaneta <guidou@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20841} TBR=pthatcher@webrtc.org Bug: webrtc:8473 Change-Id: If2b1a1929663b0e77fcc9c2ebeef043e6f73adf5 Reviewed-on: https://webrtc-review.googlesource.com/25640 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Guido Urdaneta <guidou@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20854}
2017-11-23 17:48:32 +01:00
ASSERT_EQ(add_track_event.streams.size(), 1u);
EXPECT_TRUE(add_track_event.streams[0]->FindAudioTrack("audio_track"));
EXPECT_EQ(add_track_event.streams, add_track_event.receiver->streams());
Reland "Added PeerConnectionObserver::OnRemoveTrack." This reverts commit 6c0c55c31817ecfa32409424495eb68b31828c40. Reason for revert: Fixed the flake. Original change's description: > Revert "Added PeerConnectionObserver::OnRemoveTrack." > > This reverts commit ba97ba7af917d4152f5f3363aba1c1561c6673dc. > > Reason for revert: The new tests have caused several test failures on the test bots; the method FakeAudioMediaStreamTrack:GetSignalLevel, which is not supposed to be called is sometimes called anyway. > > Original change's description: > > Added PeerConnectionObserver::OnRemoveTrack. > > > > This corresponds to processing the removal of a remote track step of > > the spec, with processing the addition of a remote track already > > covered by OnAddTrack. > > https://w3c.github.io/webrtc-pc/#processing-remote-mediastreamtracks > > > > Bug: webrtc:8260, webrtc:8315 > > Change-Id: Ica8be92369733eb3cf1397fb60385d45a9b58700 > > Reviewed-on: https://webrtc-review.googlesource.com/4722 > > Commit-Queue: Henrik Boström <hbos@webrtc.org> > > Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> > > Reviewed-by: Steve Anton <steveanton@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#20214} > > TBR=steveanton@webrtc.org,deadbeef@webrtc.org,hbos@webrtc.org > > Change-Id: Id2d9533e27227254769b4280a8ff10a47313e714 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:8260, webrtc:8315 > Reviewed-on: https://webrtc-review.googlesource.com/7940 > Reviewed-by: Alex Loiko <aleloi@webrtc.org> > Commit-Queue: Alex Loiko <aleloi@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20218} TBR=steveanton@webrtc.org,deadbeef@webrtc.org,aleloi@webrtc.org,hbos@webrtc.org Change-Id: Iab7500bebf98535754b102874259de43831fff6b No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:8260, webrtc:8315 Reviewed-on: https://webrtc-review.googlesource.com/8180 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20227}
2017-10-10 10:05:16 -07:00
}
Reland "SetRemoteDescriptionObserverInterface added." Description for changes from the original CL: Calling legacy SRD, implemented using SetRemoteDescriptionObserverAdapter wrapping the old observer, was meant to have the exact same behavior as the legacy SRD implementation which invokes the callbacks in a Post. However, in the CL that landed and got reverted (PS1), the Adapter had its own message handler, and callbacks would be invoked even if the PC was destroyed. In PS2 I've changed the Adapter to use the PeerConnection's message handler. If the PC is destroyed, the callback will not be invoked. This gives identical behavior to before this CL, and the legacy behavior is covered by a new unittest. I changed the adapter to be an implementation detail of peerconnection.cc, therefor some stuff was moved, and the only tests covering this is now in peerconnection_rtp_unittest.cc. This is a reland of 6c7ec32bd63ab2b45d4d83ae1de817ee946b4d72 Original change's description: > SetRemoteDescriptionObserverInterface added. > > The new observer replaced SetSessionDescriptionObserver for > SetRemoteDescription. Unlike SetSessionDescriptionObserver, > SetRemoteDescriptionObserverInterface is invoked synchronously so > that the you can rely on the state of the PeerConnection to represent > the result of the SetRemoteDescription call in the callback. > > The new observer succeeds or fails with an RTCError. > > This deprecates the need for PeerConnectionObserver::OnAdd/RemoveTrack > and SetSessionDescriptionObserver, with the benefit that all media > object changes can be processed in a single callback by the application > in a synchronous callback. This will help Chromium keep objects in-sync > across layers and threads in a non-racy and straight-forward way, see > design doc (Proposal 2): > https://docs.google.com/a/google.com/document/d/1-cDDC82mgU5zrHacfFz720p3xwRtuBkOPSRchh07Ho0/edit?usp=sharing > > An adapter for SetSessionDescriptionObserver is added to allow calling > the old SetRemoteDescription signature and get the old behavior > (OnSuccess/OnFailure callback in a Post) until third parties switch. > > Bug: webrtc:8473 > Change-Id: I3d4eb60da6dd34615f2c9f384aeaf4634e648c99 > Reviewed-on: https://webrtc-review.googlesource.com/17523 > Commit-Queue: Henrik Boström <hbos@webrtc.org> > Reviewed-by: Peter Thatcher <pthatcher@webrtc.org> > Reviewed-by: Guido Urdaneta <guidou@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20841} TBR=pthatcher@webrtc.org Bug: webrtc:8473 Change-Id: If2b1a1929663b0e77fcc9c2ebeef043e6f73adf5 Reviewed-on: https://webrtc-review.googlesource.com/25640 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Guido Urdaneta <guidou@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20854}
2017-11-23 17:48:32 +01:00
TEST_F(PeerConnectionRtpCallbacksTest, AddTrackWithStreamFiresOnAddTrack) {
Reland "Added PeerConnectionObserver::OnRemoveTrack." This reverts commit 6c0c55c31817ecfa32409424495eb68b31828c40. Reason for revert: Fixed the flake. Original change's description: > Revert "Added PeerConnectionObserver::OnRemoveTrack." > > This reverts commit ba97ba7af917d4152f5f3363aba1c1561c6673dc. > > Reason for revert: The new tests have caused several test failures on the test bots; the method FakeAudioMediaStreamTrack:GetSignalLevel, which is not supposed to be called is sometimes called anyway. > > Original change's description: > > Added PeerConnectionObserver::OnRemoveTrack. > > > > This corresponds to processing the removal of a remote track step of > > the spec, with processing the addition of a remote track already > > covered by OnAddTrack. > > https://w3c.github.io/webrtc-pc/#processing-remote-mediastreamtracks > > > > Bug: webrtc:8260, webrtc:8315 > > Change-Id: Ica8be92369733eb3cf1397fb60385d45a9b58700 > > Reviewed-on: https://webrtc-review.googlesource.com/4722 > > Commit-Queue: Henrik Boström <hbos@webrtc.org> > > Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> > > Reviewed-by: Steve Anton <steveanton@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#20214} > > TBR=steveanton@webrtc.org,deadbeef@webrtc.org,hbos@webrtc.org > > Change-Id: Id2d9533e27227254769b4280a8ff10a47313e714 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:8260, webrtc:8315 > Reviewed-on: https://webrtc-review.googlesource.com/7940 > Reviewed-by: Alex Loiko <aleloi@webrtc.org> > Commit-Queue: Alex Loiko <aleloi@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20218} TBR=steveanton@webrtc.org,deadbeef@webrtc.org,aleloi@webrtc.org,hbos@webrtc.org Change-Id: Iab7500bebf98535754b102874259de43831fff6b No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:8260, webrtc:8315 Reviewed-on: https://webrtc-review.googlesource.com/8180 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20227}
2017-10-10 10:05:16 -07:00
auto caller = CreatePeerConnection();
auto callee = CreatePeerConnection();
Revert "Add AddTransceiver and GetTransceivers to PeerConnection" This reverts commit f93d2800d9b0d5818a5a383def0aaef3d441df3a. Reason for revert: https://logs.chromium.org/v/?s=chromium%2Fbb%2Fchromium.webrtc.fyi%2Fios-device%2F5804%2F%2B%2Frecipes%2Fsteps%2Fcompile%2F0%2Fstdout Original change's description: > Add AddTransceiver and GetTransceivers to PeerConnection > > WebRTC 1.0 has added the transceiver API to PeerConnection. This > is the first step towards exposing this to WebRTC consumers. For > now, transceivers can be added and fetched but there is not yet > support for creating offers/answers or setting local/remote > descriptions. That support ("Unified Plan") will be added in > follow-up CLs. > > The transceiver API is currently only available if the application > opts in by specifying the kUnifiedPlan SDP semantics when creating > the PeerConnection. > > Bug: webrtc:7600 > Change-Id: I0b8ee24b489b45bb4c5f60b699bd20c61af01d8e > Reviewed-on: https://webrtc-review.googlesource.com/23880 > Commit-Queue: Steve Anton <steveanton@webrtc.org> > Reviewed-by: Peter Thatcher <pthatcher@webrtc.org> > Reviewed-by: Henrik Boström <hbos@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20896} TBR=steveanton@webrtc.org,zhihuang@webrtc.org,hbos@webrtc.org,pthatcher@webrtc.org Change-Id: Ie91ea4988dba25c20e2532114d3a9d859a932d4c No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:7600 Reviewed-on: https://webrtc-review.googlesource.com/26400 Reviewed-by: Steve Anton <steveanton@webrtc.org> Commit-Queue: Steve Anton <steveanton@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20897}
2017-11-27 20:55:38 +00:00
rtc::scoped_refptr<webrtc::AudioTrackInterface> audio_track(
Reland "Added PeerConnectionObserver::OnRemoveTrack." This reverts commit 6c0c55c31817ecfa32409424495eb68b31828c40. Reason for revert: Fixed the flake. Original change's description: > Revert "Added PeerConnectionObserver::OnRemoveTrack." > > This reverts commit ba97ba7af917d4152f5f3363aba1c1561c6673dc. > > Reason for revert: The new tests have caused several test failures on the test bots; the method FakeAudioMediaStreamTrack:GetSignalLevel, which is not supposed to be called is sometimes called anyway. > > Original change's description: > > Added PeerConnectionObserver::OnRemoveTrack. > > > > This corresponds to processing the removal of a remote track step of > > the spec, with processing the addition of a remote track already > > covered by OnAddTrack. > > https://w3c.github.io/webrtc-pc/#processing-remote-mediastreamtracks > > > > Bug: webrtc:8260, webrtc:8315 > > Change-Id: Ica8be92369733eb3cf1397fb60385d45a9b58700 > > Reviewed-on: https://webrtc-review.googlesource.com/4722 > > Commit-Queue: Henrik Boström <hbos@webrtc.org> > > Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> > > Reviewed-by: Steve Anton <steveanton@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#20214} > > TBR=steveanton@webrtc.org,deadbeef@webrtc.org,hbos@webrtc.org > > Change-Id: Id2d9533e27227254769b4280a8ff10a47313e714 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:8260, webrtc:8315 > Reviewed-on: https://webrtc-review.googlesource.com/7940 > Reviewed-by: Alex Loiko <aleloi@webrtc.org> > Commit-Queue: Alex Loiko <aleloi@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20218} TBR=steveanton@webrtc.org,deadbeef@webrtc.org,aleloi@webrtc.org,hbos@webrtc.org Change-Id: Iab7500bebf98535754b102874259de43831fff6b No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:8260, webrtc:8315 Reviewed-on: https://webrtc-review.googlesource.com/8180 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20227}
2017-10-10 10:05:16 -07:00
pc_factory_->CreateAudioTrack("audio_track", nullptr));
Revert "Add AddTransceiver and GetTransceivers to PeerConnection" This reverts commit f93d2800d9b0d5818a5a383def0aaef3d441df3a. Reason for revert: https://logs.chromium.org/v/?s=chromium%2Fbb%2Fchromium.webrtc.fyi%2Fios-device%2F5804%2F%2B%2Frecipes%2Fsteps%2Fcompile%2F0%2Fstdout Original change's description: > Add AddTransceiver and GetTransceivers to PeerConnection > > WebRTC 1.0 has added the transceiver API to PeerConnection. This > is the first step towards exposing this to WebRTC consumers. For > now, transceivers can be added and fetched but there is not yet > support for creating offers/answers or setting local/remote > descriptions. That support ("Unified Plan") will be added in > follow-up CLs. > > The transceiver API is currently only available if the application > opts in by specifying the kUnifiedPlan SDP semantics when creating > the PeerConnection. > > Bug: webrtc:7600 > Change-Id: I0b8ee24b489b45bb4c5f60b699bd20c61af01d8e > Reviewed-on: https://webrtc-review.googlesource.com/23880 > Commit-Queue: Steve Anton <steveanton@webrtc.org> > Reviewed-by: Peter Thatcher <pthatcher@webrtc.org> > Reviewed-by: Henrik Boström <hbos@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20896} TBR=steveanton@webrtc.org,zhihuang@webrtc.org,hbos@webrtc.org,pthatcher@webrtc.org Change-Id: Ie91ea4988dba25c20e2532114d3a9d859a932d4c No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:7600 Reviewed-on: https://webrtc-review.googlesource.com/26400 Reviewed-by: Steve Anton <steveanton@webrtc.org> Commit-Queue: Steve Anton <steveanton@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20897}
2017-11-27 20:55:38 +00:00
auto stream = webrtc::MediaStream::Create("audio_stream");
Reland "Added PeerConnectionObserver::OnRemoveTrack." This reverts commit 6c0c55c31817ecfa32409424495eb68b31828c40. Reason for revert: Fixed the flake. Original change's description: > Revert "Added PeerConnectionObserver::OnRemoveTrack." > > This reverts commit ba97ba7af917d4152f5f3363aba1c1561c6673dc. > > Reason for revert: The new tests have caused several test failures on the test bots; the method FakeAudioMediaStreamTrack:GetSignalLevel, which is not supposed to be called is sometimes called anyway. > > Original change's description: > > Added PeerConnectionObserver::OnRemoveTrack. > > > > This corresponds to processing the removal of a remote track step of > > the spec, with processing the addition of a remote track already > > covered by OnAddTrack. > > https://w3c.github.io/webrtc-pc/#processing-remote-mediastreamtracks > > > > Bug: webrtc:8260, webrtc:8315 > > Change-Id: Ica8be92369733eb3cf1397fb60385d45a9b58700 > > Reviewed-on: https://webrtc-review.googlesource.com/4722 > > Commit-Queue: Henrik Boström <hbos@webrtc.org> > > Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> > > Reviewed-by: Steve Anton <steveanton@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#20214} > > TBR=steveanton@webrtc.org,deadbeef@webrtc.org,hbos@webrtc.org > > Change-Id: Id2d9533e27227254769b4280a8ff10a47313e714 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:8260, webrtc:8315 > Reviewed-on: https://webrtc-review.googlesource.com/7940 > Reviewed-by: Alex Loiko <aleloi@webrtc.org> > Commit-Queue: Alex Loiko <aleloi@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20218} TBR=steveanton@webrtc.org,deadbeef@webrtc.org,aleloi@webrtc.org,hbos@webrtc.org Change-Id: Iab7500bebf98535754b102874259de43831fff6b No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:8260, webrtc:8315 Reviewed-on: https://webrtc-review.googlesource.com/8180 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20227}
2017-10-10 10:05:16 -07:00
EXPECT_TRUE(caller->pc()->AddTrack(audio_track.get(), {stream.get()}));
Reland "SetRemoteDescriptionObserverInterface added." Description for changes from the original CL: Calling legacy SRD, implemented using SetRemoteDescriptionObserverAdapter wrapping the old observer, was meant to have the exact same behavior as the legacy SRD implementation which invokes the callbacks in a Post. However, in the CL that landed and got reverted (PS1), the Adapter had its own message handler, and callbacks would be invoked even if the PC was destroyed. In PS2 I've changed the Adapter to use the PeerConnection's message handler. If the PC is destroyed, the callback will not be invoked. This gives identical behavior to before this CL, and the legacy behavior is covered by a new unittest. I changed the adapter to be an implementation detail of peerconnection.cc, therefor some stuff was moved, and the only tests covering this is now in peerconnection_rtp_unittest.cc. This is a reland of 6c7ec32bd63ab2b45d4d83ae1de817ee946b4d72 Original change's description: > SetRemoteDescriptionObserverInterface added. > > The new observer replaced SetSessionDescriptionObserver for > SetRemoteDescription. Unlike SetSessionDescriptionObserver, > SetRemoteDescriptionObserverInterface is invoked synchronously so > that the you can rely on the state of the PeerConnection to represent > the result of the SetRemoteDescription call in the callback. > > The new observer succeeds or fails with an RTCError. > > This deprecates the need for PeerConnectionObserver::OnAdd/RemoveTrack > and SetSessionDescriptionObserver, with the benefit that all media > object changes can be processed in a single callback by the application > in a synchronous callback. This will help Chromium keep objects in-sync > across layers and threads in a non-racy and straight-forward way, see > design doc (Proposal 2): > https://docs.google.com/a/google.com/document/d/1-cDDC82mgU5zrHacfFz720p3xwRtuBkOPSRchh07Ho0/edit?usp=sharing > > An adapter for SetSessionDescriptionObserver is added to allow calling > the old SetRemoteDescription signature and get the old behavior > (OnSuccess/OnFailure callback in a Post) until third parties switch. > > Bug: webrtc:8473 > Change-Id: I3d4eb60da6dd34615f2c9f384aeaf4634e648c99 > Reviewed-on: https://webrtc-review.googlesource.com/17523 > Commit-Queue: Henrik Boström <hbos@webrtc.org> > Reviewed-by: Peter Thatcher <pthatcher@webrtc.org> > Reviewed-by: Guido Urdaneta <guidou@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20841} TBR=pthatcher@webrtc.org Bug: webrtc:8473 Change-Id: If2b1a1929663b0e77fcc9c2ebeef043e6f73adf5 Reviewed-on: https://webrtc-review.googlesource.com/25640 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Guido Urdaneta <guidou@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20854}
2017-11-23 17:48:32 +01:00
ASSERT_TRUE(
callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal(),
static_cast<webrtc::RTCError*>(nullptr)));
Reland "Added PeerConnectionObserver::OnRemoveTrack." This reverts commit 6c0c55c31817ecfa32409424495eb68b31828c40. Reason for revert: Fixed the flake. Original change's description: > Revert "Added PeerConnectionObserver::OnRemoveTrack." > > This reverts commit ba97ba7af917d4152f5f3363aba1c1561c6673dc. > > Reason for revert: The new tests have caused several test failures on the test bots; the method FakeAudioMediaStreamTrack:GetSignalLevel, which is not supposed to be called is sometimes called anyway. > > Original change's description: > > Added PeerConnectionObserver::OnRemoveTrack. > > > > This corresponds to processing the removal of a remote track step of > > the spec, with processing the addition of a remote track already > > covered by OnAddTrack. > > https://w3c.github.io/webrtc-pc/#processing-remote-mediastreamtracks > > > > Bug: webrtc:8260, webrtc:8315 > > Change-Id: Ica8be92369733eb3cf1397fb60385d45a9b58700 > > Reviewed-on: https://webrtc-review.googlesource.com/4722 > > Commit-Queue: Henrik Boström <hbos@webrtc.org> > > Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> > > Reviewed-by: Steve Anton <steveanton@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#20214} > > TBR=steveanton@webrtc.org,deadbeef@webrtc.org,hbos@webrtc.org > > Change-Id: Id2d9533e27227254769b4280a8ff10a47313e714 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:8260, webrtc:8315 > Reviewed-on: https://webrtc-review.googlesource.com/7940 > Reviewed-by: Alex Loiko <aleloi@webrtc.org> > Commit-Queue: Alex Loiko <aleloi@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20218} TBR=steveanton@webrtc.org,deadbeef@webrtc.org,aleloi@webrtc.org,hbos@webrtc.org Change-Id: Iab7500bebf98535754b102874259de43831fff6b No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:8260, webrtc:8315 Reviewed-on: https://webrtc-review.googlesource.com/8180 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20227}
2017-10-10 10:05:16 -07:00
Reland "SetRemoteDescriptionObserverInterface added." Description for changes from the original CL: Calling legacy SRD, implemented using SetRemoteDescriptionObserverAdapter wrapping the old observer, was meant to have the exact same behavior as the legacy SRD implementation which invokes the callbacks in a Post. However, in the CL that landed and got reverted (PS1), the Adapter had its own message handler, and callbacks would be invoked even if the PC was destroyed. In PS2 I've changed the Adapter to use the PeerConnection's message handler. If the PC is destroyed, the callback will not be invoked. This gives identical behavior to before this CL, and the legacy behavior is covered by a new unittest. I changed the adapter to be an implementation detail of peerconnection.cc, therefor some stuff was moved, and the only tests covering this is now in peerconnection_rtp_unittest.cc. This is a reland of 6c7ec32bd63ab2b45d4d83ae1de817ee946b4d72 Original change's description: > SetRemoteDescriptionObserverInterface added. > > The new observer replaced SetSessionDescriptionObserver for > SetRemoteDescription. Unlike SetSessionDescriptionObserver, > SetRemoteDescriptionObserverInterface is invoked synchronously so > that the you can rely on the state of the PeerConnection to represent > the result of the SetRemoteDescription call in the callback. > > The new observer succeeds or fails with an RTCError. > > This deprecates the need for PeerConnectionObserver::OnAdd/RemoveTrack > and SetSessionDescriptionObserver, with the benefit that all media > object changes can be processed in a single callback by the application > in a synchronous callback. This will help Chromium keep objects in-sync > across layers and threads in a non-racy and straight-forward way, see > design doc (Proposal 2): > https://docs.google.com/a/google.com/document/d/1-cDDC82mgU5zrHacfFz720p3xwRtuBkOPSRchh07Ho0/edit?usp=sharing > > An adapter for SetSessionDescriptionObserver is added to allow calling > the old SetRemoteDescription signature and get the old behavior > (OnSuccess/OnFailure callback in a Post) until third parties switch. > > Bug: webrtc:8473 > Change-Id: I3d4eb60da6dd34615f2c9f384aeaf4634e648c99 > Reviewed-on: https://webrtc-review.googlesource.com/17523 > Commit-Queue: Henrik Boström <hbos@webrtc.org> > Reviewed-by: Peter Thatcher <pthatcher@webrtc.org> > Reviewed-by: Guido Urdaneta <guidou@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20841} TBR=pthatcher@webrtc.org Bug: webrtc:8473 Change-Id: If2b1a1929663b0e77fcc9c2ebeef043e6f73adf5 Reviewed-on: https://webrtc-review.googlesource.com/25640 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Guido Urdaneta <guidou@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20854}
2017-11-23 17:48:32 +01:00
ASSERT_EQ(callee->observer()->add_track_events_.size(), 1u);
auto& add_track_event = callee->observer()->add_track_events_[0];
Reland "SetRemoteDescriptionObserverInterface added." Description for changes from the original CL: Calling legacy SRD, implemented using SetRemoteDescriptionObserverAdapter wrapping the old observer, was meant to have the exact same behavior as the legacy SRD implementation which invokes the callbacks in a Post. However, in the CL that landed and got reverted (PS1), the Adapter had its own message handler, and callbacks would be invoked even if the PC was destroyed. In PS2 I've changed the Adapter to use the PeerConnection's message handler. If the PC is destroyed, the callback will not be invoked. This gives identical behavior to before this CL, and the legacy behavior is covered by a new unittest. I changed the adapter to be an implementation detail of peerconnection.cc, therefor some stuff was moved, and the only tests covering this is now in peerconnection_rtp_unittest.cc. This is a reland of 6c7ec32bd63ab2b45d4d83ae1de817ee946b4d72 Original change's description: > SetRemoteDescriptionObserverInterface added. > > The new observer replaced SetSessionDescriptionObserver for > SetRemoteDescription. Unlike SetSessionDescriptionObserver, > SetRemoteDescriptionObserverInterface is invoked synchronously so > that the you can rely on the state of the PeerConnection to represent > the result of the SetRemoteDescription call in the callback. > > The new observer succeeds or fails with an RTCError. > > This deprecates the need for PeerConnectionObserver::OnAdd/RemoveTrack > and SetSessionDescriptionObserver, with the benefit that all media > object changes can be processed in a single callback by the application > in a synchronous callback. This will help Chromium keep objects in-sync > across layers and threads in a non-racy and straight-forward way, see > design doc (Proposal 2): > https://docs.google.com/a/google.com/document/d/1-cDDC82mgU5zrHacfFz720p3xwRtuBkOPSRchh07Ho0/edit?usp=sharing > > An adapter for SetSessionDescriptionObserver is added to allow calling > the old SetRemoteDescription signature and get the old behavior > (OnSuccess/OnFailure callback in a Post) until third parties switch. > > Bug: webrtc:8473 > Change-Id: I3d4eb60da6dd34615f2c9f384aeaf4634e648c99 > Reviewed-on: https://webrtc-review.googlesource.com/17523 > Commit-Queue: Henrik Boström <hbos@webrtc.org> > Reviewed-by: Peter Thatcher <pthatcher@webrtc.org> > Reviewed-by: Guido Urdaneta <guidou@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20841} TBR=pthatcher@webrtc.org Bug: webrtc:8473 Change-Id: If2b1a1929663b0e77fcc9c2ebeef043e6f73adf5 Reviewed-on: https://webrtc-review.googlesource.com/25640 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Guido Urdaneta <guidou@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20854}
2017-11-23 17:48:32 +01:00
ASSERT_EQ(add_track_event.streams.size(), 1u);
EXPECT_EQ("audio_stream", add_track_event.streams[0]->label());
EXPECT_TRUE(add_track_event.streams[0]->FindAudioTrack("audio_track"));
EXPECT_EQ(add_track_event.streams, add_track_event.receiver->streams());
Reland "Added PeerConnectionObserver::OnRemoveTrack." This reverts commit 6c0c55c31817ecfa32409424495eb68b31828c40. Reason for revert: Fixed the flake. Original change's description: > Revert "Added PeerConnectionObserver::OnRemoveTrack." > > This reverts commit ba97ba7af917d4152f5f3363aba1c1561c6673dc. > > Reason for revert: The new tests have caused several test failures on the test bots; the method FakeAudioMediaStreamTrack:GetSignalLevel, which is not supposed to be called is sometimes called anyway. > > Original change's description: > > Added PeerConnectionObserver::OnRemoveTrack. > > > > This corresponds to processing the removal of a remote track step of > > the spec, with processing the addition of a remote track already > > covered by OnAddTrack. > > https://w3c.github.io/webrtc-pc/#processing-remote-mediastreamtracks > > > > Bug: webrtc:8260, webrtc:8315 > > Change-Id: Ica8be92369733eb3cf1397fb60385d45a9b58700 > > Reviewed-on: https://webrtc-review.googlesource.com/4722 > > Commit-Queue: Henrik Boström <hbos@webrtc.org> > > Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> > > Reviewed-by: Steve Anton <steveanton@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#20214} > > TBR=steveanton@webrtc.org,deadbeef@webrtc.org,hbos@webrtc.org > > Change-Id: Id2d9533e27227254769b4280a8ff10a47313e714 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:8260, webrtc:8315 > Reviewed-on: https://webrtc-review.googlesource.com/7940 > Reviewed-by: Alex Loiko <aleloi@webrtc.org> > Commit-Queue: Alex Loiko <aleloi@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20218} TBR=steveanton@webrtc.org,deadbeef@webrtc.org,aleloi@webrtc.org,hbos@webrtc.org Change-Id: Iab7500bebf98535754b102874259de43831fff6b No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:8260, webrtc:8315 Reviewed-on: https://webrtc-review.googlesource.com/8180 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20227}
2017-10-10 10:05:16 -07:00
}
Reland "SetRemoteDescriptionObserverInterface added." Description for changes from the original CL: Calling legacy SRD, implemented using SetRemoteDescriptionObserverAdapter wrapping the old observer, was meant to have the exact same behavior as the legacy SRD implementation which invokes the callbacks in a Post. However, in the CL that landed and got reverted (PS1), the Adapter had its own message handler, and callbacks would be invoked even if the PC was destroyed. In PS2 I've changed the Adapter to use the PeerConnection's message handler. If the PC is destroyed, the callback will not be invoked. This gives identical behavior to before this CL, and the legacy behavior is covered by a new unittest. I changed the adapter to be an implementation detail of peerconnection.cc, therefor some stuff was moved, and the only tests covering this is now in peerconnection_rtp_unittest.cc. This is a reland of 6c7ec32bd63ab2b45d4d83ae1de817ee946b4d72 Original change's description: > SetRemoteDescriptionObserverInterface added. > > The new observer replaced SetSessionDescriptionObserver for > SetRemoteDescription. Unlike SetSessionDescriptionObserver, > SetRemoteDescriptionObserverInterface is invoked synchronously so > that the you can rely on the state of the PeerConnection to represent > the result of the SetRemoteDescription call in the callback. > > The new observer succeeds or fails with an RTCError. > > This deprecates the need for PeerConnectionObserver::OnAdd/RemoveTrack > and SetSessionDescriptionObserver, with the benefit that all media > object changes can be processed in a single callback by the application > in a synchronous callback. This will help Chromium keep objects in-sync > across layers and threads in a non-racy and straight-forward way, see > design doc (Proposal 2): > https://docs.google.com/a/google.com/document/d/1-cDDC82mgU5zrHacfFz720p3xwRtuBkOPSRchh07Ho0/edit?usp=sharing > > An adapter for SetSessionDescriptionObserver is added to allow calling > the old SetRemoteDescription signature and get the old behavior > (OnSuccess/OnFailure callback in a Post) until third parties switch. > > Bug: webrtc:8473 > Change-Id: I3d4eb60da6dd34615f2c9f384aeaf4634e648c99 > Reviewed-on: https://webrtc-review.googlesource.com/17523 > Commit-Queue: Henrik Boström <hbos@webrtc.org> > Reviewed-by: Peter Thatcher <pthatcher@webrtc.org> > Reviewed-by: Guido Urdaneta <guidou@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20841} TBR=pthatcher@webrtc.org Bug: webrtc:8473 Change-Id: If2b1a1929663b0e77fcc9c2ebeef043e6f73adf5 Reviewed-on: https://webrtc-review.googlesource.com/25640 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Guido Urdaneta <guidou@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20854}
2017-11-23 17:48:32 +01:00
TEST_F(PeerConnectionRtpCallbacksTest,
RemoveTrackWithoutStreamFiresOnRemoveTrack) {
Reland "Added PeerConnectionObserver::OnRemoveTrack." This reverts commit 6c0c55c31817ecfa32409424495eb68b31828c40. Reason for revert: Fixed the flake. Original change's description: > Revert "Added PeerConnectionObserver::OnRemoveTrack." > > This reverts commit ba97ba7af917d4152f5f3363aba1c1561c6673dc. > > Reason for revert: The new tests have caused several test failures on the test bots; the method FakeAudioMediaStreamTrack:GetSignalLevel, which is not supposed to be called is sometimes called anyway. > > Original change's description: > > Added PeerConnectionObserver::OnRemoveTrack. > > > > This corresponds to processing the removal of a remote track step of > > the spec, with processing the addition of a remote track already > > covered by OnAddTrack. > > https://w3c.github.io/webrtc-pc/#processing-remote-mediastreamtracks > > > > Bug: webrtc:8260, webrtc:8315 > > Change-Id: Ica8be92369733eb3cf1397fb60385d45a9b58700 > > Reviewed-on: https://webrtc-review.googlesource.com/4722 > > Commit-Queue: Henrik Boström <hbos@webrtc.org> > > Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> > > Reviewed-by: Steve Anton <steveanton@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#20214} > > TBR=steveanton@webrtc.org,deadbeef@webrtc.org,hbos@webrtc.org > > Change-Id: Id2d9533e27227254769b4280a8ff10a47313e714 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:8260, webrtc:8315 > Reviewed-on: https://webrtc-review.googlesource.com/7940 > Reviewed-by: Alex Loiko <aleloi@webrtc.org> > Commit-Queue: Alex Loiko <aleloi@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20218} TBR=steveanton@webrtc.org,deadbeef@webrtc.org,aleloi@webrtc.org,hbos@webrtc.org Change-Id: Iab7500bebf98535754b102874259de43831fff6b No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:8260, webrtc:8315 Reviewed-on: https://webrtc-review.googlesource.com/8180 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20227}
2017-10-10 10:05:16 -07:00
auto caller = CreatePeerConnection();
auto callee = CreatePeerConnection();
Revert "Add AddTransceiver and GetTransceivers to PeerConnection" This reverts commit f93d2800d9b0d5818a5a383def0aaef3d441df3a. Reason for revert: https://logs.chromium.org/v/?s=chromium%2Fbb%2Fchromium.webrtc.fyi%2Fios-device%2F5804%2F%2B%2Frecipes%2Fsteps%2Fcompile%2F0%2Fstdout Original change's description: > Add AddTransceiver and GetTransceivers to PeerConnection > > WebRTC 1.0 has added the transceiver API to PeerConnection. This > is the first step towards exposing this to WebRTC consumers. For > now, transceivers can be added and fetched but there is not yet > support for creating offers/answers or setting local/remote > descriptions. That support ("Unified Plan") will be added in > follow-up CLs. > > The transceiver API is currently only available if the application > opts in by specifying the kUnifiedPlan SDP semantics when creating > the PeerConnection. > > Bug: webrtc:7600 > Change-Id: I0b8ee24b489b45bb4c5f60b699bd20c61af01d8e > Reviewed-on: https://webrtc-review.googlesource.com/23880 > Commit-Queue: Steve Anton <steveanton@webrtc.org> > Reviewed-by: Peter Thatcher <pthatcher@webrtc.org> > Reviewed-by: Henrik Boström <hbos@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20896} TBR=steveanton@webrtc.org,zhihuang@webrtc.org,hbos@webrtc.org,pthatcher@webrtc.org Change-Id: Ie91ea4988dba25c20e2532114d3a9d859a932d4c No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:7600 Reviewed-on: https://webrtc-review.googlesource.com/26400 Reviewed-by: Steve Anton <steveanton@webrtc.org> Commit-Queue: Steve Anton <steveanton@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20897}
2017-11-27 20:55:38 +00:00
rtc::scoped_refptr<webrtc::AudioTrackInterface> audio_track(
Reland "Added PeerConnectionObserver::OnRemoveTrack." This reverts commit 6c0c55c31817ecfa32409424495eb68b31828c40. Reason for revert: Fixed the flake. Original change's description: > Revert "Added PeerConnectionObserver::OnRemoveTrack." > > This reverts commit ba97ba7af917d4152f5f3363aba1c1561c6673dc. > > Reason for revert: The new tests have caused several test failures on the test bots; the method FakeAudioMediaStreamTrack:GetSignalLevel, which is not supposed to be called is sometimes called anyway. > > Original change's description: > > Added PeerConnectionObserver::OnRemoveTrack. > > > > This corresponds to processing the removal of a remote track step of > > the spec, with processing the addition of a remote track already > > covered by OnAddTrack. > > https://w3c.github.io/webrtc-pc/#processing-remote-mediastreamtracks > > > > Bug: webrtc:8260, webrtc:8315 > > Change-Id: Ica8be92369733eb3cf1397fb60385d45a9b58700 > > Reviewed-on: https://webrtc-review.googlesource.com/4722 > > Commit-Queue: Henrik Boström <hbos@webrtc.org> > > Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> > > Reviewed-by: Steve Anton <steveanton@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#20214} > > TBR=steveanton@webrtc.org,deadbeef@webrtc.org,hbos@webrtc.org > > Change-Id: Id2d9533e27227254769b4280a8ff10a47313e714 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:8260, webrtc:8315 > Reviewed-on: https://webrtc-review.googlesource.com/7940 > Reviewed-by: Alex Loiko <aleloi@webrtc.org> > Commit-Queue: Alex Loiko <aleloi@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20218} TBR=steveanton@webrtc.org,deadbeef@webrtc.org,aleloi@webrtc.org,hbos@webrtc.org Change-Id: Iab7500bebf98535754b102874259de43831fff6b No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:8260, webrtc:8315 Reviewed-on: https://webrtc-review.googlesource.com/8180 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20227}
2017-10-10 10:05:16 -07:00
pc_factory_->CreateAudioTrack("audio_track", nullptr));
auto sender = caller->pc()->AddTrack(audio_track.get(), {});
Reland "SetRemoteDescriptionObserverInterface added." Description for changes from the original CL: Calling legacy SRD, implemented using SetRemoteDescriptionObserverAdapter wrapping the old observer, was meant to have the exact same behavior as the legacy SRD implementation which invokes the callbacks in a Post. However, in the CL that landed and got reverted (PS1), the Adapter had its own message handler, and callbacks would be invoked even if the PC was destroyed. In PS2 I've changed the Adapter to use the PeerConnection's message handler. If the PC is destroyed, the callback will not be invoked. This gives identical behavior to before this CL, and the legacy behavior is covered by a new unittest. I changed the adapter to be an implementation detail of peerconnection.cc, therefor some stuff was moved, and the only tests covering this is now in peerconnection_rtp_unittest.cc. This is a reland of 6c7ec32bd63ab2b45d4d83ae1de817ee946b4d72 Original change's description: > SetRemoteDescriptionObserverInterface added. > > The new observer replaced SetSessionDescriptionObserver for > SetRemoteDescription. Unlike SetSessionDescriptionObserver, > SetRemoteDescriptionObserverInterface is invoked synchronously so > that the you can rely on the state of the PeerConnection to represent > the result of the SetRemoteDescription call in the callback. > > The new observer succeeds or fails with an RTCError. > > This deprecates the need for PeerConnectionObserver::OnAdd/RemoveTrack > and SetSessionDescriptionObserver, with the benefit that all media > object changes can be processed in a single callback by the application > in a synchronous callback. This will help Chromium keep objects in-sync > across layers and threads in a non-racy and straight-forward way, see > design doc (Proposal 2): > https://docs.google.com/a/google.com/document/d/1-cDDC82mgU5zrHacfFz720p3xwRtuBkOPSRchh07Ho0/edit?usp=sharing > > An adapter for SetSessionDescriptionObserver is added to allow calling > the old SetRemoteDescription signature and get the old behavior > (OnSuccess/OnFailure callback in a Post) until third parties switch. > > Bug: webrtc:8473 > Change-Id: I3d4eb60da6dd34615f2c9f384aeaf4634e648c99 > Reviewed-on: https://webrtc-review.googlesource.com/17523 > Commit-Queue: Henrik Boström <hbos@webrtc.org> > Reviewed-by: Peter Thatcher <pthatcher@webrtc.org> > Reviewed-by: Guido Urdaneta <guidou@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20841} TBR=pthatcher@webrtc.org Bug: webrtc:8473 Change-Id: If2b1a1929663b0e77fcc9c2ebeef043e6f73adf5 Reviewed-on: https://webrtc-review.googlesource.com/25640 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Guido Urdaneta <guidou@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20854}
2017-11-23 17:48:32 +01:00
ASSERT_TRUE(
callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal(),
static_cast<webrtc::RTCError*>(nullptr)));
ASSERT_EQ(callee->observer()->add_track_events_.size(), 1u);
Reland "Added PeerConnectionObserver::OnRemoveTrack." This reverts commit 6c0c55c31817ecfa32409424495eb68b31828c40. Reason for revert: Fixed the flake. Original change's description: > Revert "Added PeerConnectionObserver::OnRemoveTrack." > > This reverts commit ba97ba7af917d4152f5f3363aba1c1561c6673dc. > > Reason for revert: The new tests have caused several test failures on the test bots; the method FakeAudioMediaStreamTrack:GetSignalLevel, which is not supposed to be called is sometimes called anyway. > > Original change's description: > > Added PeerConnectionObserver::OnRemoveTrack. > > > > This corresponds to processing the removal of a remote track step of > > the spec, with processing the addition of a remote track already > > covered by OnAddTrack. > > https://w3c.github.io/webrtc-pc/#processing-remote-mediastreamtracks > > > > Bug: webrtc:8260, webrtc:8315 > > Change-Id: Ica8be92369733eb3cf1397fb60385d45a9b58700 > > Reviewed-on: https://webrtc-review.googlesource.com/4722 > > Commit-Queue: Henrik Boström <hbos@webrtc.org> > > Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> > > Reviewed-by: Steve Anton <steveanton@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#20214} > > TBR=steveanton@webrtc.org,deadbeef@webrtc.org,hbos@webrtc.org > > Change-Id: Id2d9533e27227254769b4280a8ff10a47313e714 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:8260, webrtc:8315 > Reviewed-on: https://webrtc-review.googlesource.com/7940 > Reviewed-by: Alex Loiko <aleloi@webrtc.org> > Commit-Queue: Alex Loiko <aleloi@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20218} TBR=steveanton@webrtc.org,deadbeef@webrtc.org,aleloi@webrtc.org,hbos@webrtc.org Change-Id: Iab7500bebf98535754b102874259de43831fff6b No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:8260, webrtc:8315 Reviewed-on: https://webrtc-review.googlesource.com/8180 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20227}
2017-10-10 10:05:16 -07:00
EXPECT_TRUE(caller->pc()->RemoveTrack(sender));
Reland "SetRemoteDescriptionObserverInterface added." Description for changes from the original CL: Calling legacy SRD, implemented using SetRemoteDescriptionObserverAdapter wrapping the old observer, was meant to have the exact same behavior as the legacy SRD implementation which invokes the callbacks in a Post. However, in the CL that landed and got reverted (PS1), the Adapter had its own message handler, and callbacks would be invoked even if the PC was destroyed. In PS2 I've changed the Adapter to use the PeerConnection's message handler. If the PC is destroyed, the callback will not be invoked. This gives identical behavior to before this CL, and the legacy behavior is covered by a new unittest. I changed the adapter to be an implementation detail of peerconnection.cc, therefor some stuff was moved, and the only tests covering this is now in peerconnection_rtp_unittest.cc. This is a reland of 6c7ec32bd63ab2b45d4d83ae1de817ee946b4d72 Original change's description: > SetRemoteDescriptionObserverInterface added. > > The new observer replaced SetSessionDescriptionObserver for > SetRemoteDescription. Unlike SetSessionDescriptionObserver, > SetRemoteDescriptionObserverInterface is invoked synchronously so > that the you can rely on the state of the PeerConnection to represent > the result of the SetRemoteDescription call in the callback. > > The new observer succeeds or fails with an RTCError. > > This deprecates the need for PeerConnectionObserver::OnAdd/RemoveTrack > and SetSessionDescriptionObserver, with the benefit that all media > object changes can be processed in a single callback by the application > in a synchronous callback. This will help Chromium keep objects in-sync > across layers and threads in a non-racy and straight-forward way, see > design doc (Proposal 2): > https://docs.google.com/a/google.com/document/d/1-cDDC82mgU5zrHacfFz720p3xwRtuBkOPSRchh07Ho0/edit?usp=sharing > > An adapter for SetSessionDescriptionObserver is added to allow calling > the old SetRemoteDescription signature and get the old behavior > (OnSuccess/OnFailure callback in a Post) until third parties switch. > > Bug: webrtc:8473 > Change-Id: I3d4eb60da6dd34615f2c9f384aeaf4634e648c99 > Reviewed-on: https://webrtc-review.googlesource.com/17523 > Commit-Queue: Henrik Boström <hbos@webrtc.org> > Reviewed-by: Peter Thatcher <pthatcher@webrtc.org> > Reviewed-by: Guido Urdaneta <guidou@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20841} TBR=pthatcher@webrtc.org Bug: webrtc:8473 Change-Id: If2b1a1929663b0e77fcc9c2ebeef043e6f73adf5 Reviewed-on: https://webrtc-review.googlesource.com/25640 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Guido Urdaneta <guidou@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20854}
2017-11-23 17:48:32 +01:00
ASSERT_TRUE(
callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal(),
static_cast<webrtc::RTCError*>(nullptr)));
Reland "Added PeerConnectionObserver::OnRemoveTrack." This reverts commit 6c0c55c31817ecfa32409424495eb68b31828c40. Reason for revert: Fixed the flake. Original change's description: > Revert "Added PeerConnectionObserver::OnRemoveTrack." > > This reverts commit ba97ba7af917d4152f5f3363aba1c1561c6673dc. > > Reason for revert: The new tests have caused several test failures on the test bots; the method FakeAudioMediaStreamTrack:GetSignalLevel, which is not supposed to be called is sometimes called anyway. > > Original change's description: > > Added PeerConnectionObserver::OnRemoveTrack. > > > > This corresponds to processing the removal of a remote track step of > > the spec, with processing the addition of a remote track already > > covered by OnAddTrack. > > https://w3c.github.io/webrtc-pc/#processing-remote-mediastreamtracks > > > > Bug: webrtc:8260, webrtc:8315 > > Change-Id: Ica8be92369733eb3cf1397fb60385d45a9b58700 > > Reviewed-on: https://webrtc-review.googlesource.com/4722 > > Commit-Queue: Henrik Boström <hbos@webrtc.org> > > Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> > > Reviewed-by: Steve Anton <steveanton@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#20214} > > TBR=steveanton@webrtc.org,deadbeef@webrtc.org,hbos@webrtc.org > > Change-Id: Id2d9533e27227254769b4280a8ff10a47313e714 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:8260, webrtc:8315 > Reviewed-on: https://webrtc-review.googlesource.com/7940 > Reviewed-by: Alex Loiko <aleloi@webrtc.org> > Commit-Queue: Alex Loiko <aleloi@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20218} TBR=steveanton@webrtc.org,deadbeef@webrtc.org,aleloi@webrtc.org,hbos@webrtc.org Change-Id: Iab7500bebf98535754b102874259de43831fff6b No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:8260, webrtc:8315 Reviewed-on: https://webrtc-review.googlesource.com/8180 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20227}
2017-10-10 10:05:16 -07:00
Reland "SetRemoteDescriptionObserverInterface added." Description for changes from the original CL: Calling legacy SRD, implemented using SetRemoteDescriptionObserverAdapter wrapping the old observer, was meant to have the exact same behavior as the legacy SRD implementation which invokes the callbacks in a Post. However, in the CL that landed and got reverted (PS1), the Adapter had its own message handler, and callbacks would be invoked even if the PC was destroyed. In PS2 I've changed the Adapter to use the PeerConnection's message handler. If the PC is destroyed, the callback will not be invoked. This gives identical behavior to before this CL, and the legacy behavior is covered by a new unittest. I changed the adapter to be an implementation detail of peerconnection.cc, therefor some stuff was moved, and the only tests covering this is now in peerconnection_rtp_unittest.cc. This is a reland of 6c7ec32bd63ab2b45d4d83ae1de817ee946b4d72 Original change's description: > SetRemoteDescriptionObserverInterface added. > > The new observer replaced SetSessionDescriptionObserver for > SetRemoteDescription. Unlike SetSessionDescriptionObserver, > SetRemoteDescriptionObserverInterface is invoked synchronously so > that the you can rely on the state of the PeerConnection to represent > the result of the SetRemoteDescription call in the callback. > > The new observer succeeds or fails with an RTCError. > > This deprecates the need for PeerConnectionObserver::OnAdd/RemoveTrack > and SetSessionDescriptionObserver, with the benefit that all media > object changes can be processed in a single callback by the application > in a synchronous callback. This will help Chromium keep objects in-sync > across layers and threads in a non-racy and straight-forward way, see > design doc (Proposal 2): > https://docs.google.com/a/google.com/document/d/1-cDDC82mgU5zrHacfFz720p3xwRtuBkOPSRchh07Ho0/edit?usp=sharing > > An adapter for SetSessionDescriptionObserver is added to allow calling > the old SetRemoteDescription signature and get the old behavior > (OnSuccess/OnFailure callback in a Post) until third parties switch. > > Bug: webrtc:8473 > Change-Id: I3d4eb60da6dd34615f2c9f384aeaf4634e648c99 > Reviewed-on: https://webrtc-review.googlesource.com/17523 > Commit-Queue: Henrik Boström <hbos@webrtc.org> > Reviewed-by: Peter Thatcher <pthatcher@webrtc.org> > Reviewed-by: Guido Urdaneta <guidou@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20841} TBR=pthatcher@webrtc.org Bug: webrtc:8473 Change-Id: If2b1a1929663b0e77fcc9c2ebeef043e6f73adf5 Reviewed-on: https://webrtc-review.googlesource.com/25640 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Guido Urdaneta <guidou@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20854}
2017-11-23 17:48:32 +01:00
ASSERT_EQ(callee->observer()->add_track_events_.size(), 1u);
Reland "Added PeerConnectionObserver::OnRemoveTrack." This reverts commit 6c0c55c31817ecfa32409424495eb68b31828c40. Reason for revert: Fixed the flake. Original change's description: > Revert "Added PeerConnectionObserver::OnRemoveTrack." > > This reverts commit ba97ba7af917d4152f5f3363aba1c1561c6673dc. > > Reason for revert: The new tests have caused several test failures on the test bots; the method FakeAudioMediaStreamTrack:GetSignalLevel, which is not supposed to be called is sometimes called anyway. > > Original change's description: > > Added PeerConnectionObserver::OnRemoveTrack. > > > > This corresponds to processing the removal of a remote track step of > > the spec, with processing the addition of a remote track already > > covered by OnAddTrack. > > https://w3c.github.io/webrtc-pc/#processing-remote-mediastreamtracks > > > > Bug: webrtc:8260, webrtc:8315 > > Change-Id: Ica8be92369733eb3cf1397fb60385d45a9b58700 > > Reviewed-on: https://webrtc-review.googlesource.com/4722 > > Commit-Queue: Henrik Boström <hbos@webrtc.org> > > Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> > > Reviewed-by: Steve Anton <steveanton@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#20214} > > TBR=steveanton@webrtc.org,deadbeef@webrtc.org,hbos@webrtc.org > > Change-Id: Id2d9533e27227254769b4280a8ff10a47313e714 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:8260, webrtc:8315 > Reviewed-on: https://webrtc-review.googlesource.com/7940 > Reviewed-by: Alex Loiko <aleloi@webrtc.org> > Commit-Queue: Alex Loiko <aleloi@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20218} TBR=steveanton@webrtc.org,deadbeef@webrtc.org,aleloi@webrtc.org,hbos@webrtc.org Change-Id: Iab7500bebf98535754b102874259de43831fff6b No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:8260, webrtc:8315 Reviewed-on: https://webrtc-review.googlesource.com/8180 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20227}
2017-10-10 10:05:16 -07:00
EXPECT_EQ(callee->observer()->GetAddTrackReceivers(),
callee->observer()->remove_track_events_);
}
Reland "SetRemoteDescriptionObserverInterface added." Description for changes from the original CL: Calling legacy SRD, implemented using SetRemoteDescriptionObserverAdapter wrapping the old observer, was meant to have the exact same behavior as the legacy SRD implementation which invokes the callbacks in a Post. However, in the CL that landed and got reverted (PS1), the Adapter had its own message handler, and callbacks would be invoked even if the PC was destroyed. In PS2 I've changed the Adapter to use the PeerConnection's message handler. If the PC is destroyed, the callback will not be invoked. This gives identical behavior to before this CL, and the legacy behavior is covered by a new unittest. I changed the adapter to be an implementation detail of peerconnection.cc, therefor some stuff was moved, and the only tests covering this is now in peerconnection_rtp_unittest.cc. This is a reland of 6c7ec32bd63ab2b45d4d83ae1de817ee946b4d72 Original change's description: > SetRemoteDescriptionObserverInterface added. > > The new observer replaced SetSessionDescriptionObserver for > SetRemoteDescription. Unlike SetSessionDescriptionObserver, > SetRemoteDescriptionObserverInterface is invoked synchronously so > that the you can rely on the state of the PeerConnection to represent > the result of the SetRemoteDescription call in the callback. > > The new observer succeeds or fails with an RTCError. > > This deprecates the need for PeerConnectionObserver::OnAdd/RemoveTrack > and SetSessionDescriptionObserver, with the benefit that all media > object changes can be processed in a single callback by the application > in a synchronous callback. This will help Chromium keep objects in-sync > across layers and threads in a non-racy and straight-forward way, see > design doc (Proposal 2): > https://docs.google.com/a/google.com/document/d/1-cDDC82mgU5zrHacfFz720p3xwRtuBkOPSRchh07Ho0/edit?usp=sharing > > An adapter for SetSessionDescriptionObserver is added to allow calling > the old SetRemoteDescription signature and get the old behavior > (OnSuccess/OnFailure callback in a Post) until third parties switch. > > Bug: webrtc:8473 > Change-Id: I3d4eb60da6dd34615f2c9f384aeaf4634e648c99 > Reviewed-on: https://webrtc-review.googlesource.com/17523 > Commit-Queue: Henrik Boström <hbos@webrtc.org> > Reviewed-by: Peter Thatcher <pthatcher@webrtc.org> > Reviewed-by: Guido Urdaneta <guidou@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20841} TBR=pthatcher@webrtc.org Bug: webrtc:8473 Change-Id: If2b1a1929663b0e77fcc9c2ebeef043e6f73adf5 Reviewed-on: https://webrtc-review.googlesource.com/25640 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Guido Urdaneta <guidou@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20854}
2017-11-23 17:48:32 +01:00
TEST_F(PeerConnectionRtpCallbacksTest,
RemoveTrackWithStreamFiresOnRemoveTrack) {
Reland "Added PeerConnectionObserver::OnRemoveTrack." This reverts commit 6c0c55c31817ecfa32409424495eb68b31828c40. Reason for revert: Fixed the flake. Original change's description: > Revert "Added PeerConnectionObserver::OnRemoveTrack." > > This reverts commit ba97ba7af917d4152f5f3363aba1c1561c6673dc. > > Reason for revert: The new tests have caused several test failures on the test bots; the method FakeAudioMediaStreamTrack:GetSignalLevel, which is not supposed to be called is sometimes called anyway. > > Original change's description: > > Added PeerConnectionObserver::OnRemoveTrack. > > > > This corresponds to processing the removal of a remote track step of > > the spec, with processing the addition of a remote track already > > covered by OnAddTrack. > > https://w3c.github.io/webrtc-pc/#processing-remote-mediastreamtracks > > > > Bug: webrtc:8260, webrtc:8315 > > Change-Id: Ica8be92369733eb3cf1397fb60385d45a9b58700 > > Reviewed-on: https://webrtc-review.googlesource.com/4722 > > Commit-Queue: Henrik Boström <hbos@webrtc.org> > > Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> > > Reviewed-by: Steve Anton <steveanton@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#20214} > > TBR=steveanton@webrtc.org,deadbeef@webrtc.org,hbos@webrtc.org > > Change-Id: Id2d9533e27227254769b4280a8ff10a47313e714 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:8260, webrtc:8315 > Reviewed-on: https://webrtc-review.googlesource.com/7940 > Reviewed-by: Alex Loiko <aleloi@webrtc.org> > Commit-Queue: Alex Loiko <aleloi@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20218} TBR=steveanton@webrtc.org,deadbeef@webrtc.org,aleloi@webrtc.org,hbos@webrtc.org Change-Id: Iab7500bebf98535754b102874259de43831fff6b No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:8260, webrtc:8315 Reviewed-on: https://webrtc-review.googlesource.com/8180 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20227}
2017-10-10 10:05:16 -07:00
auto caller = CreatePeerConnection();
auto callee = CreatePeerConnection();
Revert "Add AddTransceiver and GetTransceivers to PeerConnection" This reverts commit f93d2800d9b0d5818a5a383def0aaef3d441df3a. Reason for revert: https://logs.chromium.org/v/?s=chromium%2Fbb%2Fchromium.webrtc.fyi%2Fios-device%2F5804%2F%2B%2Frecipes%2Fsteps%2Fcompile%2F0%2Fstdout Original change's description: > Add AddTransceiver and GetTransceivers to PeerConnection > > WebRTC 1.0 has added the transceiver API to PeerConnection. This > is the first step towards exposing this to WebRTC consumers. For > now, transceivers can be added and fetched but there is not yet > support for creating offers/answers or setting local/remote > descriptions. That support ("Unified Plan") will be added in > follow-up CLs. > > The transceiver API is currently only available if the application > opts in by specifying the kUnifiedPlan SDP semantics when creating > the PeerConnection. > > Bug: webrtc:7600 > Change-Id: I0b8ee24b489b45bb4c5f60b699bd20c61af01d8e > Reviewed-on: https://webrtc-review.googlesource.com/23880 > Commit-Queue: Steve Anton <steveanton@webrtc.org> > Reviewed-by: Peter Thatcher <pthatcher@webrtc.org> > Reviewed-by: Henrik Boström <hbos@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20896} TBR=steveanton@webrtc.org,zhihuang@webrtc.org,hbos@webrtc.org,pthatcher@webrtc.org Change-Id: Ie91ea4988dba25c20e2532114d3a9d859a932d4c No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:7600 Reviewed-on: https://webrtc-review.googlesource.com/26400 Reviewed-by: Steve Anton <steveanton@webrtc.org> Commit-Queue: Steve Anton <steveanton@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20897}
2017-11-27 20:55:38 +00:00
rtc::scoped_refptr<webrtc::AudioTrackInterface> audio_track(
Reland "Added PeerConnectionObserver::OnRemoveTrack." This reverts commit 6c0c55c31817ecfa32409424495eb68b31828c40. Reason for revert: Fixed the flake. Original change's description: > Revert "Added PeerConnectionObserver::OnRemoveTrack." > > This reverts commit ba97ba7af917d4152f5f3363aba1c1561c6673dc. > > Reason for revert: The new tests have caused several test failures on the test bots; the method FakeAudioMediaStreamTrack:GetSignalLevel, which is not supposed to be called is sometimes called anyway. > > Original change's description: > > Added PeerConnectionObserver::OnRemoveTrack. > > > > This corresponds to processing the removal of a remote track step of > > the spec, with processing the addition of a remote track already > > covered by OnAddTrack. > > https://w3c.github.io/webrtc-pc/#processing-remote-mediastreamtracks > > > > Bug: webrtc:8260, webrtc:8315 > > Change-Id: Ica8be92369733eb3cf1397fb60385d45a9b58700 > > Reviewed-on: https://webrtc-review.googlesource.com/4722 > > Commit-Queue: Henrik Boström <hbos@webrtc.org> > > Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> > > Reviewed-by: Steve Anton <steveanton@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#20214} > > TBR=steveanton@webrtc.org,deadbeef@webrtc.org,hbos@webrtc.org > > Change-Id: Id2d9533e27227254769b4280a8ff10a47313e714 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:8260, webrtc:8315 > Reviewed-on: https://webrtc-review.googlesource.com/7940 > Reviewed-by: Alex Loiko <aleloi@webrtc.org> > Commit-Queue: Alex Loiko <aleloi@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20218} TBR=steveanton@webrtc.org,deadbeef@webrtc.org,aleloi@webrtc.org,hbos@webrtc.org Change-Id: Iab7500bebf98535754b102874259de43831fff6b No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:8260, webrtc:8315 Reviewed-on: https://webrtc-review.googlesource.com/8180 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20227}
2017-10-10 10:05:16 -07:00
pc_factory_->CreateAudioTrack("audio_track", nullptr));
Revert "Add AddTransceiver and GetTransceivers to PeerConnection" This reverts commit f93d2800d9b0d5818a5a383def0aaef3d441df3a. Reason for revert: https://logs.chromium.org/v/?s=chromium%2Fbb%2Fchromium.webrtc.fyi%2Fios-device%2F5804%2F%2B%2Frecipes%2Fsteps%2Fcompile%2F0%2Fstdout Original change's description: > Add AddTransceiver and GetTransceivers to PeerConnection > > WebRTC 1.0 has added the transceiver API to PeerConnection. This > is the first step towards exposing this to WebRTC consumers. For > now, transceivers can be added and fetched but there is not yet > support for creating offers/answers or setting local/remote > descriptions. That support ("Unified Plan") will be added in > follow-up CLs. > > The transceiver API is currently only available if the application > opts in by specifying the kUnifiedPlan SDP semantics when creating > the PeerConnection. > > Bug: webrtc:7600 > Change-Id: I0b8ee24b489b45bb4c5f60b699bd20c61af01d8e > Reviewed-on: https://webrtc-review.googlesource.com/23880 > Commit-Queue: Steve Anton <steveanton@webrtc.org> > Reviewed-by: Peter Thatcher <pthatcher@webrtc.org> > Reviewed-by: Henrik Boström <hbos@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20896} TBR=steveanton@webrtc.org,zhihuang@webrtc.org,hbos@webrtc.org,pthatcher@webrtc.org Change-Id: Ie91ea4988dba25c20e2532114d3a9d859a932d4c No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:7600 Reviewed-on: https://webrtc-review.googlesource.com/26400 Reviewed-by: Steve Anton <steveanton@webrtc.org> Commit-Queue: Steve Anton <steveanton@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20897}
2017-11-27 20:55:38 +00:00
auto stream = webrtc::MediaStream::Create("audio_stream");
Reland "Added PeerConnectionObserver::OnRemoveTrack." This reverts commit 6c0c55c31817ecfa32409424495eb68b31828c40. Reason for revert: Fixed the flake. Original change's description: > Revert "Added PeerConnectionObserver::OnRemoveTrack." > > This reverts commit ba97ba7af917d4152f5f3363aba1c1561c6673dc. > > Reason for revert: The new tests have caused several test failures on the test bots; the method FakeAudioMediaStreamTrack:GetSignalLevel, which is not supposed to be called is sometimes called anyway. > > Original change's description: > > Added PeerConnectionObserver::OnRemoveTrack. > > > > This corresponds to processing the removal of a remote track step of > > the spec, with processing the addition of a remote track already > > covered by OnAddTrack. > > https://w3c.github.io/webrtc-pc/#processing-remote-mediastreamtracks > > > > Bug: webrtc:8260, webrtc:8315 > > Change-Id: Ica8be92369733eb3cf1397fb60385d45a9b58700 > > Reviewed-on: https://webrtc-review.googlesource.com/4722 > > Commit-Queue: Henrik Boström <hbos@webrtc.org> > > Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> > > Reviewed-by: Steve Anton <steveanton@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#20214} > > TBR=steveanton@webrtc.org,deadbeef@webrtc.org,hbos@webrtc.org > > Change-Id: Id2d9533e27227254769b4280a8ff10a47313e714 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:8260, webrtc:8315 > Reviewed-on: https://webrtc-review.googlesource.com/7940 > Reviewed-by: Alex Loiko <aleloi@webrtc.org> > Commit-Queue: Alex Loiko <aleloi@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20218} TBR=steveanton@webrtc.org,deadbeef@webrtc.org,aleloi@webrtc.org,hbos@webrtc.org Change-Id: Iab7500bebf98535754b102874259de43831fff6b No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:8260, webrtc:8315 Reviewed-on: https://webrtc-review.googlesource.com/8180 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20227}
2017-10-10 10:05:16 -07:00
auto sender = caller->pc()->AddTrack(audio_track.get(), {stream.get()});
Reland "SetRemoteDescriptionObserverInterface added." Description for changes from the original CL: Calling legacy SRD, implemented using SetRemoteDescriptionObserverAdapter wrapping the old observer, was meant to have the exact same behavior as the legacy SRD implementation which invokes the callbacks in a Post. However, in the CL that landed and got reverted (PS1), the Adapter had its own message handler, and callbacks would be invoked even if the PC was destroyed. In PS2 I've changed the Adapter to use the PeerConnection's message handler. If the PC is destroyed, the callback will not be invoked. This gives identical behavior to before this CL, and the legacy behavior is covered by a new unittest. I changed the adapter to be an implementation detail of peerconnection.cc, therefor some stuff was moved, and the only tests covering this is now in peerconnection_rtp_unittest.cc. This is a reland of 6c7ec32bd63ab2b45d4d83ae1de817ee946b4d72 Original change's description: > SetRemoteDescriptionObserverInterface added. > > The new observer replaced SetSessionDescriptionObserver for > SetRemoteDescription. Unlike SetSessionDescriptionObserver, > SetRemoteDescriptionObserverInterface is invoked synchronously so > that the you can rely on the state of the PeerConnection to represent > the result of the SetRemoteDescription call in the callback. > > The new observer succeeds or fails with an RTCError. > > This deprecates the need for PeerConnectionObserver::OnAdd/RemoveTrack > and SetSessionDescriptionObserver, with the benefit that all media > object changes can be processed in a single callback by the application > in a synchronous callback. This will help Chromium keep objects in-sync > across layers and threads in a non-racy and straight-forward way, see > design doc (Proposal 2): > https://docs.google.com/a/google.com/document/d/1-cDDC82mgU5zrHacfFz720p3xwRtuBkOPSRchh07Ho0/edit?usp=sharing > > An adapter for SetSessionDescriptionObserver is added to allow calling > the old SetRemoteDescription signature and get the old behavior > (OnSuccess/OnFailure callback in a Post) until third parties switch. > > Bug: webrtc:8473 > Change-Id: I3d4eb60da6dd34615f2c9f384aeaf4634e648c99 > Reviewed-on: https://webrtc-review.googlesource.com/17523 > Commit-Queue: Henrik Boström <hbos@webrtc.org> > Reviewed-by: Peter Thatcher <pthatcher@webrtc.org> > Reviewed-by: Guido Urdaneta <guidou@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20841} TBR=pthatcher@webrtc.org Bug: webrtc:8473 Change-Id: If2b1a1929663b0e77fcc9c2ebeef043e6f73adf5 Reviewed-on: https://webrtc-review.googlesource.com/25640 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Guido Urdaneta <guidou@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20854}
2017-11-23 17:48:32 +01:00
ASSERT_TRUE(
callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal(),
static_cast<webrtc::RTCError*>(nullptr)));
ASSERT_EQ(callee->observer()->add_track_events_.size(), 1u);
Reland "Added PeerConnectionObserver::OnRemoveTrack." This reverts commit 6c0c55c31817ecfa32409424495eb68b31828c40. Reason for revert: Fixed the flake. Original change's description: > Revert "Added PeerConnectionObserver::OnRemoveTrack." > > This reverts commit ba97ba7af917d4152f5f3363aba1c1561c6673dc. > > Reason for revert: The new tests have caused several test failures on the test bots; the method FakeAudioMediaStreamTrack:GetSignalLevel, which is not supposed to be called is sometimes called anyway. > > Original change's description: > > Added PeerConnectionObserver::OnRemoveTrack. > > > > This corresponds to processing the removal of a remote track step of > > the spec, with processing the addition of a remote track already > > covered by OnAddTrack. > > https://w3c.github.io/webrtc-pc/#processing-remote-mediastreamtracks > > > > Bug: webrtc:8260, webrtc:8315 > > Change-Id: Ica8be92369733eb3cf1397fb60385d45a9b58700 > > Reviewed-on: https://webrtc-review.googlesource.com/4722 > > Commit-Queue: Henrik Boström <hbos@webrtc.org> > > Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> > > Reviewed-by: Steve Anton <steveanton@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#20214} > > TBR=steveanton@webrtc.org,deadbeef@webrtc.org,hbos@webrtc.org > > Change-Id: Id2d9533e27227254769b4280a8ff10a47313e714 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:8260, webrtc:8315 > Reviewed-on: https://webrtc-review.googlesource.com/7940 > Reviewed-by: Alex Loiko <aleloi@webrtc.org> > Commit-Queue: Alex Loiko <aleloi@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20218} TBR=steveanton@webrtc.org,deadbeef@webrtc.org,aleloi@webrtc.org,hbos@webrtc.org Change-Id: Iab7500bebf98535754b102874259de43831fff6b No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:8260, webrtc:8315 Reviewed-on: https://webrtc-review.googlesource.com/8180 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20227}
2017-10-10 10:05:16 -07:00
EXPECT_TRUE(caller->pc()->RemoveTrack(sender));
Reland "SetRemoteDescriptionObserverInterface added." Description for changes from the original CL: Calling legacy SRD, implemented using SetRemoteDescriptionObserverAdapter wrapping the old observer, was meant to have the exact same behavior as the legacy SRD implementation which invokes the callbacks in a Post. However, in the CL that landed and got reverted (PS1), the Adapter had its own message handler, and callbacks would be invoked even if the PC was destroyed. In PS2 I've changed the Adapter to use the PeerConnection's message handler. If the PC is destroyed, the callback will not be invoked. This gives identical behavior to before this CL, and the legacy behavior is covered by a new unittest. I changed the adapter to be an implementation detail of peerconnection.cc, therefor some stuff was moved, and the only tests covering this is now in peerconnection_rtp_unittest.cc. This is a reland of 6c7ec32bd63ab2b45d4d83ae1de817ee946b4d72 Original change's description: > SetRemoteDescriptionObserverInterface added. > > The new observer replaced SetSessionDescriptionObserver for > SetRemoteDescription. Unlike SetSessionDescriptionObserver, > SetRemoteDescriptionObserverInterface is invoked synchronously so > that the you can rely on the state of the PeerConnection to represent > the result of the SetRemoteDescription call in the callback. > > The new observer succeeds or fails with an RTCError. > > This deprecates the need for PeerConnectionObserver::OnAdd/RemoveTrack > and SetSessionDescriptionObserver, with the benefit that all media > object changes can be processed in a single callback by the application > in a synchronous callback. This will help Chromium keep objects in-sync > across layers and threads in a non-racy and straight-forward way, see > design doc (Proposal 2): > https://docs.google.com/a/google.com/document/d/1-cDDC82mgU5zrHacfFz720p3xwRtuBkOPSRchh07Ho0/edit?usp=sharing > > An adapter for SetSessionDescriptionObserver is added to allow calling > the old SetRemoteDescription signature and get the old behavior > (OnSuccess/OnFailure callback in a Post) until third parties switch. > > Bug: webrtc:8473 > Change-Id: I3d4eb60da6dd34615f2c9f384aeaf4634e648c99 > Reviewed-on: https://webrtc-review.googlesource.com/17523 > Commit-Queue: Henrik Boström <hbos@webrtc.org> > Reviewed-by: Peter Thatcher <pthatcher@webrtc.org> > Reviewed-by: Guido Urdaneta <guidou@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20841} TBR=pthatcher@webrtc.org Bug: webrtc:8473 Change-Id: If2b1a1929663b0e77fcc9c2ebeef043e6f73adf5 Reviewed-on: https://webrtc-review.googlesource.com/25640 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Guido Urdaneta <guidou@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20854}
2017-11-23 17:48:32 +01:00
ASSERT_TRUE(
callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal(),
static_cast<webrtc::RTCError*>(nullptr)));
Reland "Added PeerConnectionObserver::OnRemoveTrack." This reverts commit 6c0c55c31817ecfa32409424495eb68b31828c40. Reason for revert: Fixed the flake. Original change's description: > Revert "Added PeerConnectionObserver::OnRemoveTrack." > > This reverts commit ba97ba7af917d4152f5f3363aba1c1561c6673dc. > > Reason for revert: The new tests have caused several test failures on the test bots; the method FakeAudioMediaStreamTrack:GetSignalLevel, which is not supposed to be called is sometimes called anyway. > > Original change's description: > > Added PeerConnectionObserver::OnRemoveTrack. > > > > This corresponds to processing the removal of a remote track step of > > the spec, with processing the addition of a remote track already > > covered by OnAddTrack. > > https://w3c.github.io/webrtc-pc/#processing-remote-mediastreamtracks > > > > Bug: webrtc:8260, webrtc:8315 > > Change-Id: Ica8be92369733eb3cf1397fb60385d45a9b58700 > > Reviewed-on: https://webrtc-review.googlesource.com/4722 > > Commit-Queue: Henrik Boström <hbos@webrtc.org> > > Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> > > Reviewed-by: Steve Anton <steveanton@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#20214} > > TBR=steveanton@webrtc.org,deadbeef@webrtc.org,hbos@webrtc.org > > Change-Id: Id2d9533e27227254769b4280a8ff10a47313e714 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:8260, webrtc:8315 > Reviewed-on: https://webrtc-review.googlesource.com/7940 > Reviewed-by: Alex Loiko <aleloi@webrtc.org> > Commit-Queue: Alex Loiko <aleloi@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20218} TBR=steveanton@webrtc.org,deadbeef@webrtc.org,aleloi@webrtc.org,hbos@webrtc.org Change-Id: Iab7500bebf98535754b102874259de43831fff6b No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:8260, webrtc:8315 Reviewed-on: https://webrtc-review.googlesource.com/8180 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20227}
2017-10-10 10:05:16 -07:00
Reland "SetRemoteDescriptionObserverInterface added." Description for changes from the original CL: Calling legacy SRD, implemented using SetRemoteDescriptionObserverAdapter wrapping the old observer, was meant to have the exact same behavior as the legacy SRD implementation which invokes the callbacks in a Post. However, in the CL that landed and got reverted (PS1), the Adapter had its own message handler, and callbacks would be invoked even if the PC was destroyed. In PS2 I've changed the Adapter to use the PeerConnection's message handler. If the PC is destroyed, the callback will not be invoked. This gives identical behavior to before this CL, and the legacy behavior is covered by a new unittest. I changed the adapter to be an implementation detail of peerconnection.cc, therefor some stuff was moved, and the only tests covering this is now in peerconnection_rtp_unittest.cc. This is a reland of 6c7ec32bd63ab2b45d4d83ae1de817ee946b4d72 Original change's description: > SetRemoteDescriptionObserverInterface added. > > The new observer replaced SetSessionDescriptionObserver for > SetRemoteDescription. Unlike SetSessionDescriptionObserver, > SetRemoteDescriptionObserverInterface is invoked synchronously so > that the you can rely on the state of the PeerConnection to represent > the result of the SetRemoteDescription call in the callback. > > The new observer succeeds or fails with an RTCError. > > This deprecates the need for PeerConnectionObserver::OnAdd/RemoveTrack > and SetSessionDescriptionObserver, with the benefit that all media > object changes can be processed in a single callback by the application > in a synchronous callback. This will help Chromium keep objects in-sync > across layers and threads in a non-racy and straight-forward way, see > design doc (Proposal 2): > https://docs.google.com/a/google.com/document/d/1-cDDC82mgU5zrHacfFz720p3xwRtuBkOPSRchh07Ho0/edit?usp=sharing > > An adapter for SetSessionDescriptionObserver is added to allow calling > the old SetRemoteDescription signature and get the old behavior > (OnSuccess/OnFailure callback in a Post) until third parties switch. > > Bug: webrtc:8473 > Change-Id: I3d4eb60da6dd34615f2c9f384aeaf4634e648c99 > Reviewed-on: https://webrtc-review.googlesource.com/17523 > Commit-Queue: Henrik Boström <hbos@webrtc.org> > Reviewed-by: Peter Thatcher <pthatcher@webrtc.org> > Reviewed-by: Guido Urdaneta <guidou@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20841} TBR=pthatcher@webrtc.org Bug: webrtc:8473 Change-Id: If2b1a1929663b0e77fcc9c2ebeef043e6f73adf5 Reviewed-on: https://webrtc-review.googlesource.com/25640 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Guido Urdaneta <guidou@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20854}
2017-11-23 17:48:32 +01:00
ASSERT_EQ(callee->observer()->add_track_events_.size(), 1u);
Reland "Added PeerConnectionObserver::OnRemoveTrack." This reverts commit 6c0c55c31817ecfa32409424495eb68b31828c40. Reason for revert: Fixed the flake. Original change's description: > Revert "Added PeerConnectionObserver::OnRemoveTrack." > > This reverts commit ba97ba7af917d4152f5f3363aba1c1561c6673dc. > > Reason for revert: The new tests have caused several test failures on the test bots; the method FakeAudioMediaStreamTrack:GetSignalLevel, which is not supposed to be called is sometimes called anyway. > > Original change's description: > > Added PeerConnectionObserver::OnRemoveTrack. > > > > This corresponds to processing the removal of a remote track step of > > the spec, with processing the addition of a remote track already > > covered by OnAddTrack. > > https://w3c.github.io/webrtc-pc/#processing-remote-mediastreamtracks > > > > Bug: webrtc:8260, webrtc:8315 > > Change-Id: Ica8be92369733eb3cf1397fb60385d45a9b58700 > > Reviewed-on: https://webrtc-review.googlesource.com/4722 > > Commit-Queue: Henrik Boström <hbos@webrtc.org> > > Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> > > Reviewed-by: Steve Anton <steveanton@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#20214} > > TBR=steveanton@webrtc.org,deadbeef@webrtc.org,hbos@webrtc.org > > Change-Id: Id2d9533e27227254769b4280a8ff10a47313e714 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:8260, webrtc:8315 > Reviewed-on: https://webrtc-review.googlesource.com/7940 > Reviewed-by: Alex Loiko <aleloi@webrtc.org> > Commit-Queue: Alex Loiko <aleloi@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20218} TBR=steveanton@webrtc.org,deadbeef@webrtc.org,aleloi@webrtc.org,hbos@webrtc.org Change-Id: Iab7500bebf98535754b102874259de43831fff6b No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:8260, webrtc:8315 Reviewed-on: https://webrtc-review.googlesource.com/8180 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20227}
2017-10-10 10:05:16 -07:00
EXPECT_EQ(callee->observer()->GetAddTrackReceivers(),
callee->observer()->remove_track_events_);
}
Reland "SetRemoteDescriptionObserverInterface added." Description for changes from the original CL: Calling legacy SRD, implemented using SetRemoteDescriptionObserverAdapter wrapping the old observer, was meant to have the exact same behavior as the legacy SRD implementation which invokes the callbacks in a Post. However, in the CL that landed and got reverted (PS1), the Adapter had its own message handler, and callbacks would be invoked even if the PC was destroyed. In PS2 I've changed the Adapter to use the PeerConnection's message handler. If the PC is destroyed, the callback will not be invoked. This gives identical behavior to before this CL, and the legacy behavior is covered by a new unittest. I changed the adapter to be an implementation detail of peerconnection.cc, therefor some stuff was moved, and the only tests covering this is now in peerconnection_rtp_unittest.cc. This is a reland of 6c7ec32bd63ab2b45d4d83ae1de817ee946b4d72 Original change's description: > SetRemoteDescriptionObserverInterface added. > > The new observer replaced SetSessionDescriptionObserver for > SetRemoteDescription. Unlike SetSessionDescriptionObserver, > SetRemoteDescriptionObserverInterface is invoked synchronously so > that the you can rely on the state of the PeerConnection to represent > the result of the SetRemoteDescription call in the callback. > > The new observer succeeds or fails with an RTCError. > > This deprecates the need for PeerConnectionObserver::OnAdd/RemoveTrack > and SetSessionDescriptionObserver, with the benefit that all media > object changes can be processed in a single callback by the application > in a synchronous callback. This will help Chromium keep objects in-sync > across layers and threads in a non-racy and straight-forward way, see > design doc (Proposal 2): > https://docs.google.com/a/google.com/document/d/1-cDDC82mgU5zrHacfFz720p3xwRtuBkOPSRchh07Ho0/edit?usp=sharing > > An adapter for SetSessionDescriptionObserver is added to allow calling > the old SetRemoteDescription signature and get the old behavior > (OnSuccess/OnFailure callback in a Post) until third parties switch. > > Bug: webrtc:8473 > Change-Id: I3d4eb60da6dd34615f2c9f384aeaf4634e648c99 > Reviewed-on: https://webrtc-review.googlesource.com/17523 > Commit-Queue: Henrik Boström <hbos@webrtc.org> > Reviewed-by: Peter Thatcher <pthatcher@webrtc.org> > Reviewed-by: Guido Urdaneta <guidou@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20841} TBR=pthatcher@webrtc.org Bug: webrtc:8473 Change-Id: If2b1a1929663b0e77fcc9c2ebeef043e6f73adf5 Reviewed-on: https://webrtc-review.googlesource.com/25640 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Guido Urdaneta <guidou@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20854}
2017-11-23 17:48:32 +01:00
TEST_F(PeerConnectionRtpCallbacksTest,
RemoveTrackWithSharedStreamFiresOnRemoveTrack) {
Reland "Added PeerConnectionObserver::OnRemoveTrack." This reverts commit 6c0c55c31817ecfa32409424495eb68b31828c40. Reason for revert: Fixed the flake. Original change's description: > Revert "Added PeerConnectionObserver::OnRemoveTrack." > > This reverts commit ba97ba7af917d4152f5f3363aba1c1561c6673dc. > > Reason for revert: The new tests have caused several test failures on the test bots; the method FakeAudioMediaStreamTrack:GetSignalLevel, which is not supposed to be called is sometimes called anyway. > > Original change's description: > > Added PeerConnectionObserver::OnRemoveTrack. > > > > This corresponds to processing the removal of a remote track step of > > the spec, with processing the addition of a remote track already > > covered by OnAddTrack. > > https://w3c.github.io/webrtc-pc/#processing-remote-mediastreamtracks > > > > Bug: webrtc:8260, webrtc:8315 > > Change-Id: Ica8be92369733eb3cf1397fb60385d45a9b58700 > > Reviewed-on: https://webrtc-review.googlesource.com/4722 > > Commit-Queue: Henrik Boström <hbos@webrtc.org> > > Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> > > Reviewed-by: Steve Anton <steveanton@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#20214} > > TBR=steveanton@webrtc.org,deadbeef@webrtc.org,hbos@webrtc.org > > Change-Id: Id2d9533e27227254769b4280a8ff10a47313e714 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:8260, webrtc:8315 > Reviewed-on: https://webrtc-review.googlesource.com/7940 > Reviewed-by: Alex Loiko <aleloi@webrtc.org> > Commit-Queue: Alex Loiko <aleloi@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20218} TBR=steveanton@webrtc.org,deadbeef@webrtc.org,aleloi@webrtc.org,hbos@webrtc.org Change-Id: Iab7500bebf98535754b102874259de43831fff6b No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:8260, webrtc:8315 Reviewed-on: https://webrtc-review.googlesource.com/8180 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20227}
2017-10-10 10:05:16 -07:00
auto caller = CreatePeerConnection();
auto callee = CreatePeerConnection();
Revert "Add AddTransceiver and GetTransceivers to PeerConnection" This reverts commit f93d2800d9b0d5818a5a383def0aaef3d441df3a. Reason for revert: https://logs.chromium.org/v/?s=chromium%2Fbb%2Fchromium.webrtc.fyi%2Fios-device%2F5804%2F%2B%2Frecipes%2Fsteps%2Fcompile%2F0%2Fstdout Original change's description: > Add AddTransceiver and GetTransceivers to PeerConnection > > WebRTC 1.0 has added the transceiver API to PeerConnection. This > is the first step towards exposing this to WebRTC consumers. For > now, transceivers can be added and fetched but there is not yet > support for creating offers/answers or setting local/remote > descriptions. That support ("Unified Plan") will be added in > follow-up CLs. > > The transceiver API is currently only available if the application > opts in by specifying the kUnifiedPlan SDP semantics when creating > the PeerConnection. > > Bug: webrtc:7600 > Change-Id: I0b8ee24b489b45bb4c5f60b699bd20c61af01d8e > Reviewed-on: https://webrtc-review.googlesource.com/23880 > Commit-Queue: Steve Anton <steveanton@webrtc.org> > Reviewed-by: Peter Thatcher <pthatcher@webrtc.org> > Reviewed-by: Henrik Boström <hbos@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20896} TBR=steveanton@webrtc.org,zhihuang@webrtc.org,hbos@webrtc.org,pthatcher@webrtc.org Change-Id: Ie91ea4988dba25c20e2532114d3a9d859a932d4c No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:7600 Reviewed-on: https://webrtc-review.googlesource.com/26400 Reviewed-by: Steve Anton <steveanton@webrtc.org> Commit-Queue: Steve Anton <steveanton@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20897}
2017-11-27 20:55:38 +00:00
rtc::scoped_refptr<webrtc::AudioTrackInterface> audio_track1(
Reland "Added PeerConnectionObserver::OnRemoveTrack." This reverts commit 6c0c55c31817ecfa32409424495eb68b31828c40. Reason for revert: Fixed the flake. Original change's description: > Revert "Added PeerConnectionObserver::OnRemoveTrack." > > This reverts commit ba97ba7af917d4152f5f3363aba1c1561c6673dc. > > Reason for revert: The new tests have caused several test failures on the test bots; the method FakeAudioMediaStreamTrack:GetSignalLevel, which is not supposed to be called is sometimes called anyway. > > Original change's description: > > Added PeerConnectionObserver::OnRemoveTrack. > > > > This corresponds to processing the removal of a remote track step of > > the spec, with processing the addition of a remote track already > > covered by OnAddTrack. > > https://w3c.github.io/webrtc-pc/#processing-remote-mediastreamtracks > > > > Bug: webrtc:8260, webrtc:8315 > > Change-Id: Ica8be92369733eb3cf1397fb60385d45a9b58700 > > Reviewed-on: https://webrtc-review.googlesource.com/4722 > > Commit-Queue: Henrik Boström <hbos@webrtc.org> > > Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> > > Reviewed-by: Steve Anton <steveanton@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#20214} > > TBR=steveanton@webrtc.org,deadbeef@webrtc.org,hbos@webrtc.org > > Change-Id: Id2d9533e27227254769b4280a8ff10a47313e714 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:8260, webrtc:8315 > Reviewed-on: https://webrtc-review.googlesource.com/7940 > Reviewed-by: Alex Loiko <aleloi@webrtc.org> > Commit-Queue: Alex Loiko <aleloi@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20218} TBR=steveanton@webrtc.org,deadbeef@webrtc.org,aleloi@webrtc.org,hbos@webrtc.org Change-Id: Iab7500bebf98535754b102874259de43831fff6b No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:8260, webrtc:8315 Reviewed-on: https://webrtc-review.googlesource.com/8180 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20227}
2017-10-10 10:05:16 -07:00
pc_factory_->CreateAudioTrack("audio_track1", nullptr));
Revert "Add AddTransceiver and GetTransceivers to PeerConnection" This reverts commit f93d2800d9b0d5818a5a383def0aaef3d441df3a. Reason for revert: https://logs.chromium.org/v/?s=chromium%2Fbb%2Fchromium.webrtc.fyi%2Fios-device%2F5804%2F%2B%2Frecipes%2Fsteps%2Fcompile%2F0%2Fstdout Original change's description: > Add AddTransceiver and GetTransceivers to PeerConnection > > WebRTC 1.0 has added the transceiver API to PeerConnection. This > is the first step towards exposing this to WebRTC consumers. For > now, transceivers can be added and fetched but there is not yet > support for creating offers/answers or setting local/remote > descriptions. That support ("Unified Plan") will be added in > follow-up CLs. > > The transceiver API is currently only available if the application > opts in by specifying the kUnifiedPlan SDP semantics when creating > the PeerConnection. > > Bug: webrtc:7600 > Change-Id: I0b8ee24b489b45bb4c5f60b699bd20c61af01d8e > Reviewed-on: https://webrtc-review.googlesource.com/23880 > Commit-Queue: Steve Anton <steveanton@webrtc.org> > Reviewed-by: Peter Thatcher <pthatcher@webrtc.org> > Reviewed-by: Henrik Boström <hbos@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20896} TBR=steveanton@webrtc.org,zhihuang@webrtc.org,hbos@webrtc.org,pthatcher@webrtc.org Change-Id: Ie91ea4988dba25c20e2532114d3a9d859a932d4c No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:7600 Reviewed-on: https://webrtc-review.googlesource.com/26400 Reviewed-by: Steve Anton <steveanton@webrtc.org> Commit-Queue: Steve Anton <steveanton@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20897}
2017-11-27 20:55:38 +00:00
rtc::scoped_refptr<webrtc::AudioTrackInterface> audio_track2(
Reland "Added PeerConnectionObserver::OnRemoveTrack." This reverts commit 6c0c55c31817ecfa32409424495eb68b31828c40. Reason for revert: Fixed the flake. Original change's description: > Revert "Added PeerConnectionObserver::OnRemoveTrack." > > This reverts commit ba97ba7af917d4152f5f3363aba1c1561c6673dc. > > Reason for revert: The new tests have caused several test failures on the test bots; the method FakeAudioMediaStreamTrack:GetSignalLevel, which is not supposed to be called is sometimes called anyway. > > Original change's description: > > Added PeerConnectionObserver::OnRemoveTrack. > > > > This corresponds to processing the removal of a remote track step of > > the spec, with processing the addition of a remote track already > > covered by OnAddTrack. > > https://w3c.github.io/webrtc-pc/#processing-remote-mediastreamtracks > > > > Bug: webrtc:8260, webrtc:8315 > > Change-Id: Ica8be92369733eb3cf1397fb60385d45a9b58700 > > Reviewed-on: https://webrtc-review.googlesource.com/4722 > > Commit-Queue: Henrik Boström <hbos@webrtc.org> > > Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> > > Reviewed-by: Steve Anton <steveanton@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#20214} > > TBR=steveanton@webrtc.org,deadbeef@webrtc.org,hbos@webrtc.org > > Change-Id: Id2d9533e27227254769b4280a8ff10a47313e714 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:8260, webrtc:8315 > Reviewed-on: https://webrtc-review.googlesource.com/7940 > Reviewed-by: Alex Loiko <aleloi@webrtc.org> > Commit-Queue: Alex Loiko <aleloi@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20218} TBR=steveanton@webrtc.org,deadbeef@webrtc.org,aleloi@webrtc.org,hbos@webrtc.org Change-Id: Iab7500bebf98535754b102874259de43831fff6b No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:8260, webrtc:8315 Reviewed-on: https://webrtc-review.googlesource.com/8180 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20227}
2017-10-10 10:05:16 -07:00
pc_factory_->CreateAudioTrack("audio_track2", nullptr));
Revert "Add AddTransceiver and GetTransceivers to PeerConnection" This reverts commit f93d2800d9b0d5818a5a383def0aaef3d441df3a. Reason for revert: https://logs.chromium.org/v/?s=chromium%2Fbb%2Fchromium.webrtc.fyi%2Fios-device%2F5804%2F%2B%2Frecipes%2Fsteps%2Fcompile%2F0%2Fstdout Original change's description: > Add AddTransceiver and GetTransceivers to PeerConnection > > WebRTC 1.0 has added the transceiver API to PeerConnection. This > is the first step towards exposing this to WebRTC consumers. For > now, transceivers can be added and fetched but there is not yet > support for creating offers/answers or setting local/remote > descriptions. That support ("Unified Plan") will be added in > follow-up CLs. > > The transceiver API is currently only available if the application > opts in by specifying the kUnifiedPlan SDP semantics when creating > the PeerConnection. > > Bug: webrtc:7600 > Change-Id: I0b8ee24b489b45bb4c5f60b699bd20c61af01d8e > Reviewed-on: https://webrtc-review.googlesource.com/23880 > Commit-Queue: Steve Anton <steveanton@webrtc.org> > Reviewed-by: Peter Thatcher <pthatcher@webrtc.org> > Reviewed-by: Henrik Boström <hbos@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20896} TBR=steveanton@webrtc.org,zhihuang@webrtc.org,hbos@webrtc.org,pthatcher@webrtc.org Change-Id: Ie91ea4988dba25c20e2532114d3a9d859a932d4c No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:7600 Reviewed-on: https://webrtc-review.googlesource.com/26400 Reviewed-by: Steve Anton <steveanton@webrtc.org> Commit-Queue: Steve Anton <steveanton@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20897}
2017-11-27 20:55:38 +00:00
auto stream = webrtc::MediaStream::Create("shared_audio_stream");
std::vector<webrtc::MediaStreamInterface*> streams{stream.get()};
Reland "Added PeerConnectionObserver::OnRemoveTrack." This reverts commit 6c0c55c31817ecfa32409424495eb68b31828c40. Reason for revert: Fixed the flake. Original change's description: > Revert "Added PeerConnectionObserver::OnRemoveTrack." > > This reverts commit ba97ba7af917d4152f5f3363aba1c1561c6673dc. > > Reason for revert: The new tests have caused several test failures on the test bots; the method FakeAudioMediaStreamTrack:GetSignalLevel, which is not supposed to be called is sometimes called anyway. > > Original change's description: > > Added PeerConnectionObserver::OnRemoveTrack. > > > > This corresponds to processing the removal of a remote track step of > > the spec, with processing the addition of a remote track already > > covered by OnAddTrack. > > https://w3c.github.io/webrtc-pc/#processing-remote-mediastreamtracks > > > > Bug: webrtc:8260, webrtc:8315 > > Change-Id: Ica8be92369733eb3cf1397fb60385d45a9b58700 > > Reviewed-on: https://webrtc-review.googlesource.com/4722 > > Commit-Queue: Henrik Boström <hbos@webrtc.org> > > Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> > > Reviewed-by: Steve Anton <steveanton@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#20214} > > TBR=steveanton@webrtc.org,deadbeef@webrtc.org,hbos@webrtc.org > > Change-Id: Id2d9533e27227254769b4280a8ff10a47313e714 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:8260, webrtc:8315 > Reviewed-on: https://webrtc-review.googlesource.com/7940 > Reviewed-by: Alex Loiko <aleloi@webrtc.org> > Commit-Queue: Alex Loiko <aleloi@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20218} TBR=steveanton@webrtc.org,deadbeef@webrtc.org,aleloi@webrtc.org,hbos@webrtc.org Change-Id: Iab7500bebf98535754b102874259de43831fff6b No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:8260, webrtc:8315 Reviewed-on: https://webrtc-review.googlesource.com/8180 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20227}
2017-10-10 10:05:16 -07:00
auto sender1 = caller->pc()->AddTrack(audio_track1.get(), streams);
auto sender2 = caller->pc()->AddTrack(audio_track2.get(), streams);
Reland "SetRemoteDescriptionObserverInterface added." Description for changes from the original CL: Calling legacy SRD, implemented using SetRemoteDescriptionObserverAdapter wrapping the old observer, was meant to have the exact same behavior as the legacy SRD implementation which invokes the callbacks in a Post. However, in the CL that landed and got reverted (PS1), the Adapter had its own message handler, and callbacks would be invoked even if the PC was destroyed. In PS2 I've changed the Adapter to use the PeerConnection's message handler. If the PC is destroyed, the callback will not be invoked. This gives identical behavior to before this CL, and the legacy behavior is covered by a new unittest. I changed the adapter to be an implementation detail of peerconnection.cc, therefor some stuff was moved, and the only tests covering this is now in peerconnection_rtp_unittest.cc. This is a reland of 6c7ec32bd63ab2b45d4d83ae1de817ee946b4d72 Original change's description: > SetRemoteDescriptionObserverInterface added. > > The new observer replaced SetSessionDescriptionObserver for > SetRemoteDescription. Unlike SetSessionDescriptionObserver, > SetRemoteDescriptionObserverInterface is invoked synchronously so > that the you can rely on the state of the PeerConnection to represent > the result of the SetRemoteDescription call in the callback. > > The new observer succeeds or fails with an RTCError. > > This deprecates the need for PeerConnectionObserver::OnAdd/RemoveTrack > and SetSessionDescriptionObserver, with the benefit that all media > object changes can be processed in a single callback by the application > in a synchronous callback. This will help Chromium keep objects in-sync > across layers and threads in a non-racy and straight-forward way, see > design doc (Proposal 2): > https://docs.google.com/a/google.com/document/d/1-cDDC82mgU5zrHacfFz720p3xwRtuBkOPSRchh07Ho0/edit?usp=sharing > > An adapter for SetSessionDescriptionObserver is added to allow calling > the old SetRemoteDescription signature and get the old behavior > (OnSuccess/OnFailure callback in a Post) until third parties switch. > > Bug: webrtc:8473 > Change-Id: I3d4eb60da6dd34615f2c9f384aeaf4634e648c99 > Reviewed-on: https://webrtc-review.googlesource.com/17523 > Commit-Queue: Henrik Boström <hbos@webrtc.org> > Reviewed-by: Peter Thatcher <pthatcher@webrtc.org> > Reviewed-by: Guido Urdaneta <guidou@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20841} TBR=pthatcher@webrtc.org Bug: webrtc:8473 Change-Id: If2b1a1929663b0e77fcc9c2ebeef043e6f73adf5 Reviewed-on: https://webrtc-review.googlesource.com/25640 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Guido Urdaneta <guidou@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20854}
2017-11-23 17:48:32 +01:00
ASSERT_TRUE(
callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal(),
static_cast<webrtc::RTCError*>(nullptr)));
Reland "Added PeerConnectionObserver::OnRemoveTrack." This reverts commit 6c0c55c31817ecfa32409424495eb68b31828c40. Reason for revert: Fixed the flake. Original change's description: > Revert "Added PeerConnectionObserver::OnRemoveTrack." > > This reverts commit ba97ba7af917d4152f5f3363aba1c1561c6673dc. > > Reason for revert: The new tests have caused several test failures on the test bots; the method FakeAudioMediaStreamTrack:GetSignalLevel, which is not supposed to be called is sometimes called anyway. > > Original change's description: > > Added PeerConnectionObserver::OnRemoveTrack. > > > > This corresponds to processing the removal of a remote track step of > > the spec, with processing the addition of a remote track already > > covered by OnAddTrack. > > https://w3c.github.io/webrtc-pc/#processing-remote-mediastreamtracks > > > > Bug: webrtc:8260, webrtc:8315 > > Change-Id: Ica8be92369733eb3cf1397fb60385d45a9b58700 > > Reviewed-on: https://webrtc-review.googlesource.com/4722 > > Commit-Queue: Henrik Boström <hbos@webrtc.org> > > Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> > > Reviewed-by: Steve Anton <steveanton@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#20214} > > TBR=steveanton@webrtc.org,deadbeef@webrtc.org,hbos@webrtc.org > > Change-Id: Id2d9533e27227254769b4280a8ff10a47313e714 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:8260, webrtc:8315 > Reviewed-on: https://webrtc-review.googlesource.com/7940 > Reviewed-by: Alex Loiko <aleloi@webrtc.org> > Commit-Queue: Alex Loiko <aleloi@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20218} TBR=steveanton@webrtc.org,deadbeef@webrtc.org,aleloi@webrtc.org,hbos@webrtc.org Change-Id: Iab7500bebf98535754b102874259de43831fff6b No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:8260, webrtc:8315 Reviewed-on: https://webrtc-review.googlesource.com/8180 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20227}
2017-10-10 10:05:16 -07:00
Reland "SetRemoteDescriptionObserverInterface added." Description for changes from the original CL: Calling legacy SRD, implemented using SetRemoteDescriptionObserverAdapter wrapping the old observer, was meant to have the exact same behavior as the legacy SRD implementation which invokes the callbacks in a Post. However, in the CL that landed and got reverted (PS1), the Adapter had its own message handler, and callbacks would be invoked even if the PC was destroyed. In PS2 I've changed the Adapter to use the PeerConnection's message handler. If the PC is destroyed, the callback will not be invoked. This gives identical behavior to before this CL, and the legacy behavior is covered by a new unittest. I changed the adapter to be an implementation detail of peerconnection.cc, therefor some stuff was moved, and the only tests covering this is now in peerconnection_rtp_unittest.cc. This is a reland of 6c7ec32bd63ab2b45d4d83ae1de817ee946b4d72 Original change's description: > SetRemoteDescriptionObserverInterface added. > > The new observer replaced SetSessionDescriptionObserver for > SetRemoteDescription. Unlike SetSessionDescriptionObserver, > SetRemoteDescriptionObserverInterface is invoked synchronously so > that the you can rely on the state of the PeerConnection to represent > the result of the SetRemoteDescription call in the callback. > > The new observer succeeds or fails with an RTCError. > > This deprecates the need for PeerConnectionObserver::OnAdd/RemoveTrack > and SetSessionDescriptionObserver, with the benefit that all media > object changes can be processed in a single callback by the application > in a synchronous callback. This will help Chromium keep objects in-sync > across layers and threads in a non-racy and straight-forward way, see > design doc (Proposal 2): > https://docs.google.com/a/google.com/document/d/1-cDDC82mgU5zrHacfFz720p3xwRtuBkOPSRchh07Ho0/edit?usp=sharing > > An adapter for SetSessionDescriptionObserver is added to allow calling > the old SetRemoteDescription signature and get the old behavior > (OnSuccess/OnFailure callback in a Post) until third parties switch. > > Bug: webrtc:8473 > Change-Id: I3d4eb60da6dd34615f2c9f384aeaf4634e648c99 > Reviewed-on: https://webrtc-review.googlesource.com/17523 > Commit-Queue: Henrik Boström <hbos@webrtc.org> > Reviewed-by: Peter Thatcher <pthatcher@webrtc.org> > Reviewed-by: Guido Urdaneta <guidou@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20841} TBR=pthatcher@webrtc.org Bug: webrtc:8473 Change-Id: If2b1a1929663b0e77fcc9c2ebeef043e6f73adf5 Reviewed-on: https://webrtc-review.googlesource.com/25640 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Guido Urdaneta <guidou@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20854}
2017-11-23 17:48:32 +01:00
ASSERT_EQ(callee->observer()->add_track_events_.size(), 2u);
Reland "Added PeerConnectionObserver::OnRemoveTrack." This reverts commit 6c0c55c31817ecfa32409424495eb68b31828c40. Reason for revert: Fixed the flake. Original change's description: > Revert "Added PeerConnectionObserver::OnRemoveTrack." > > This reverts commit ba97ba7af917d4152f5f3363aba1c1561c6673dc. > > Reason for revert: The new tests have caused several test failures on the test bots; the method FakeAudioMediaStreamTrack:GetSignalLevel, which is not supposed to be called is sometimes called anyway. > > Original change's description: > > Added PeerConnectionObserver::OnRemoveTrack. > > > > This corresponds to processing the removal of a remote track step of > > the spec, with processing the addition of a remote track already > > covered by OnAddTrack. > > https://w3c.github.io/webrtc-pc/#processing-remote-mediastreamtracks > > > > Bug: webrtc:8260, webrtc:8315 > > Change-Id: Ica8be92369733eb3cf1397fb60385d45a9b58700 > > Reviewed-on: https://webrtc-review.googlesource.com/4722 > > Commit-Queue: Henrik Boström <hbos@webrtc.org> > > Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> > > Reviewed-by: Steve Anton <steveanton@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#20214} > > TBR=steveanton@webrtc.org,deadbeef@webrtc.org,hbos@webrtc.org > > Change-Id: Id2d9533e27227254769b4280a8ff10a47313e714 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:8260, webrtc:8315 > Reviewed-on: https://webrtc-review.googlesource.com/7940 > Reviewed-by: Alex Loiko <aleloi@webrtc.org> > Commit-Queue: Alex Loiko <aleloi@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20218} TBR=steveanton@webrtc.org,deadbeef@webrtc.org,aleloi@webrtc.org,hbos@webrtc.org Change-Id: Iab7500bebf98535754b102874259de43831fff6b No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:8260, webrtc:8315 Reviewed-on: https://webrtc-review.googlesource.com/8180 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20227}
2017-10-10 10:05:16 -07:00
// Remove "audio_track1".
EXPECT_TRUE(caller->pc()->RemoveTrack(sender1));
Reland "SetRemoteDescriptionObserverInterface added." Description for changes from the original CL: Calling legacy SRD, implemented using SetRemoteDescriptionObserverAdapter wrapping the old observer, was meant to have the exact same behavior as the legacy SRD implementation which invokes the callbacks in a Post. However, in the CL that landed and got reverted (PS1), the Adapter had its own message handler, and callbacks would be invoked even if the PC was destroyed. In PS2 I've changed the Adapter to use the PeerConnection's message handler. If the PC is destroyed, the callback will not be invoked. This gives identical behavior to before this CL, and the legacy behavior is covered by a new unittest. I changed the adapter to be an implementation detail of peerconnection.cc, therefor some stuff was moved, and the only tests covering this is now in peerconnection_rtp_unittest.cc. This is a reland of 6c7ec32bd63ab2b45d4d83ae1de817ee946b4d72 Original change's description: > SetRemoteDescriptionObserverInterface added. > > The new observer replaced SetSessionDescriptionObserver for > SetRemoteDescription. Unlike SetSessionDescriptionObserver, > SetRemoteDescriptionObserverInterface is invoked synchronously so > that the you can rely on the state of the PeerConnection to represent > the result of the SetRemoteDescription call in the callback. > > The new observer succeeds or fails with an RTCError. > > This deprecates the need for PeerConnectionObserver::OnAdd/RemoveTrack > and SetSessionDescriptionObserver, with the benefit that all media > object changes can be processed in a single callback by the application > in a synchronous callback. This will help Chromium keep objects in-sync > across layers and threads in a non-racy and straight-forward way, see > design doc (Proposal 2): > https://docs.google.com/a/google.com/document/d/1-cDDC82mgU5zrHacfFz720p3xwRtuBkOPSRchh07Ho0/edit?usp=sharing > > An adapter for SetSessionDescriptionObserver is added to allow calling > the old SetRemoteDescription signature and get the old behavior > (OnSuccess/OnFailure callback in a Post) until third parties switch. > > Bug: webrtc:8473 > Change-Id: I3d4eb60da6dd34615f2c9f384aeaf4634e648c99 > Reviewed-on: https://webrtc-review.googlesource.com/17523 > Commit-Queue: Henrik Boström <hbos@webrtc.org> > Reviewed-by: Peter Thatcher <pthatcher@webrtc.org> > Reviewed-by: Guido Urdaneta <guidou@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20841} TBR=pthatcher@webrtc.org Bug: webrtc:8473 Change-Id: If2b1a1929663b0e77fcc9c2ebeef043e6f73adf5 Reviewed-on: https://webrtc-review.googlesource.com/25640 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Guido Urdaneta <guidou@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20854}
2017-11-23 17:48:32 +01:00
ASSERT_TRUE(
callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal(),
static_cast<webrtc::RTCError*>(nullptr)));
ASSERT_EQ(callee->observer()->add_track_events_.size(), 2u);
Reland "Added PeerConnectionObserver::OnRemoveTrack." This reverts commit 6c0c55c31817ecfa32409424495eb68b31828c40. Reason for revert: Fixed the flake. Original change's description: > Revert "Added PeerConnectionObserver::OnRemoveTrack." > > This reverts commit ba97ba7af917d4152f5f3363aba1c1561c6673dc. > > Reason for revert: The new tests have caused several test failures on the test bots; the method FakeAudioMediaStreamTrack:GetSignalLevel, which is not supposed to be called is sometimes called anyway. > > Original change's description: > > Added PeerConnectionObserver::OnRemoveTrack. > > > > This corresponds to processing the removal of a remote track step of > > the spec, with processing the addition of a remote track already > > covered by OnAddTrack. > > https://w3c.github.io/webrtc-pc/#processing-remote-mediastreamtracks > > > > Bug: webrtc:8260, webrtc:8315 > > Change-Id: Ica8be92369733eb3cf1397fb60385d45a9b58700 > > Reviewed-on: https://webrtc-review.googlesource.com/4722 > > Commit-Queue: Henrik Boström <hbos@webrtc.org> > > Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> > > Reviewed-by: Steve Anton <steveanton@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#20214} > > TBR=steveanton@webrtc.org,deadbeef@webrtc.org,hbos@webrtc.org > > Change-Id: Id2d9533e27227254769b4280a8ff10a47313e714 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:8260, webrtc:8315 > Reviewed-on: https://webrtc-review.googlesource.com/7940 > Reviewed-by: Alex Loiko <aleloi@webrtc.org> > Commit-Queue: Alex Loiko <aleloi@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20218} TBR=steveanton@webrtc.org,deadbeef@webrtc.org,aleloi@webrtc.org,hbos@webrtc.org Change-Id: Iab7500bebf98535754b102874259de43831fff6b No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:8260, webrtc:8315 Reviewed-on: https://webrtc-review.googlesource.com/8180 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20227}
2017-10-10 10:05:16 -07:00
EXPECT_EQ(
Revert "Add AddTransceiver and GetTransceivers to PeerConnection" This reverts commit f93d2800d9b0d5818a5a383def0aaef3d441df3a. Reason for revert: https://logs.chromium.org/v/?s=chromium%2Fbb%2Fchromium.webrtc.fyi%2Fios-device%2F5804%2F%2B%2Frecipes%2Fsteps%2Fcompile%2F0%2Fstdout Original change's description: > Add AddTransceiver and GetTransceivers to PeerConnection > > WebRTC 1.0 has added the transceiver API to PeerConnection. This > is the first step towards exposing this to WebRTC consumers. For > now, transceivers can be added and fetched but there is not yet > support for creating offers/answers or setting local/remote > descriptions. That support ("Unified Plan") will be added in > follow-up CLs. > > The transceiver API is currently only available if the application > opts in by specifying the kUnifiedPlan SDP semantics when creating > the PeerConnection. > > Bug: webrtc:7600 > Change-Id: I0b8ee24b489b45bb4c5f60b699bd20c61af01d8e > Reviewed-on: https://webrtc-review.googlesource.com/23880 > Commit-Queue: Steve Anton <steveanton@webrtc.org> > Reviewed-by: Peter Thatcher <pthatcher@webrtc.org> > Reviewed-by: Henrik Boström <hbos@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20896} TBR=steveanton@webrtc.org,zhihuang@webrtc.org,hbos@webrtc.org,pthatcher@webrtc.org Change-Id: Ie91ea4988dba25c20e2532114d3a9d859a932d4c No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:7600 Reviewed-on: https://webrtc-review.googlesource.com/26400 Reviewed-by: Steve Anton <steveanton@webrtc.org> Commit-Queue: Steve Anton <steveanton@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20897}
2017-11-27 20:55:38 +00:00
std::vector<rtc::scoped_refptr<webrtc::RtpReceiverInterface>>{
Reland "Added PeerConnectionObserver::OnRemoveTrack." This reverts commit 6c0c55c31817ecfa32409424495eb68b31828c40. Reason for revert: Fixed the flake. Original change's description: > Revert "Added PeerConnectionObserver::OnRemoveTrack." > > This reverts commit ba97ba7af917d4152f5f3363aba1c1561c6673dc. > > Reason for revert: The new tests have caused several test failures on the test bots; the method FakeAudioMediaStreamTrack:GetSignalLevel, which is not supposed to be called is sometimes called anyway. > > Original change's description: > > Added PeerConnectionObserver::OnRemoveTrack. > > > > This corresponds to processing the removal of a remote track step of > > the spec, with processing the addition of a remote track already > > covered by OnAddTrack. > > https://w3c.github.io/webrtc-pc/#processing-remote-mediastreamtracks > > > > Bug: webrtc:8260, webrtc:8315 > > Change-Id: Ica8be92369733eb3cf1397fb60385d45a9b58700 > > Reviewed-on: https://webrtc-review.googlesource.com/4722 > > Commit-Queue: Henrik Boström <hbos@webrtc.org> > > Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> > > Reviewed-by: Steve Anton <steveanton@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#20214} > > TBR=steveanton@webrtc.org,deadbeef@webrtc.org,hbos@webrtc.org > > Change-Id: Id2d9533e27227254769b4280a8ff10a47313e714 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:8260, webrtc:8315 > Reviewed-on: https://webrtc-review.googlesource.com/7940 > Reviewed-by: Alex Loiko <aleloi@webrtc.org> > Commit-Queue: Alex Loiko <aleloi@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20218} TBR=steveanton@webrtc.org,deadbeef@webrtc.org,aleloi@webrtc.org,hbos@webrtc.org Change-Id: Iab7500bebf98535754b102874259de43831fff6b No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:8260, webrtc:8315 Reviewed-on: https://webrtc-review.googlesource.com/8180 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20227}
2017-10-10 10:05:16 -07:00
callee->observer()->add_track_events_[0].receiver},
callee->observer()->remove_track_events_);
// Remove "audio_track2".
EXPECT_TRUE(caller->pc()->RemoveTrack(sender2));
Reland "SetRemoteDescriptionObserverInterface added." Description for changes from the original CL: Calling legacy SRD, implemented using SetRemoteDescriptionObserverAdapter wrapping the old observer, was meant to have the exact same behavior as the legacy SRD implementation which invokes the callbacks in a Post. However, in the CL that landed and got reverted (PS1), the Adapter had its own message handler, and callbacks would be invoked even if the PC was destroyed. In PS2 I've changed the Adapter to use the PeerConnection's message handler. If the PC is destroyed, the callback will not be invoked. This gives identical behavior to before this CL, and the legacy behavior is covered by a new unittest. I changed the adapter to be an implementation detail of peerconnection.cc, therefor some stuff was moved, and the only tests covering this is now in peerconnection_rtp_unittest.cc. This is a reland of 6c7ec32bd63ab2b45d4d83ae1de817ee946b4d72 Original change's description: > SetRemoteDescriptionObserverInterface added. > > The new observer replaced SetSessionDescriptionObserver for > SetRemoteDescription. Unlike SetSessionDescriptionObserver, > SetRemoteDescriptionObserverInterface is invoked synchronously so > that the you can rely on the state of the PeerConnection to represent > the result of the SetRemoteDescription call in the callback. > > The new observer succeeds or fails with an RTCError. > > This deprecates the need for PeerConnectionObserver::OnAdd/RemoveTrack > and SetSessionDescriptionObserver, with the benefit that all media > object changes can be processed in a single callback by the application > in a synchronous callback. This will help Chromium keep objects in-sync > across layers and threads in a non-racy and straight-forward way, see > design doc (Proposal 2): > https://docs.google.com/a/google.com/document/d/1-cDDC82mgU5zrHacfFz720p3xwRtuBkOPSRchh07Ho0/edit?usp=sharing > > An adapter for SetSessionDescriptionObserver is added to allow calling > the old SetRemoteDescription signature and get the old behavior > (OnSuccess/OnFailure callback in a Post) until third parties switch. > > Bug: webrtc:8473 > Change-Id: I3d4eb60da6dd34615f2c9f384aeaf4634e648c99 > Reviewed-on: https://webrtc-review.googlesource.com/17523 > Commit-Queue: Henrik Boström <hbos@webrtc.org> > Reviewed-by: Peter Thatcher <pthatcher@webrtc.org> > Reviewed-by: Guido Urdaneta <guidou@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20841} TBR=pthatcher@webrtc.org Bug: webrtc:8473 Change-Id: If2b1a1929663b0e77fcc9c2ebeef043e6f73adf5 Reviewed-on: https://webrtc-review.googlesource.com/25640 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Guido Urdaneta <guidou@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20854}
2017-11-23 17:48:32 +01:00
ASSERT_TRUE(
callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal(),
static_cast<webrtc::RTCError*>(nullptr)));
ASSERT_EQ(callee->observer()->add_track_events_.size(), 2u);
Reland "Added PeerConnectionObserver::OnRemoveTrack." This reverts commit 6c0c55c31817ecfa32409424495eb68b31828c40. Reason for revert: Fixed the flake. Original change's description: > Revert "Added PeerConnectionObserver::OnRemoveTrack." > > This reverts commit ba97ba7af917d4152f5f3363aba1c1561c6673dc. > > Reason for revert: The new tests have caused several test failures on the test bots; the method FakeAudioMediaStreamTrack:GetSignalLevel, which is not supposed to be called is sometimes called anyway. > > Original change's description: > > Added PeerConnectionObserver::OnRemoveTrack. > > > > This corresponds to processing the removal of a remote track step of > > the spec, with processing the addition of a remote track already > > covered by OnAddTrack. > > https://w3c.github.io/webrtc-pc/#processing-remote-mediastreamtracks > > > > Bug: webrtc:8260, webrtc:8315 > > Change-Id: Ica8be92369733eb3cf1397fb60385d45a9b58700 > > Reviewed-on: https://webrtc-review.googlesource.com/4722 > > Commit-Queue: Henrik Boström <hbos@webrtc.org> > > Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> > > Reviewed-by: Steve Anton <steveanton@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#20214} > > TBR=steveanton@webrtc.org,deadbeef@webrtc.org,hbos@webrtc.org > > Change-Id: Id2d9533e27227254769b4280a8ff10a47313e714 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:8260, webrtc:8315 > Reviewed-on: https://webrtc-review.googlesource.com/7940 > Reviewed-by: Alex Loiko <aleloi@webrtc.org> > Commit-Queue: Alex Loiko <aleloi@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20218} TBR=steveanton@webrtc.org,deadbeef@webrtc.org,aleloi@webrtc.org,hbos@webrtc.org Change-Id: Iab7500bebf98535754b102874259de43831fff6b No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:8260, webrtc:8315 Reviewed-on: https://webrtc-review.googlesource.com/8180 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20227}
2017-10-10 10:05:16 -07:00
EXPECT_EQ(callee->observer()->GetAddTrackReceivers(),
callee->observer()->remove_track_events_);
}
Reland "SetRemoteDescriptionObserverInterface added." Description for changes from the original CL: Calling legacy SRD, implemented using SetRemoteDescriptionObserverAdapter wrapping the old observer, was meant to have the exact same behavior as the legacy SRD implementation which invokes the callbacks in a Post. However, in the CL that landed and got reverted (PS1), the Adapter had its own message handler, and callbacks would be invoked even if the PC was destroyed. In PS2 I've changed the Adapter to use the PeerConnection's message handler. If the PC is destroyed, the callback will not be invoked. This gives identical behavior to before this CL, and the legacy behavior is covered by a new unittest. I changed the adapter to be an implementation detail of peerconnection.cc, therefor some stuff was moved, and the only tests covering this is now in peerconnection_rtp_unittest.cc. This is a reland of 6c7ec32bd63ab2b45d4d83ae1de817ee946b4d72 Original change's description: > SetRemoteDescriptionObserverInterface added. > > The new observer replaced SetSessionDescriptionObserver for > SetRemoteDescription. Unlike SetSessionDescriptionObserver, > SetRemoteDescriptionObserverInterface is invoked synchronously so > that the you can rely on the state of the PeerConnection to represent > the result of the SetRemoteDescription call in the callback. > > The new observer succeeds or fails with an RTCError. > > This deprecates the need for PeerConnectionObserver::OnAdd/RemoveTrack > and SetSessionDescriptionObserver, with the benefit that all media > object changes can be processed in a single callback by the application > in a synchronous callback. This will help Chromium keep objects in-sync > across layers and threads in a non-racy and straight-forward way, see > design doc (Proposal 2): > https://docs.google.com/a/google.com/document/d/1-cDDC82mgU5zrHacfFz720p3xwRtuBkOPSRchh07Ho0/edit?usp=sharing > > An adapter for SetSessionDescriptionObserver is added to allow calling > the old SetRemoteDescription signature and get the old behavior > (OnSuccess/OnFailure callback in a Post) until third parties switch. > > Bug: webrtc:8473 > Change-Id: I3d4eb60da6dd34615f2c9f384aeaf4634e648c99 > Reviewed-on: https://webrtc-review.googlesource.com/17523 > Commit-Queue: Henrik Boström <hbos@webrtc.org> > Reviewed-by: Peter Thatcher <pthatcher@webrtc.org> > Reviewed-by: Guido Urdaneta <guidou@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20841} TBR=pthatcher@webrtc.org Bug: webrtc:8473 Change-Id: If2b1a1929663b0e77fcc9c2ebeef043e6f73adf5 Reviewed-on: https://webrtc-review.googlesource.com/25640 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Guido Urdaneta <guidou@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20854}
2017-11-23 17:48:32 +01:00
// These tests examine the state of the peer connection as a result of
// performing SetRemoteDescription().
class PeerConnectionRtpObserverTest : public PeerConnectionRtpTest {};
TEST_F(PeerConnectionRtpObserverTest, AddSenderWithoutStreamAddsReceiver) {
auto caller = CreatePeerConnection();
auto callee = CreatePeerConnection();
rtc::scoped_refptr<webrtc::AudioTrackInterface> audio_track(
pc_factory_->CreateAudioTrack("audio_track", nullptr));
EXPECT_TRUE(caller->pc()->AddTrack(audio_track.get(), {}));
ASSERT_TRUE(
callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal(),
static_cast<webrtc::RTCError*>(nullptr)));
EXPECT_EQ(callee->pc()->GetReceivers().size(), 1u);
auto receiver_added = callee->pc()->GetReceivers()[0];
EXPECT_EQ("audio_track", receiver_added->track()->id());
// TODO(hbos): When "no stream" is handled correctly we would expect
// |receiver_added->streams()| to be empty. https://crbug.com/webrtc/7933
EXPECT_EQ(receiver_added->streams().size(), 1u);
EXPECT_TRUE(receiver_added->streams()[0]->FindAudioTrack("audio_track"));
}
TEST_F(PeerConnectionRtpObserverTest, AddSenderWithStreamAddsReceiver) {
auto caller = CreatePeerConnection();
auto callee = CreatePeerConnection();
rtc::scoped_refptr<webrtc::AudioTrackInterface> audio_track(
pc_factory_->CreateAudioTrack("audio_track", nullptr));
auto stream = webrtc::MediaStream::Create("audio_stream");
EXPECT_TRUE(caller->pc()->AddTrack(audio_track.get(), {stream}));
ASSERT_TRUE(
callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal(),
static_cast<webrtc::RTCError*>(nullptr)));
EXPECT_EQ(callee->pc()->GetReceivers().size(), 1u);
auto receiver_added = callee->pc()->GetReceivers()[0];
EXPECT_EQ("audio_track", receiver_added->track()->id());
EXPECT_EQ(receiver_added->streams().size(), 1u);
EXPECT_EQ("audio_stream", receiver_added->streams()[0]->label());
EXPECT_TRUE(receiver_added->streams()[0]->FindAudioTrack("audio_track"));
}
TEST_F(PeerConnectionRtpObserverTest,
RemoveSenderWithoutStreamRemovesReceiver) {
auto caller = CreatePeerConnection();
auto callee = CreatePeerConnection();
rtc::scoped_refptr<webrtc::AudioTrackInterface> audio_track(
pc_factory_->CreateAudioTrack("audio_track", nullptr));
auto sender = caller->pc()->AddTrack(audio_track.get(), {});
ASSERT_TRUE(sender);
ASSERT_TRUE(
callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal(),
static_cast<webrtc::RTCError*>(nullptr)));
ASSERT_EQ(callee->pc()->GetReceivers().size(), 1u);
auto receiver = callee->pc()->GetReceivers()[0];
ASSERT_TRUE(caller->pc()->RemoveTrack(sender));
ASSERT_TRUE(
callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal(),
static_cast<webrtc::RTCError*>(nullptr)));
// TODO(hbos): When we implement Unified Plan, receivers will not be removed.
// Instead, the transceiver owning the receiver will become inactive.
EXPECT_EQ(callee->pc()->GetReceivers().size(), 0u);
}
TEST_F(PeerConnectionRtpObserverTest, RemoveSenderWithStreamRemovesReceiver) {
auto caller = CreatePeerConnection();
auto callee = CreatePeerConnection();
rtc::scoped_refptr<webrtc::AudioTrackInterface> audio_track(
pc_factory_->CreateAudioTrack("audio_track", nullptr));
auto stream = webrtc::MediaStream::Create("audio_stream");
auto sender = caller->pc()->AddTrack(audio_track.get(), {stream});
ASSERT_TRUE(sender);
ASSERT_TRUE(
callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal(),
static_cast<webrtc::RTCError*>(nullptr)));
ASSERT_EQ(callee->pc()->GetReceivers().size(), 1u);
auto receiver = callee->pc()->GetReceivers()[0];
ASSERT_TRUE(caller->pc()->RemoveTrack(sender));
ASSERT_TRUE(
callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal(),
static_cast<webrtc::RTCError*>(nullptr)));
// TODO(hbos): When we implement Unified Plan, receivers will not be removed.
// Instead, the transceiver owning the receiver will become inactive.
EXPECT_EQ(callee->pc()->GetReceivers().size(), 0u);
}
TEST_F(PeerConnectionRtpObserverTest,
RemoveSenderWithSharedStreamRemovesReceiver) {
auto caller = CreatePeerConnection();
auto callee = CreatePeerConnection();
rtc::scoped_refptr<webrtc::AudioTrackInterface> audio_track1(
pc_factory_->CreateAudioTrack("audio_track1", nullptr));
rtc::scoped_refptr<webrtc::AudioTrackInterface> audio_track2(
pc_factory_->CreateAudioTrack("audio_track2", nullptr));
auto stream = webrtc::MediaStream::Create("shared_audio_stream");
std::vector<webrtc::MediaStreamInterface*> streams{stream.get()};
auto sender1 = caller->pc()->AddTrack(audio_track1.get(), streams);
auto sender2 = caller->pc()->AddTrack(audio_track2.get(), streams);
ASSERT_TRUE(
callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal(),
static_cast<webrtc::RTCError*>(nullptr)));
ASSERT_EQ(callee->pc()->GetReceivers().size(), 2u);
rtc::scoped_refptr<webrtc::RtpReceiverInterface> receiver1;
rtc::scoped_refptr<webrtc::RtpReceiverInterface> receiver2;
if (callee->pc()->GetReceivers()[0]->track()->id() == "audio_track1") {
receiver1 = callee->pc()->GetReceivers()[0];
receiver2 = callee->pc()->GetReceivers()[1];
} else {
receiver1 = callee->pc()->GetReceivers()[1];
receiver2 = callee->pc()->GetReceivers()[0];
}
EXPECT_EQ("audio_track1", receiver1->track()->id());
EXPECT_EQ("audio_track2", receiver2->track()->id());
// Remove "audio_track1".
EXPECT_TRUE(caller->pc()->RemoveTrack(sender1));
ASSERT_TRUE(
callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal(),
static_cast<webrtc::RTCError*>(nullptr)));
// Only |receiver2| should remain.
// TODO(hbos): When we implement Unified Plan, receivers will not be removed.
// Instead, the transceiver owning the receiver will become inactive.
EXPECT_EQ(
std::vector<rtc::scoped_refptr<webrtc::RtpReceiverInterface>>{receiver2},
callee->pc()->GetReceivers());
// Remove "audio_track2".
EXPECT_TRUE(caller->pc()->RemoveTrack(sender2));
ASSERT_TRUE(
callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal(),
static_cast<webrtc::RTCError*>(nullptr)));
// TODO(hbos): When we implement Unified Plan, receivers will not be removed.
// Instead, the transceiver owning the receiver will become inactive.
EXPECT_EQ(callee->pc()->GetReceivers().size(), 0u);
}
// Invokes SetRemoteDescription() twice in a row without synchronizing the two
// calls and examine the state of the peer connection inside the callbacks to
// ensure that the second call does not occur prematurely, contaminating the
// state of the peer connection of the first callback.
TEST_F(PeerConnectionRtpObserverTest,
StatesCorrelateWithSetRemoteDescriptionCall) {
auto caller = CreatePeerConnection();
auto callee = CreatePeerConnection();
rtc::scoped_refptr<webrtc::AudioTrackInterface> audio_track(
pc_factory_->CreateAudioTrack("audio_track", nullptr));
// Create SDP for adding a track and for removing it. This will be used in the
// first and second SetRemoteDescription() calls.
auto sender = caller->pc()->AddTrack(audio_track.get(), {});
auto srd1_sdp = caller->CreateOfferAndSetAsLocal();
EXPECT_TRUE(caller->pc()->RemoveTrack(sender));
auto srd2_sdp = caller->CreateOfferAndSetAsLocal();
// In the first SetRemoteDescription() callback, check that we have a
// receiver for the track.
auto pc = callee->pc();
bool srd1_callback_called = false;
auto srd1_callback = [&srd1_callback_called, &pc]() {
EXPECT_EQ(pc->GetReceivers().size(), 1u);
srd1_callback_called = true;
};
// In the second SetRemoteDescription() callback, check that the receiver has
// been removed.
// TODO(hbos): When we implement Unified Plan, receivers will not be removed.
// Instead, the transceiver owning the receiver will become inactive.
// https://crbug.com/webrtc/7600
bool srd2_callback_called = false;
auto srd2_callback = [&srd2_callback_called, &pc]() {
EXPECT_TRUE(pc->GetReceivers().empty());
srd2_callback_called = true;
};
// Invoke SetRemoteDescription() twice in a row without synchronizing the two
// calls. The callbacks verify that the two calls are synchronized, as in, the
// effects of the second SetRemoteDescription() call must not have happened by
// the time the first callback is invoked. If it has then the receiver that is
// added as a result of the first SetRemoteDescription() call will already
// have been removed as a result of the second SetRemoteDescription() call
// when the first callback is invoked.
callee->pc()->SetRemoteDescription(
std::move(srd1_sdp),
new OnSuccessObserver<decltype(srd1_callback)>(srd1_callback));
callee->pc()->SetRemoteDescription(
std::move(srd2_sdp),
new OnSuccessObserver<decltype(srd2_callback)>(srd2_callback));
EXPECT_TRUE_WAIT(srd1_callback_called, kDefaultTimeout);
EXPECT_TRUE_WAIT(srd2_callback_called, kDefaultTimeout);
}
// Tests for the legacy SetRemoteDescription() function signature.
class PeerConnectionRtpLegacyObserverTest : public PeerConnectionRtpTest {};
// Sanity test making sure the callback is invoked.
TEST_F(PeerConnectionRtpLegacyObserverTest, OnSuccess) {
auto caller = CreatePeerConnection();
auto callee = CreatePeerConnection();
std::string error;
ASSERT_TRUE(
callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal(), &error));
}
// Verifies legacy behavior: The observer is not called if if the peer
// connection is destroyed because the asynchronous callback is executed in the
// peer connection's message handler.
TEST_F(PeerConnectionRtpLegacyObserverTest,
ObserverNotCalledIfPeerConnectionDereferenced) {
auto caller = CreatePeerConnection();
auto callee = CreatePeerConnection();
rtc::scoped_refptr<webrtc::MockSetSessionDescriptionObserver> observer =
new rtc::RefCountedObject<webrtc::MockSetSessionDescriptionObserver>();
auto offer = caller->CreateOfferAndSetAsLocal();
callee->pc()->SetRemoteDescription(observer, offer.release());
callee = nullptr;
rtc::Thread::Current()->ProcessMessages(0);
EXPECT_FALSE(observer->called());
}
Revert "Add AddTransceiver and GetTransceivers to PeerConnection" This reverts commit f93d2800d9b0d5818a5a383def0aaef3d441df3a. Reason for revert: https://logs.chromium.org/v/?s=chromium%2Fbb%2Fchromium.webrtc.fyi%2Fios-device%2F5804%2F%2B%2Frecipes%2Fsteps%2Fcompile%2F0%2Fstdout Original change's description: > Add AddTransceiver and GetTransceivers to PeerConnection > > WebRTC 1.0 has added the transceiver API to PeerConnection. This > is the first step towards exposing this to WebRTC consumers. For > now, transceivers can be added and fetched but there is not yet > support for creating offers/answers or setting local/remote > descriptions. That support ("Unified Plan") will be added in > follow-up CLs. > > The transceiver API is currently only available if the application > opts in by specifying the kUnifiedPlan SDP semantics when creating > the PeerConnection. > > Bug: webrtc:7600 > Change-Id: I0b8ee24b489b45bb4c5f60b699bd20c61af01d8e > Reviewed-on: https://webrtc-review.googlesource.com/23880 > Commit-Queue: Steve Anton <steveanton@webrtc.org> > Reviewed-by: Peter Thatcher <pthatcher@webrtc.org> > Reviewed-by: Henrik Boström <hbos@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20896} TBR=steveanton@webrtc.org,zhihuang@webrtc.org,hbos@webrtc.org,pthatcher@webrtc.org Change-Id: Ie91ea4988dba25c20e2532114d3a9d859a932d4c No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:7600 Reviewed-on: https://webrtc-review.googlesource.com/26400 Reviewed-by: Steve Anton <steveanton@webrtc.org> Commit-Queue: Steve Anton <steveanton@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20897}
2017-11-27 20:55:38 +00:00
} // namespace