Bug 1373450: report if MaxMessageSize was set in SDP. r=jesup

MozReview-Commit-ID: OqspJsw1Bw

--HG--
extra : rebase_source : ff9c5883e6d9f284c7f0771f937d48f48910b508
This commit is contained in:
Nils Ohlmeier [:drno] 2017-06-15 16:12:25 -07:00
Родитель a55c46f192
Коммит 6cdb6b786c
5 изменённых файлов: 27 добавлений и 15 удалений

Просмотреть файл

@ -814,17 +814,17 @@ class JsepApplicationCodecDescription : public JsepCodecDescription {
{
JsepCodecDescription::Negotiate(pt, remoteMsection);
uint32_t message_size = remoteMsection.GetMaxMessageSize();
if (message_size) {
uint32_t message_size;
mRemoteMMSSet = remoteMsection.GetMaxMessageSize(&message_size);
if (mRemoteMMSSet) {
mRemoteMaxMessageSize = message_size;
} else {
mRemoteMaxMessageSize = WEBRTC_DATACHANELL_MAX_MESSAGE_SIZE_DEFAULT;
}
int sctp_port = remoteMsection.GetSctpPort();
if (sctp_port) {
mRemotePort = sctp_port;
if (!message_size) {
mRemoteMaxMessageSize = WEBRTC_DATACHANELL_MAX_MESSAGE_SIZE_DEFAULT;
}
return true;
}
@ -843,6 +843,7 @@ class JsepApplicationCodecDescription : public JsepCodecDescription {
uint32_t mLocalMaxMessageSize;
uint16_t mRemotePort;
uint32_t mRemoteMaxMessageSize;
bool mRemoteMMSSet;
};
} // namespace mozilla

Просмотреть файл

@ -1084,7 +1084,8 @@ PeerConnectionImpl::ConfigureJsepSessionCodecs() {
NS_IMETHODIMP
PeerConnectionImpl::EnsureDataConnection(uint16_t aLocalPort,
uint16_t aNumstreams,
uint32_t aMaxMessageSize)
uint32_t aMaxMessageSize,
bool aMMSSet)
{
PC_AUTO_ENTER_API_CALL(false);
@ -1111,6 +1112,7 @@ PeerConnectionImpl::GetDatachannelParameters(
uint16_t* localport,
uint16_t* remoteport,
uint32_t* remotemaxmessagesize,
bool* mmsset,
uint16_t* level) const {
auto trackPairs = mJsepSession->GetNegotiatedTrackPairs();
@ -1165,6 +1167,8 @@ PeerConnectionImpl::GetDatachannelParameters(
static_cast<const JsepApplicationCodecDescription*>(codec)->mRemotePort;
*remotemaxmessagesize = static_cast<const JsepApplicationCodecDescription*>
(codec)->mRemoteMaxMessageSize;
*mmsset = static_cast<const JsepApplicationCodecDescription*>
(codec)->mRemoteMMSSet;
if (trackPair.HasBundleLevel()) {
*level = static_cast<uint16_t>(trackPair.BundleLevel());
} else {
@ -1179,6 +1183,7 @@ PeerConnectionImpl::GetDatachannelParameters(
*localport = 0;
*remoteport = 0;
*remotemaxmessagesize = 0;
*mmsset = false;
*level = 0;
return NS_ERROR_FAILURE;
}
@ -1239,9 +1244,10 @@ PeerConnectionImpl::InitializeDataChannel()
uint16_t localport = 0;
uint16_t remoteport = 0;
uint32_t remotemaxmessagesize = 0;
bool mmsset = false;
uint16_t level = 0;
nsresult rv = GetDatachannelParameters(&channels, &localport, &remoteport,
&remotemaxmessagesize, &level);
&remotemaxmessagesize, &mmsset, &level);
if (NS_FAILED(rv)) {
CSFLogDebug(logTag, "%s: We did not negotiate datachannel", __FUNCTION__);
@ -1252,7 +1258,7 @@ PeerConnectionImpl::InitializeDataChannel()
channels = MAX_NUM_STREAMS;
}
rv = EnsureDataConnection(localport, channels, remotemaxmessagesize);
rv = EnsureDataConnection(localport, channels, remotemaxmessagesize, mmsset);
if (NS_SUCCEEDED(rv)) {
// use the specified TransportFlow
RefPtr<TransportFlow> flow = mMedia->GetTransportFlow(level, false).get();
@ -1310,7 +1316,8 @@ PeerConnectionImpl::CreateDataChannel(const nsAString& aLabel,
nsresult rv = EnsureDataConnection(WEBRTC_DATACHANNEL_PORT_DEFAULT,
WEBRTC_DATACHANNEL_STREAMS_DEFAULT,
WEBRTC_DATACHANELL_MAX_MESSAGE_SIZE_DEFAULT);
WEBRTC_DATACHANELL_MAX_MESSAGE_SIZE_DEFAULT,
false);
if (NS_FAILED(rv)) {
return rv;
}

Просмотреть файл

@ -647,7 +647,7 @@ private:
nsresult ConfigureJsepSessionCodecs();
NS_IMETHODIMP EnsureDataConnection(uint16_t aLocalPort, uint16_t aNumstreams,
uint32_t aMaxMessageSize);
uint32_t aMaxMessageSize, bool aMMSSet);
nsresult CloseInt();
nsresult CheckApiState(bool assert_ice_ready) const;
@ -681,6 +681,7 @@ private:
uint16_t* localport,
uint16_t* remoteport,
uint32_t* maxmessagesize,
bool* mmsset,
uint16_t* level) const;
static void DeferredAddTrackToJsepSession(const std::string& pcHandle,

Просмотреть файл

@ -110,15 +110,18 @@ SdpMediaSection::GetSctpPort() const
return attrs.GetSctpPort();
}
uint32_t
SdpMediaSection::GetMaxMessageSize() const
bool
SdpMediaSection::GetMaxMessageSize(uint32_t* size) const
{
*size = 0;
auto& attrs = GetAttributeList();
if (!attrs.HasAttribute(SdpAttribute::kMaxMessageSizeAttribute)) {
return 0;
return false;
}
return attrs.GetMaxMessageSize();
*size = attrs.GetMaxMessageSize();
return true;
}
bool

Просмотреть файл

@ -158,7 +158,7 @@ public:
const SdpRtpmapAttributeList::Rtpmap* FindRtpmap(const std::string& pt) const;
const SdpSctpmapAttributeList::Sctpmap* GetSctpmap() const;
uint32_t GetSctpPort() const;
uint32_t GetMaxMessageSize() const;
bool GetMaxMessageSize(uint32_t* size) const;
bool HasRtcpFb(const std::string& pt,
SdpRtcpFbAttributeList::Type type,
const std::string& subType) const;