From 53df88c1bcd42d79d178f8c8da8d4d620f1c12cf Mon Sep 17 00:00:00 2001 From: "buildbot@webrtc.org" Date: Thu, 7 Aug 2014 22:46:01 +0000 Subject: [PATCH] (Auto)update libjingle 72847605-> 72850595 git-svn-id: http://webrtc.googlecode.com/svn/trunk@6855 4adac7df-926f-26a2-2b94-8c16560cd09d --- talk/app/webrtc/mediaconstraintsinterface.cc | 2 ++ talk/app/webrtc/mediaconstraintsinterface.h | 2 ++ talk/app/webrtc/webrtcsession.cc | 13 ++++++++ talk/app/webrtc/webrtcsession.h | 3 ++ talk/app/webrtc/webrtcsession_unittest.cc | 32 ++++++++++++++++++++ 5 files changed, 52 insertions(+) diff --git a/talk/app/webrtc/mediaconstraintsinterface.cc b/talk/app/webrtc/mediaconstraintsinterface.cc index 874ce64a71..74f6542eac 100644 --- a/talk/app/webrtc/mediaconstraintsinterface.cc +++ b/talk/app/webrtc/mediaconstraintsinterface.cc @@ -95,6 +95,8 @@ const char MediaConstraintsInterface::kEnableVideoSuspendBelowMinBitrate[] = "googSuspendBelowMinBitrate"; const char MediaConstraintsInterface::kImprovedWifiBwe[] = "googImprovedWifiBwe"; +const char MediaConstraintsInterface::kNumUnsignalledRecvStreams[] = + "googNumUnsignalledRecvStreams"; const char MediaConstraintsInterface::kScreencastMinBitrate[] = "googScreencastMinBitrate"; // TODO(ronghuawu): Remove once cpu overuse detection is stable. diff --git a/talk/app/webrtc/mediaconstraintsinterface.h b/talk/app/webrtc/mediaconstraintsinterface.h index 1304d88d43..b3efbb39f0 100644 --- a/talk/app/webrtc/mediaconstraintsinterface.h +++ b/talk/app/webrtc/mediaconstraintsinterface.h @@ -116,6 +116,8 @@ class MediaConstraintsInterface { static const char kEnableVideoSuspendBelowMinBitrate[]; // googSuspendBelowMinBitrate static const char kImprovedWifiBwe[]; // googImprovedWifiBwe + static const char kNumUnsignalledRecvStreams[]; + // googNumUnsignalledRecvStreams static const char kScreencastMinBitrate[]; // googScreencastMinBitrate static const char kCpuOveruseDetection[]; // googCpuOveruseDetection static const char kCpuUnderuseThreshold[]; // googCpuUnderuseThreshold diff --git a/talk/app/webrtc/webrtcsession.cc b/talk/app/webrtc/webrtcsession.cc index 3add7e17e3..7357a617b8 100644 --- a/talk/app/webrtc/webrtcsession.cc +++ b/talk/app/webrtc/webrtcsession.cc @@ -38,6 +38,7 @@ #include "talk/app/webrtc/mediastreamsignaling.h" #include "talk/app/webrtc/peerconnectioninterface.h" #include "talk/app/webrtc/webrtcsessiondescriptionfactory.h" +#include "webrtc/base/basictypes.h" #include "webrtc/base/helpers.h" #include "webrtc/base/logging.h" #include "webrtc/base/stringencode.h" @@ -74,6 +75,7 @@ const char kSdpWithoutIceUfragPwd[] = "Called with SDP without ice-ufrag and ice-pwd."; const char kSessionError[] = "Session error code: "; const char kSessionErrorDesc[] = "Session error description: "; +const int kMaxUnsignalledRecvStreams = 20; // Compares |answer| against |offer|. Comparision is done // for number of m-lines in answer against offer. If matches true will be @@ -589,6 +591,17 @@ bool WebRtcSession::Initialize( video_options_.use_improved_wifi_bandwidth_estimator.Set(true); } + SetOptionFromOptionalConstraint(constraints, + MediaConstraintsInterface::kNumUnsignalledRecvStreams, + &video_options_.unsignalled_recv_stream_limit); + if (video_options_.unsignalled_recv_stream_limit.IsSet()) { + int stream_limit; + video_options_.unsignalled_recv_stream_limit.Get(&stream_limit); + stream_limit = rtc::_min(kMaxUnsignalledRecvStreams, stream_limit); + stream_limit = rtc::_max(0, stream_limit); + video_options_.unsignalled_recv_stream_limit.Set(stream_limit); + } + SetOptionFromOptionalConstraint(constraints, MediaConstraintsInterface::kHighStartBitrate, &video_options_.video_start_bitrate); diff --git a/talk/app/webrtc/webrtcsession.h b/talk/app/webrtc/webrtcsession.h index f5de9797e5..564676dfd1 100644 --- a/talk/app/webrtc/webrtcsession.h +++ b/talk/app/webrtc/webrtcsession.h @@ -73,6 +73,9 @@ extern const char kSdpWithoutIceUfragPwd[]; extern const char kSdpWithoutSdesAndDtlsDisabled[]; extern const char kSessionError[]; extern const char kSessionErrorDesc[]; +// Maximum number of received video streams that will be processed by webrtc +// even if they are not signalled beforehand. +extern const int kMaxUnsignalledRecvStreams; // ICE state callback interface. class IceObserver { diff --git a/talk/app/webrtc/webrtcsession_unittest.cc b/talk/app/webrtc/webrtcsession_unittest.cc index b5e1ddad01..8bc8e8dca9 100644 --- a/talk/app/webrtc/webrtcsession_unittest.cc +++ b/talk/app/webrtc/webrtcsession_unittest.cc @@ -98,6 +98,7 @@ using webrtc::kSdpWithoutDtlsFingerprint; using webrtc::kSdpWithoutSdesCrypto; using webrtc::kSessionError; using webrtc::kSessionErrorDesc; +using webrtc::kMaxUnsignalledRecvStreams; typedef PeerConnectionInterface::RTCOfferAnswerOptions RTCOfferAnswerOptions; @@ -537,6 +538,28 @@ class WebRtcSessionTest : public testing::Test { VerifyCryptoParams(answer->description()); } + void SetAndVerifyNumUnsignalledRecvStreams( + int value_set, int value_expected) { + constraints_.reset(new FakeConstraints()); + constraints_->AddOptional( + webrtc::MediaConstraintsInterface::kNumUnsignalledRecvStreams, + value_set); + session_.reset(); + Init(NULL); + mediastream_signaling_.SendAudioVideoStream1(); + SessionDescriptionInterface* offer = CreateOffer(); + + SetLocalDescriptionWithoutError(offer); + + video_channel_ = media_engine_->GetVideoChannel(0); + + ASSERT_TRUE(video_channel_ != NULL); + cricket::VideoOptions video_options; + EXPECT_TRUE(video_channel_->GetOptions(&video_options)); + EXPECT_EQ(value_expected, + video_options.unsignalled_recv_stream_limit.GetWithDefaultIfUnset(-1)); + } + void CompareIceUfragAndPassword(const cricket::SessionDescription* desc1, const cricket::SessionDescription* desc2, bool expect_equal) { @@ -3279,6 +3302,15 @@ TEST_F(WebRtcSessionTest, TestSuspendBelowMinBitrateConstraint) { video_options.suspend_below_min_bitrate.GetWithDefaultIfUnset(false)); } +TEST_F(WebRtcSessionTest, TestNumUnsignalledRecvStreamsConstraint) { + // Number of unsignalled receiving streams should be between 0 and + // kMaxUnsignalledRecvStreams. + SetAndVerifyNumUnsignalledRecvStreams(10, 10); + SetAndVerifyNumUnsignalledRecvStreams(kMaxUnsignalledRecvStreams + 1, + kMaxUnsignalledRecvStreams); + SetAndVerifyNumUnsignalledRecvStreams(-1, 0); +} + // Tests that we can renegotiate new media content with ICE candidates in the // new remote SDP. TEST_F(WebRtcSessionTest, TestRenegotiateNewMediaWithCandidatesInSdp) {