зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 10 changesets (bug 1521879) for causing bug 1530107. a=backout
Backed out changeset f597a73a6eac (bug 1521879) Backed out changeset 0bb76534f207 (bug 1521879) Backed out changeset abcb8be12adf (bug 1521879) Backed out changeset ed6c8d3bbfde (bug 1521879) Backed out changeset 1addf1e15b55 (bug 1521879) Backed out changeset 6b709cd9a479 (bug 1521879) Backed out changeset 07747027c59c (bug 1521879) Backed out changeset a6105ccc188c (bug 1521879) Backed out changeset 48c9c643e7bb (bug 1521879) Backed out changeset d4004105a04a (bug 1521879)
This commit is contained in:
Родитель
b10ae6b7a5
Коммит
e6740c75fc
2
CLOBBER
2
CLOBBER
|
@ -22,4 +22,4 @@
|
|||
# changes to stick? As of bug 928195, this shouldn't be necessary! Please
|
||||
# don't change CLOBBER for WebIDL changes any more.
|
||||
|
||||
Bug 1521879: Adding PMediaTransport.ipdl requires a clobber.
|
||||
Bug 1524688: Deleting preprocessed manifests requires clobber.
|
||||
|
|
|
@ -175,7 +175,6 @@ EXPORTS.mozilla += [
|
|||
|
||||
EXPORTS.mozilla.media.webrtc += [
|
||||
'webrtc/WebrtcGlobal.h',
|
||||
'webrtc/WebrtcIPCTraits.h',
|
||||
]
|
||||
|
||||
if not CONFIG['MOZ_WEBRTC']:
|
||||
|
@ -184,7 +183,7 @@ if not CONFIG['MOZ_WEBRTC']:
|
|||
]
|
||||
|
||||
IPDL_SOURCES += [
|
||||
'webrtc/PWebrtcGlobal.ipdl',
|
||||
'webrtc/PWebrtcGlobal.ipdl'
|
||||
]
|
||||
|
||||
EXPORTS.mozilla.dom += [
|
||||
|
@ -207,8 +206,6 @@ EXPORTS.mozilla.dom += [
|
|||
'VideoStreamTrack.h',
|
||||
'VideoTrack.h',
|
||||
'VideoTrackList.h',
|
||||
'webrtc/MediaTransportChild.h',
|
||||
'webrtc/MediaTransportParent.h',
|
||||
]
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
|
|
|
@ -126,13 +126,13 @@ skip-if = (android_version == '18') # android(Bug 1189784, timeouts on 4.3 emula
|
|||
[test_peerConnection_checkPacketDumpHook.html]
|
||||
skip-if = (android_version == '18') # android(Bug 1189784, timeouts on 4.3 emulator)
|
||||
[test_peerConnection_basicAudioNATSrflx.html]
|
||||
skip-if = toolkit == 'android' || (verify && (os == 'linux')) || socketprocess_e10s # websockets don't work on android (bug 1266217, IPV6 is busted in try which causes timeouts in socket process case (bug 1521117))
|
||||
skip-if = toolkit == 'android' || (verify && (os == 'linux')) # websockets don't work on android (bug 1266217)
|
||||
[test_peerConnection_basicAudioNATRelay.html]
|
||||
skip-if = toolkit == 'android' || (verify && debug && (os == 'linux')) || socketprocess_e10s # websockets don't work on android (bug 1266217, IPV6 is busted in try which causes timeouts in socket process case (bug 1521117))
|
||||
skip-if = toolkit == 'android' || (verify && debug && (os == 'linux')) # websockets don't work on android (bug 1266217)
|
||||
[test_peerConnection_basicAudioNATRelayTCP.html]
|
||||
skip-if = toolkit == 'android' || socketprocess_e10s # websockets don't work on android (bug 1266217, IPV6 is busted in try which causes timeouts in socket process case (bug 1521117))
|
||||
skip-if = toolkit == 'android' # websockets don't work on android (bug 1266217)
|
||||
[test_peerConnection_basicAudioNATRelayTLS.html]
|
||||
skip-if = true # need pyopenssl on builders, see bug 1323439 # toolkit == 'android' || socketprocess_e10s # websockets don't work on android (bug 1266217), IPV6 is busted in try which causes timeouts in socket process case (bug 1521117)
|
||||
skip-if = true # need pyopenssl on builders, see bug 1323439 # toolkit == 'android' # websockets don't work on android (bug 1266217)
|
||||
[test_peerConnection_basicAudioRequireEOC.html]
|
||||
skip-if = (android_version == '18') # android(Bug 1189784, timeouts on 4.3 emulator)
|
||||
[test_peerConnection_basicAudioPcmaPcmuOnly.html]
|
||||
|
@ -347,7 +347,7 @@ skip-if = (android_version == '18') # android(Bug 1189784, timeouts on 4.3 emula
|
|||
[test_peerConnection_stats.html]
|
||||
skip-if = toolkit == 'android' # android(Bug 1189784, timeouts on 4.3 emulator, Bug 1373858)
|
||||
[test_peerConnection_stats_relayProtocol.html]
|
||||
skip-if = toolkit == 'android' || socketprocess_e10s # android(Bug 1189784, timeouts on 4.3 emulator, Bug 1373858, Bug 1521117)
|
||||
skip-if = toolkit == 'android' # android(Bug 1189784, timeouts on 4.3 emulator, Bug 1373858)
|
||||
[test_peerConnection_sender_and_receiver_stats.html]
|
||||
skip-if = (android_version == '18') # android(Bug 1189784, timeouts on 4.3 emulator)
|
||||
[test_peerConnection_trackless_sender_stats.html]
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef _MTRANSPORTCHILD_H__
|
||||
#define _MTRANSPORTCHILD_H__
|
||||
|
||||
#include "mozilla/dom/PMediaTransportChild.h"
|
||||
|
||||
namespace mozilla {
|
||||
class MediaTransportHandlerIPC;
|
||||
|
||||
class MediaTransportChild : public dom::PMediaTransportChild {
|
||||
public:
|
||||
#ifdef MOZ_WEBRTC
|
||||
explicit MediaTransportChild(MediaTransportHandlerIPC* aUser);
|
||||
virtual ~MediaTransportChild();
|
||||
mozilla::ipc::IPCResult RecvOnCandidate(const string& transportId,
|
||||
const CandidateInfo& candidateInfo);
|
||||
mozilla::ipc::IPCResult RecvOnAlpnNegotiated(const string& alpn);
|
||||
mozilla::ipc::IPCResult RecvOnGatheringStateChange(const int& state);
|
||||
mozilla::ipc::IPCResult RecvOnConnectionStateChange(const int& state);
|
||||
mozilla::ipc::IPCResult RecvOnPacketReceived(const string& transportId,
|
||||
const MediaPacket& packet);
|
||||
mozilla::ipc::IPCResult RecvOnEncryptedSending(const string& transportId,
|
||||
const MediaPacket& packet);
|
||||
mozilla::ipc::IPCResult RecvOnStateChange(const string& transportId,
|
||||
const int& state);
|
||||
mozilla::ipc::IPCResult RecvOnRtcpStateChange(const string& transportId,
|
||||
const int& state);
|
||||
|
||||
private:
|
||||
RefPtr<MediaTransportHandlerIPC> mUser;
|
||||
#endif //MOZ_WEBRTC
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
#endif
|
|
@ -1,64 +0,0 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef _MTRANSPORTHANDLER_PARENT_H__
|
||||
#define _MTRANSPORTHANDLER_PARENT_H__
|
||||
|
||||
#include "mozilla/dom/PMediaTransportParent.h"
|
||||
#include <memory>
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class MediaTransportParent : public dom::PMediaTransportParent {
|
||||
public:
|
||||
#ifdef MOZ_WEBRTC
|
||||
MediaTransportParent();
|
||||
virtual ~MediaTransportParent();
|
||||
|
||||
mozilla::ipc::IPCResult RecvGetIceLog(const nsCString& pattern,
|
||||
GetIceLogResolver&& aResolve);
|
||||
mozilla::ipc::IPCResult RecvClearIceLog();
|
||||
mozilla::ipc::IPCResult RecvEnterPrivateMode();
|
||||
mozilla::ipc::IPCResult RecvExitPrivateMode();
|
||||
mozilla::ipc::IPCResult RecvCreateIceCtx(
|
||||
const string& name, nsTArray<RTCIceServer>&& iceServers,
|
||||
const RTCIceTransportPolicy& icePolicy);
|
||||
mozilla::ipc::IPCResult RecvSetProxyServer(const PBrowserOrId& browserOrId,
|
||||
const nsCString& alpn);
|
||||
mozilla::ipc::IPCResult RecvEnsureProvisionalTransport(
|
||||
const string& transportId, const string& localUfrag,
|
||||
const string& localPwd, const int& componentCount);
|
||||
mozilla::ipc::IPCResult RecvStartIceGathering(
|
||||
const bool& defaultRouteOnly, const net::NrIceStunAddrArray& stunAddrs);
|
||||
mozilla::ipc::IPCResult RecvActivateTransport(
|
||||
const string& transportId, const string& localUfrag,
|
||||
const string& localPwd, const int& componentCount,
|
||||
const string& remoteUfrag, const string& remotePwd,
|
||||
nsTArray<uint8_t>&& keyDer, nsTArray<uint8_t>&& certDer,
|
||||
const int& authType, const bool& dtlsClient,
|
||||
const DtlsDigestList& digests, const bool& privacyRequested);
|
||||
mozilla::ipc::IPCResult RecvRemoveTransportsExcept(
|
||||
const StringVector& transportIds);
|
||||
mozilla::ipc::IPCResult RecvStartIceChecks(const bool& isControlling,
|
||||
const bool& isOfferer,
|
||||
const StringVector& iceOptions);
|
||||
mozilla::ipc::IPCResult RecvSendPacket(const string& transportId,
|
||||
const MediaPacket& packet);
|
||||
mozilla::ipc::IPCResult RecvAddIceCandidate(const string& transportId,
|
||||
const string& candidate);
|
||||
mozilla::ipc::IPCResult RecvUpdateNetworkState(const bool& online);
|
||||
mozilla::ipc::IPCResult RecvGetIceStats(
|
||||
const string& transportId, const double& now,
|
||||
const RTCStatsReportInternal& reportIn, GetIceStatsResolver&& aResolve);
|
||||
|
||||
void ActorDestroy(ActorDestroyReason aWhy);
|
||||
|
||||
private:
|
||||
// Hide the sigslot/MediaTransportHandler stuff from IPC.
|
||||
class Impl;
|
||||
std::unique_ptr<Impl> mImpl;
|
||||
#endif //MOZ_WEBRTC
|
||||
};
|
||||
} // namespace mozilla
|
||||
#endif //_MTRANSPORTHANDLER_PARENT_H__
|
|
@ -1,100 +0,0 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
include protocol PSocketProcessBridge;
|
||||
|
||||
#ifdef MOZ_WEBRTC
|
||||
include PBrowserOrId;
|
||||
|
||||
// ParamTraits stuff for generated code and other classes we don't want to change
|
||||
include "mozilla/media/webrtc/WebrtcIPCTraits.h";
|
||||
using StringVector from "mozilla/media/webrtc/WebrtcIPCTraits.h";
|
||||
using CandidateInfo from "mozilla/media/webrtc/WebrtcIPCTraits.h";
|
||||
using DtlsDigestList from "mozilla/media/webrtc/WebrtcIPCTraits.h";
|
||||
using std::string from "ipc/IPCMessageUtils.h";
|
||||
using struct mozilla::dom::RTCStatsReportInternal from "mozilla/dom/RTCStatsReportBinding.h";
|
||||
using struct mozilla::dom::MovableRTCStatsReportInternal from "mozilla/media/webrtc/WebrtcGlobal.h";
|
||||
using WebrtcGlobalLog from "mozilla/media/webrtc/WebrtcGlobal.h";
|
||||
using mozilla::dom::RTCIceServer from "mozilla/dom/RTCConfigurationBinding.h";
|
||||
using mozilla::dom::RTCIceTransportPolicy from "mozilla/dom/RTCConfigurationBinding.h";
|
||||
|
||||
// ParamTraits stuff for our own classes
|
||||
using MediaPacket from "mtransport/mediapacket.h";
|
||||
using net::NrIceStunAddrArray from "mozilla/net/PStunAddrsParams.h";
|
||||
#endif // MOZ_WEBRTC
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
async protocol PMediaTransport {
|
||||
manager PSocketProcessBridge;
|
||||
|
||||
parent:
|
||||
async __delete__();
|
||||
|
||||
#ifdef MOZ_WEBRTC
|
||||
async GetIceLog(nsCString pattern) returns (WebrtcGlobalLog loglines);
|
||||
async ClearIceLog();
|
||||
async EnterPrivateMode();
|
||||
async ExitPrivateMode();
|
||||
|
||||
async CreateIceCtx(string name,
|
||||
RTCIceServer[] iceServers,
|
||||
RTCIceTransportPolicy icePolicy);
|
||||
|
||||
async SetProxyServer(PBrowserOrId browserOrId,
|
||||
nsCString alpn);
|
||||
|
||||
async EnsureProvisionalTransport(string transportId,
|
||||
string localUfrag,
|
||||
string localPwd,
|
||||
int componentCount);
|
||||
|
||||
async StartIceGathering(bool defaultRouteOnly,
|
||||
NrIceStunAddrArray stunAddrs);
|
||||
|
||||
async ActivateTransport(string transportId,
|
||||
string localUfrag,
|
||||
string localPwd,
|
||||
int componentCount,
|
||||
string remoteUfrag,
|
||||
string remotePwd,
|
||||
uint8_t[] keyDer,
|
||||
uint8_t[] certDer,
|
||||
int authType,
|
||||
bool dtlsClient,
|
||||
DtlsDigestList digests,
|
||||
bool privacyRequested);
|
||||
|
||||
async RemoveTransportsExcept(StringVector transportIds);
|
||||
|
||||
async StartIceChecks(bool isControlling,
|
||||
bool isOfferer,
|
||||
StringVector iceOptions);
|
||||
|
||||
async SendPacket(string transportId, MediaPacket packet);
|
||||
|
||||
async AddIceCandidate(string transportId,
|
||||
string candidate);
|
||||
|
||||
async UpdateNetworkState(bool online);
|
||||
|
||||
async GetIceStats(string transportId,
|
||||
double now,
|
||||
RTCStatsReportInternal reportIn) returns (MovableRTCStatsReportInternal reportOut);
|
||||
|
||||
child:
|
||||
async OnCandidate(string transportId, CandidateInfo candidateInfo);
|
||||
async OnAlpnNegotiated(string alpn);
|
||||
async OnGatheringStateChange(int state);
|
||||
async OnConnectionStateChange(int state);
|
||||
async OnPacketReceived(string transportId, MediaPacket packet);
|
||||
async OnEncryptedSending(string transportId, MediaPacket packet);
|
||||
async OnStateChange(string transportId, int state);
|
||||
async OnRtcpStateChange(string transportId, int state);
|
||||
|
||||
#endif // MOZ_WEBRTC
|
||||
};
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
|
@ -15,7 +15,6 @@
|
|||
#include "mozilla/dom/WebCryptoTask.h"
|
||||
#include "mozilla/Move.h"
|
||||
#include "mozilla/Sprintf.h"
|
||||
#include "mtransport/dtlsidentity.h"
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
|
|
|
@ -19,11 +19,11 @@
|
|||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/dom/CryptoKey.h"
|
||||
#include "mozilla/dom/RTCCertificateBinding.h"
|
||||
#include "mtransport/dtlsidentity.h"
|
||||
#include "js/StructuredClone.h"
|
||||
#include "js/TypeDecls.h"
|
||||
|
||||
namespace mozilla {
|
||||
class DtlsIdentity;
|
||||
namespace dom {
|
||||
|
||||
class ObjectOrString;
|
||||
|
|
|
@ -14,24 +14,6 @@ typedef mozilla::dom::RTCStatsReportInternal StatsReport;
|
|||
typedef nsTArray<nsAutoPtr<StatsReport>> RTCReports;
|
||||
typedef mozilla::dom::Sequence<nsString> WebrtcGlobalLog;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
// webidl dictionaries don't have move semantics, which is something that ipdl
|
||||
// needs for async returns. So, we create a "moveable" subclass that just
|
||||
// copies. _Really_ lame, but it gets the job done.
|
||||
struct MovableRTCStatsReportInternal : public RTCStatsReportInternal {
|
||||
MovableRTCStatsReportInternal() = default;
|
||||
explicit MovableRTCStatsReportInternal(RTCStatsReportInternal&& aReport) {
|
||||
RTCStatsReportInternal::operator=(aReport);
|
||||
}
|
||||
explicit MovableRTCStatsReportInternal(
|
||||
const RTCStatsReportInternal& aReport) {
|
||||
RTCStatsReportInternal::operator=(aReport);
|
||||
}
|
||||
};
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
namespace IPC {
|
||||
|
||||
template <typename T>
|
||||
|
@ -68,21 +50,6 @@ struct ParamTraits<mozilla::dom::RTCIceCandidateType>
|
|||
mozilla::dom::RTCIceCandidateType::Host,
|
||||
mozilla::dom::RTCIceCandidateType::EndGuard_> {};
|
||||
|
||||
template <>
|
||||
struct ParamTraits<mozilla::dom::MovableRTCStatsReportInternal> {
|
||||
typedef mozilla::dom::MovableRTCStatsReportInternal paramType;
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(
|
||||
aMsg, static_cast<const mozilla::dom::RTCStatsReportInternal&>(aParam));
|
||||
}
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
return ReadParam(
|
||||
aMsg, aIter,
|
||||
static_cast<mozilla::dom::RTCStatsReportInternal*>(aResult));
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct ParamTraits<mozilla::dom::RTCStatsReportInternal> {
|
||||
typedef mozilla::dom::RTCStatsReportInternal paramType;
|
||||
|
@ -301,17 +268,13 @@ static void WriteRTCRtpStreamStats(
|
|||
WriteParam(aMsg, aParam.mBitrateMean);
|
||||
WriteParam(aMsg, aParam.mBitrateStdDev);
|
||||
WriteParam(aMsg, aParam.mCodecId);
|
||||
WriteParam(aMsg, aParam.mFirCount);
|
||||
WriteParam(aMsg, aParam.mFramerateMean);
|
||||
WriteParam(aMsg, aParam.mFramerateStdDev);
|
||||
WriteParam(aMsg, aParam.mKind);
|
||||
WriteParam(aMsg, aParam.mLocalId);
|
||||
WriteParam(aMsg, aParam.mMediaTrackId);
|
||||
WriteParam(aMsg, aParam.mMediaType);
|
||||
WriteParam(aMsg, aParam.mNackCount);
|
||||
WriteParam(aMsg, aParam.mPliCount);
|
||||
WriteParam(aMsg, aParam.mQpSum);
|
||||
WriteParam(aMsg, aParam.mKind);
|
||||
WriteParam(aMsg, aParam.mRemoteId);
|
||||
WriteParam(aMsg, aParam.mLocalId);
|
||||
WriteParam(aMsg, aParam.mSsrc);
|
||||
WriteParam(aMsg, aParam.mTransportId);
|
||||
}
|
||||
|
@ -321,17 +284,13 @@ static bool ReadRTCRtpStreamStats(const Message* aMsg, PickleIterator* aIter,
|
|||
if (!ReadParam(aMsg, aIter, &(aResult->mBitrateMean)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mBitrateStdDev)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mCodecId)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mFirCount)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mFramerateMean)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mFramerateStdDev)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mKind)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mLocalId)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mMediaTrackId)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mMediaType)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mNackCount)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mPliCount)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mQpSum)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mKind)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mRemoteId)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mLocalId)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mSsrc)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mTransportId))) {
|
||||
return false;
|
||||
|
@ -349,9 +308,9 @@ struct ParamTraits<mozilla::dom::RTCInboundRTPStreamStats> {
|
|||
WriteParam(aMsg, aParam.mDiscardedPackets);
|
||||
WriteParam(aMsg, aParam.mFramesDecoded);
|
||||
WriteParam(aMsg, aParam.mJitter);
|
||||
WriteParam(aMsg, aParam.mRoundTripTime);
|
||||
WriteParam(aMsg, aParam.mPacketsLost);
|
||||
WriteParam(aMsg, aParam.mPacketsReceived);
|
||||
WriteParam(aMsg, aParam.mRoundTripTime);
|
||||
WriteRTCRtpStreamStats(aMsg, aParam);
|
||||
WriteRTCStats(aMsg, aParam);
|
||||
}
|
||||
|
@ -362,9 +321,9 @@ struct ParamTraits<mozilla::dom::RTCInboundRTPStreamStats> {
|
|||
!ReadParam(aMsg, aIter, &(aResult->mDiscardedPackets)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mFramesDecoded)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mJitter)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mRoundTripTime)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mPacketsLost)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mPacketsReceived)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mRoundTripTime)) ||
|
||||
!ReadRTCRtpStreamStats(aMsg, aIter, aResult) ||
|
||||
!ReadRTCStats(aMsg, aIter, aResult)) {
|
||||
return false;
|
||||
|
@ -381,9 +340,12 @@ struct ParamTraits<mozilla::dom::RTCOutboundRTPStreamStats> {
|
|||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg, aParam.mBytesSent);
|
||||
WriteParam(aMsg, aParam.mDroppedFrames);
|
||||
WriteParam(aMsg, aParam.mFramesEncoded);
|
||||
WriteParam(aMsg, aParam.mPacketsSent);
|
||||
WriteParam(aMsg, aParam.mTargetBitrate);
|
||||
WriteParam(aMsg, aParam.mFramesEncoded);
|
||||
WriteParam(aMsg, aParam.mFirCount);
|
||||
WriteParam(aMsg, aParam.mNackCount);
|
||||
WriteParam(aMsg, aParam.mPliCount);
|
||||
WriteRTCRtpStreamStats(aMsg, aParam);
|
||||
WriteRTCStats(aMsg, aParam);
|
||||
}
|
||||
|
@ -392,9 +354,12 @@ struct ParamTraits<mozilla::dom::RTCOutboundRTPStreamStats> {
|
|||
paramType* aResult) {
|
||||
if (!ReadParam(aMsg, aIter, &(aResult->mBytesSent)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mDroppedFrames)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mFramesEncoded)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mPacketsSent)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mTargetBitrate)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mFramesEncoded)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mFirCount)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mNackCount)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mPliCount)) ||
|
||||
!ReadRTCRtpStreamStats(aMsg, aIter, aResult) ||
|
||||
!ReadRTCStats(aMsg, aIter, aResult)) {
|
||||
return false;
|
||||
|
|
|
@ -1,167 +0,0 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef _WEBRTC_IPC_TRAITS_H_
|
||||
#define _WEBRTC_IPC_TRAITS_H_
|
||||
|
||||
#include "ipc/IPCMessageUtils.h"
|
||||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
#include "mozilla/dom/RTCConfigurationBinding.h"
|
||||
#include "mozilla/media/webrtc/WebrtcGlobal.h"
|
||||
#include "mozilla/dom/CandidateInfo.h"
|
||||
#include "mozilla/MacroForEach.h"
|
||||
#include "mtransport/transportlayerdtls.h"
|
||||
#include <vector>
|
||||
|
||||
namespace mozilla {
|
||||
typedef std::vector<std::string> StringVector;
|
||||
}
|
||||
|
||||
namespace IPC {
|
||||
|
||||
template <typename T>
|
||||
struct ParamTraits<std::vector<T>> {
|
||||
typedef std::vector<T> paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
aMsg->WriteUInt32(aParam.size());
|
||||
for (const T& elem : aParam) {
|
||||
WriteParam(aMsg, elem);
|
||||
}
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
uint32_t size;
|
||||
if (!aMsg->ReadUInt32(aIter, &size)) {
|
||||
return false;
|
||||
}
|
||||
while (size--) {
|
||||
// Only works when T is movable. Meh.
|
||||
T elem;
|
||||
if (!ReadParam(aMsg, aIter, &elem)) {
|
||||
return false;
|
||||
}
|
||||
aResult->emplace_back(std::move(elem));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct ParamTraits<mozilla::dom::OwningStringOrStringSequence> {
|
||||
typedef mozilla::dom::OwningStringOrStringSequence paramType;
|
||||
|
||||
// Ugh. OwningStringOrStringSequence already has this enum, but it is
|
||||
// private generated code. So we have to re-create it.
|
||||
enum Type { kUninitialized, kString, kStringSequence };
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
if (aParam.IsString()) {
|
||||
aMsg->WriteInt16(kString);
|
||||
WriteParam(aMsg, aParam.GetAsString());
|
||||
} else if (aParam.IsStringSequence()) {
|
||||
aMsg->WriteInt16(kStringSequence);
|
||||
WriteParam(aMsg, aParam.GetAsStringSequence());
|
||||
} else {
|
||||
aMsg->WriteInt16(kUninitialized);
|
||||
}
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
int16_t type;
|
||||
if (!aMsg->ReadInt16(aIter, &type)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case kUninitialized:
|
||||
aResult->Uninit();
|
||||
return true;
|
||||
case kString:
|
||||
return ReadParam(aMsg, aIter, &aResult->SetAsString());
|
||||
case kStringSequence:
|
||||
return ReadParam(aMsg, aIter, &aResult->SetAsStringSequence());
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct WebidlEnumSerializer
|
||||
: public ContiguousEnumSerializer<T, T(0), T::EndGuard_> {};
|
||||
|
||||
template <>
|
||||
struct ParamTraits<mozilla::dom::RTCIceCredentialType>
|
||||
: public WebidlEnumSerializer<mozilla::dom::RTCIceCredentialType> {};
|
||||
|
||||
template <>
|
||||
struct ParamTraits<mozilla::dom::RTCIceTransportPolicy>
|
||||
: public WebidlEnumSerializer<mozilla::dom::RTCIceTransportPolicy> {};
|
||||
|
||||
// A couple of recursive helper functions, allows syntax like:
|
||||
// WriteParams(aMsg, aParam.foo, aParam.bar, aParam.baz)
|
||||
// ReadParams(aMsg, aIter, aParam.foo, aParam.bar, aParam.baz)
|
||||
|
||||
// Base case
|
||||
static void WriteParams(Message* aMsg) {}
|
||||
|
||||
template <typename T0, typename... Tn>
|
||||
static void WriteParams(Message* aMsg, const T0& aArg,
|
||||
const Tn&... aRemainingArgs) {
|
||||
WriteParam(aMsg, aArg); // Write first arg
|
||||
WriteParams(aMsg, aRemainingArgs...); // Recurse for the rest
|
||||
}
|
||||
|
||||
// Base case
|
||||
static bool ReadParams(const Message* aMsg, PickleIterator* aIter) {
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename T0, typename... Tn>
|
||||
static bool ReadParams(const Message* aMsg, PickleIterator* aIter, T0& aArg,
|
||||
Tn&... aRemainingArgs) {
|
||||
return ReadParam(aMsg, aIter, &aArg) && // Read first arg
|
||||
ReadParams(aMsg, aIter, aRemainingArgs...); // Recurse for the rest
|
||||
}
|
||||
|
||||
// Macros that allow syntax like:
|
||||
// DEFINE_IPC_SERIALIZER_WITH_FIELDS(SomeType, member1, member2, member3)
|
||||
// Makes sure that serialize/deserialize code do the same members in the same
|
||||
// order.
|
||||
#define ACCESS_PARAM_FIELD(Field) aParam.Field
|
||||
|
||||
#define DEFINE_IPC_SERIALIZER_WITH_FIELDS(Type, ...) \
|
||||
template <> \
|
||||
struct ParamTraits<Type> { \
|
||||
typedef Type paramType; \
|
||||
static void Write(Message* aMsg, const paramType& aParam) { \
|
||||
WriteParams(aMsg, MOZ_FOR_EACH_SEPARATED(ACCESS_PARAM_FIELD, (, ), (), \
|
||||
(__VA_ARGS__))); \
|
||||
} \
|
||||
\
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter, \
|
||||
paramType* aResult) { \
|
||||
paramType& aParam = *aResult; \
|
||||
return ReadParams(aMsg, aIter, \
|
||||
MOZ_FOR_EACH_SEPARATED(ACCESS_PARAM_FIELD, (, ), (), \
|
||||
(__VA_ARGS__))); \
|
||||
} \
|
||||
};
|
||||
|
||||
DEFINE_IPC_SERIALIZER_WITH_FIELDS(mozilla::dom::RTCIceServer, mCredential,
|
||||
mCredentialType, mUrl, mUrls, mUsername)
|
||||
|
||||
DEFINE_IPC_SERIALIZER_WITH_FIELDS(mozilla::CandidateInfo, mCandidate,
|
||||
mDefaultHostRtp, mDefaultPortRtp,
|
||||
mDefaultHostRtcp, mDefaultPortRtcp)
|
||||
|
||||
DEFINE_IPC_SERIALIZER_WITH_FIELDS(mozilla::DtlsDigest, algorithm_, value_)
|
||||
|
||||
} // namespace IPC
|
||||
|
||||
#endif // _WEBRTC_IPC_TRAITS_H_
|
|
@ -53,10 +53,6 @@ if CONFIG['MOZ_WEBRTC']:
|
|||
'/media/webrtc/trunk/webrtc'
|
||||
]
|
||||
|
||||
PREPROCESSED_IPDL_SOURCES += [
|
||||
'PMediaTransport.ipdl',
|
||||
]
|
||||
|
||||
XPIDL_SOURCES += [
|
||||
'nsITabSource.idl'
|
||||
]
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
using mozilla::TimeStamp from "mozilla/TimeStamp.h";
|
||||
using mozilla::gfx::OpenVRControllerType from "VRMessageUtils.h";
|
||||
using mozilla::dom::NativeThreadId from "mozilla/dom/TabMessageUtils.h";
|
||||
include "VRMessageUtils.h";
|
||||
|
||||
include GraphicsMessages;
|
||||
include protocol PVRGPU;
|
||||
|
@ -35,4 +34,4 @@ child:
|
|||
};
|
||||
|
||||
} // namespace gfx
|
||||
} // namespace mozilla
|
||||
} // namespace mozilla
|
|
@ -19,7 +19,6 @@
|
|||
#include "mozilla/Sprintf.h"
|
||||
#include "mozilla/dom/CryptoBuffer.h"
|
||||
#include "mozilla/dom/CryptoKey.h"
|
||||
#include "ipc/IPCMessageUtils.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@ namespace mozilla {
|
|||
class DtlsDigest {
|
||||
public:
|
||||
const static size_t kMaxDtlsDigestLength = HASH_LENGTH_MAX;
|
||||
DtlsDigest() = default;
|
||||
explicit DtlsDigest(const std::string& algorithm) : algorithm_(algorithm) {}
|
||||
DtlsDigest(const std::string& algorithm, const std::vector<uint8_t>& value)
|
||||
: algorithm_(algorithm), value_(value) {
|
||||
|
|
|
@ -7,15 +7,9 @@
|
|||
#include "mediapacket.h"
|
||||
|
||||
#include <cstring>
|
||||
#include "ipc/IPCMessageUtils.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
MediaPacket::MediaPacket(const MediaPacket& orig)
|
||||
: sdp_level_(orig.sdp_level_), type_(orig.type_) {
|
||||
Copy(orig.data(), orig.len(), orig.capacity_);
|
||||
}
|
||||
|
||||
void MediaPacket::Copy(const uint8_t* data, size_t len, size_t capacity) {
|
||||
if (capacity < len) {
|
||||
capacity = len;
|
||||
|
@ -26,70 +20,6 @@ void MediaPacket::Copy(const uint8_t* data, size_t len, size_t capacity) {
|
|||
memcpy(data_.get(), data, len);
|
||||
}
|
||||
|
||||
void MediaPacket::Serialize(IPC::Message* aMsg) const {
|
||||
aMsg->WriteUInt32(len_);
|
||||
aMsg->WriteUInt32(capacity_);
|
||||
if (len_) {
|
||||
aMsg->WriteBytes(data_.get(), len_);
|
||||
}
|
||||
aMsg->WriteUInt32(encrypted_len_);
|
||||
if (encrypted_len_) {
|
||||
aMsg->WriteBytes(encrypted_data_.get(), encrypted_len_);
|
||||
}
|
||||
aMsg->WriteInt32(sdp_level_.isSome() ? *sdp_level_ : -1);
|
||||
aMsg->WriteInt32(type_);
|
||||
}
|
||||
|
||||
bool MediaPacket::Deserialize(const IPC::Message* aMsg, PickleIterator* aIter) {
|
||||
Reset();
|
||||
uint32_t len;
|
||||
if (!aMsg->ReadUInt32(aIter, &len)) {
|
||||
return false;
|
||||
}
|
||||
uint32_t capacity;
|
||||
if (!aMsg->ReadUInt32(aIter, &capacity)) {
|
||||
return false;
|
||||
}
|
||||
if (len) {
|
||||
MOZ_RELEASE_ASSERT(capacity >= len);
|
||||
UniquePtr<uint8_t[]> data(new uint8_t[capacity]);
|
||||
if (!aMsg->ReadBytesInto(aIter, data.get(), len)) {
|
||||
return false;
|
||||
}
|
||||
data_ = std::move(data);
|
||||
len_ = len;
|
||||
capacity_ = capacity;
|
||||
}
|
||||
|
||||
if (!aMsg->ReadUInt32(aIter, &len)) {
|
||||
return false;
|
||||
}
|
||||
if (len) {
|
||||
UniquePtr<uint8_t[]> data(new uint8_t[len]);
|
||||
if (!aMsg->ReadBytesInto(aIter, data.get(), len)) {
|
||||
return false;
|
||||
}
|
||||
encrypted_data_ = std::move(data);
|
||||
encrypted_len_ = len;
|
||||
}
|
||||
|
||||
int32_t sdp_level;
|
||||
if (!aMsg->ReadInt32(aIter, &sdp_level)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (sdp_level >= 0) {
|
||||
sdp_level_ = Some(sdp_level);
|
||||
}
|
||||
|
||||
int32_t type;
|
||||
if (!aMsg->ReadInt32(aIter, &type)) {
|
||||
return false;
|
||||
}
|
||||
type_ = static_cast<Type>(type);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool IsRtp(const uint8_t* data, size_t len) {
|
||||
if (len < 2) return false;
|
||||
|
||||
|
|
|
@ -12,12 +12,6 @@
|
|||
#include "mozilla/UniquePtr.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
|
||||
class PickleIterator;
|
||||
|
||||
namespace IPC {
|
||||
class Message;
|
||||
}
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
// TODO: It might be worthwhile to teach this class how to "borrow" a buffer.
|
||||
|
@ -26,7 +20,6 @@ class MediaPacket {
|
|||
public:
|
||||
MediaPacket() = default;
|
||||
MediaPacket(MediaPacket&& orig) = default;
|
||||
MediaPacket(const MediaPacket& orig);
|
||||
|
||||
// Takes ownership of the passed-in data
|
||||
void Take(UniquePtr<uint8_t[]>&& data, size_t len, size_t capacity = 0) {
|
||||
|
@ -42,9 +35,6 @@ class MediaPacket {
|
|||
data_.reset();
|
||||
len_ = 0;
|
||||
capacity_ = 0;
|
||||
encrypted_data_.reset();
|
||||
encrypted_len_ = 0;
|
||||
sdp_level_.reset();
|
||||
}
|
||||
|
||||
// Copies the passed-in data
|
||||
|
@ -78,9 +68,6 @@ class MediaPacket {
|
|||
|
||||
Type type() const { return type_; }
|
||||
|
||||
void Serialize(IPC::Message* aMsg) const;
|
||||
bool Deserialize(const IPC::Message* aMsg, PickleIterator* aIter);
|
||||
|
||||
private:
|
||||
UniquePtr<uint8_t[]> data_;
|
||||
size_t len_ = 0;
|
||||
|
@ -93,21 +80,4 @@ class MediaPacket {
|
|||
Type type_ = UNCLASSIFIED;
|
||||
};
|
||||
} // namespace mozilla
|
||||
|
||||
namespace IPC {
|
||||
template <typename>
|
||||
struct ParamTraits;
|
||||
|
||||
template <>
|
||||
struct ParamTraits<mozilla::MediaPacket> {
|
||||
static void Write(Message* aMsg, const mozilla::MediaPacket& aParam) {
|
||||
aParam.Serialize(aMsg);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
mozilla::MediaPacket* aResult) {
|
||||
return aResult->Deserialize(aMsg, aIter);
|
||||
}
|
||||
};
|
||||
} // namespace IPC
|
||||
#endif // mediapacket_h__
|
||||
|
|
|
@ -2098,7 +2098,7 @@ int NrSocketBase::CreateSocket(
|
|||
}
|
||||
|
||||
// create IPC bridge for content process
|
||||
if (XRE_IsParentProcess() || XRE_IsSocketProcess()) {
|
||||
if (XRE_IsParentProcess()) {
|
||||
*sock = new NrSocket();
|
||||
} else {
|
||||
switch (addr->protocol) {
|
||||
|
|
|
@ -69,12 +69,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "mozilla/TimeStamp.h"
|
||||
#include "mozilla/ClearOnShutdown.h"
|
||||
|
||||
// nICEr includes
|
||||
extern "C" {
|
||||
#include "transport_addr.h"
|
||||
#include "async_wait.h"
|
||||
}
|
||||
|
||||
// Stub declaration for nICEr type
|
||||
typedef struct nr_socket_vtbl_ nr_socket_vtbl;
|
||||
typedef struct nr_socket_ nr_socket;
|
||||
|
|
|
@ -447,9 +447,6 @@ int nr_ice_candidate_pair_do_triggered_check(nr_ice_peer_ctx *pctx, nr_ice_cand_
|
|||
} else if(pair->state==NR_ICE_PAIR_STATE_SUCCEEDED) {
|
||||
r_log(LOG_ICE,LOG_DEBUG,"ICE-PEER(%s)/CAND_PAIR(%s): No new trigger check for succeeded pair",pctx->label,pair->codeword);
|
||||
return(0);
|
||||
} else if (pair->local->stream->obsolete) {
|
||||
r_log(LOG_ICE,LOG_DEBUG,"ICE-PEER(%s)/CAND_PAIR(%s): No new trigger check for pair with obsolete stream",pctx->label,pair->codeword);
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* Do not run this logic more than once on a given pair */
|
||||
|
|
|
@ -519,11 +519,7 @@ void nr_ice_gather_finished_cb(NR_SOCKET s, int h, void *cb_arg)
|
|||
ctx = cand->ctx;
|
||||
|
||||
ctx->uninitialized_candidates--;
|
||||
if (cand->state == NR_ICE_CAND_STATE_FAILED) {
|
||||
r_log(LOG_ICE,LOG_WARNING,"ICE(%s)/CAND(%s): failed to initialize, %d remaining",ctx->label,cand->label,ctx->uninitialized_candidates);
|
||||
} else {
|
||||
r_log(LOG_ICE,LOG_DEBUG,"ICE(%s)/CAND(%s): initialized, %d remaining",ctx->label,cand->label,ctx->uninitialized_candidates);
|
||||
}
|
||||
r_log(LOG_ICE,LOG_DEBUG,"ICE(%s)/CAND(%s): initialized, %d remaining",ctx->label,cand->codeword,ctx->uninitialized_candidates);
|
||||
|
||||
/* Avoid the need for yet another initialization function */
|
||||
if (cand->state == NR_ICE_CAND_STATE_INITIALIZING && cand->type == HOST)
|
||||
|
@ -551,12 +547,12 @@ void nr_ice_gather_finished_cb(NR_SOCKET s, int h, void *cb_arg)
|
|||
}
|
||||
|
||||
if(ctx->uninitialized_candidates==0){
|
||||
r_log(LOG_ICE,LOG_INFO,"ICE(%s): All candidates initialized",ctx->label);
|
||||
r_log(LOG_ICE,LOG_DEBUG,"ICE(%s): All candidates initialized",ctx->label);
|
||||
if (ctx->done_cb) {
|
||||
ctx->done_cb(0,0,ctx->cb_arg);
|
||||
}
|
||||
else {
|
||||
r_log(LOG_ICE,LOG_INFO,"ICE(%s): No done_cb. We were probably destroyed.",ctx->label);
|
||||
r_log(LOG_ICE,LOG_DEBUG,"ICE(%s): No done_cb. We were probably destroyed.",ctx->label);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -44,8 +44,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
#include "r_types.h"
|
||||
|
||||
/* Length of a string hex representation of a MD5 hash */
|
||||
#define MAXIFNAME 33
|
||||
|
||||
|
|
|
@ -132,7 +132,7 @@ class FakeAudioStreamTrack : public mozilla::dom::AudioStreamTrack {
|
|||
|
||||
class LoopbackTransport : public MediaTransportHandler {
|
||||
public:
|
||||
LoopbackTransport() : MediaTransportHandler(nullptr) {
|
||||
LoopbackTransport() {
|
||||
SetState("mux", TransportLayer::TS_INIT, false);
|
||||
SetState("mux", TransportLayer::TS_INIT, true);
|
||||
SetState("non-mux", TransportLayer::TS_INIT, false);
|
||||
|
@ -157,9 +157,9 @@ class LoopbackTransport : public MediaTransportHandler {
|
|||
void EnterPrivateMode() override {}
|
||||
void ExitPrivateMode() override {}
|
||||
|
||||
nsresult CreateIceCtx(const std::string& aName,
|
||||
const nsTArray<dom::RTCIceServer>& aIceServers,
|
||||
dom::RTCIceTransportPolicy aIcePolicy) override {
|
||||
nsresult Init(const std::string& aName,
|
||||
const nsTArray<dom::RTCIceServer>& aIceServers,
|
||||
dom::RTCIceTransportPolicy aIcePolicy) override {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -213,17 +213,38 @@ class LoopbackTransport : public MediaTransportHandler {
|
|||
peer_->SignalPacketReceived(aTransportId, aPacket);
|
||||
}
|
||||
|
||||
TransportLayer::State GetState(const std::string& aTransportId,
|
||||
bool aRtcp) const override {
|
||||
if (aRtcp) {
|
||||
auto it = mRtcpStates.find(aTransportId);
|
||||
if (it != mRtcpStates.end()) {
|
||||
return it->second;
|
||||
}
|
||||
} else {
|
||||
auto it = mRtpStates.find(aTransportId);
|
||||
if (it != mRtpStates.end()) {
|
||||
return it->second;
|
||||
}
|
||||
}
|
||||
|
||||
return TransportLayer::TS_NONE;
|
||||
}
|
||||
|
||||
void SetState(const std::string& aTransportId, TransportLayer::State aState,
|
||||
bool aRtcp) {
|
||||
if (aRtcp) {
|
||||
MediaTransportHandler::OnRtcpStateChange(aTransportId, aState);
|
||||
mRtcpStates[aTransportId] = aState;
|
||||
SignalRtcpStateChange(aTransportId, aState);
|
||||
} else {
|
||||
MediaTransportHandler::OnStateChange(aTransportId, aState);
|
||||
mRtpStates[aTransportId] = aState;
|
||||
SignalStateChange(aTransportId, aState);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
RefPtr<MediaTransportHandler> peer_;
|
||||
std::map<std::string, TransportLayer::State> mRtpStates;
|
||||
std::map<std::string, TransportLayer::State> mRtcpStates;
|
||||
};
|
||||
|
||||
class TestAgent {
|
||||
|
|
|
@ -5,10 +5,6 @@
|
|||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
include('/media/webrtc/webrtc.mozbuild')
|
||||
|
||||
EXPORTS.mozilla.dom += [
|
||||
'CandidateInfo.h'
|
||||
]
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
'/media/mtransport/third_party/nrappkit/src/util/libekr',
|
||||
'/media/webrtc/trunk',
|
||||
|
|
|
@ -702,7 +702,7 @@ void MediaPipeline::CheckTransportStates() {
|
|||
}
|
||||
}
|
||||
|
||||
void MediaPipeline::SendPacket(MediaPacket&& packet) {
|
||||
void MediaPipeline::SendPacket(MediaPacket& packet) {
|
||||
ASSERT_ON_THREAD(mStsThread);
|
||||
MOZ_ASSERT(mRtpState == TransportLayer::TS_OPEN);
|
||||
MOZ_ASSERT(!mTransportId.empty());
|
||||
|
@ -1284,7 +1284,7 @@ void MediaPipeline::PipelineTransport::SendRtpRtcpPacket_s(
|
|||
("%s sending %s packet", mPipeline->mDescription.c_str(),
|
||||
(isRtp ? "RTP" : "RTCP")));
|
||||
|
||||
mPipeline->SendPacket(std::move(packet));
|
||||
mPipeline->SendPacket(packet);
|
||||
}
|
||||
|
||||
nsresult MediaPipeline::PipelineTransport::SendRtcpPacket(const uint8_t* aData,
|
||||
|
|
|
@ -197,7 +197,7 @@ class MediaPipeline : public sigslot::has_slots<> {
|
|||
virtual void OnRtpPacketReceived(){};
|
||||
void IncrementRtcpPacketsReceived();
|
||||
|
||||
virtual void SendPacket(MediaPacket&& packet);
|
||||
virtual void SendPacket(MediaPacket& packet);
|
||||
|
||||
// Process slots on transports
|
||||
void RtpStateChange(const std::string& aTransportId, TransportLayer::State);
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "MediaTransportHandler.h"
|
||||
#include "MediaTransportHandlerIPC.h"
|
||||
#include "nricemediastream.h"
|
||||
#include "nriceresolver.h"
|
||||
#include "transportflow.h"
|
||||
|
@ -30,8 +29,6 @@
|
|||
// DTLS
|
||||
#include "signaling/src/sdp/SdpAttribute.h"
|
||||
|
||||
#include "runnable_utils.h"
|
||||
|
||||
#include "mozilla/Telemetry.h"
|
||||
|
||||
#include "mozilla/dom/RTCStatsReportBinding.h"
|
||||
|
@ -51,16 +48,16 @@ static const char* mthLogTag = "MediaTransportHandler";
|
|||
class MediaTransportHandlerSTS : public MediaTransportHandler,
|
||||
public sigslot::has_slots<> {
|
||||
public:
|
||||
explicit MediaTransportHandlerSTS(nsISerialEventTarget* aCallbackThread);
|
||||
MediaTransportHandlerSTS();
|
||||
|
||||
RefPtr<IceLogPromise> GetIceLog(const nsCString& aPattern) override;
|
||||
void ClearIceLog() override;
|
||||
void EnterPrivateMode() override;
|
||||
void ExitPrivateMode() override;
|
||||
|
||||
nsresult CreateIceCtx(const std::string& aName,
|
||||
const nsTArray<dom::RTCIceServer>& aIceServers,
|
||||
dom::RTCIceTransportPolicy aIcePolicy) override;
|
||||
nsresult Init(const std::string& aName,
|
||||
const nsTArray<dom::RTCIceServer>& aIceServers,
|
||||
dom::RTCIceTransportPolicy aIcePolicy) override;
|
||||
void Destroy() override;
|
||||
|
||||
// We will probably be able to move the proxy lookup stuff into
|
||||
|
@ -104,6 +101,9 @@ class MediaTransportHandlerSTS : public MediaTransportHandler,
|
|||
void SendPacket(const std::string& aTransportId,
|
||||
MediaPacket&& aPacket) override;
|
||||
|
||||
TransportLayer::State GetState(const std::string& aTransportId,
|
||||
bool aRtcp) const override;
|
||||
|
||||
RefPtr<StatsPromise> GetIceStats(
|
||||
const std::string& aTransportId, DOMHighResTimeStamp aNow,
|
||||
std::unique_ptr<dom::RTCStatsReportInternal>&& aReport) override;
|
||||
|
@ -121,15 +121,6 @@ class MediaTransportHandlerSTS : public MediaTransportHandler,
|
|||
RefPtr<TransportFlow> mRtcpFlow;
|
||||
};
|
||||
|
||||
using MediaTransportHandler::OnAlpnNegotiated;
|
||||
using MediaTransportHandler::OnCandidate;
|
||||
using MediaTransportHandler::OnConnectionStateChange;
|
||||
using MediaTransportHandler::OnEncryptedSending;
|
||||
using MediaTransportHandler::OnGatheringStateChange;
|
||||
using MediaTransportHandler::OnPacketReceived;
|
||||
using MediaTransportHandler::OnRtcpStateChange;
|
||||
using MediaTransportHandler::OnStateChange;
|
||||
|
||||
void OnGatheringStateChange(NrIceCtx* aIceCtx,
|
||||
NrIceCtx::GatheringState aState);
|
||||
void OnConnectionStateChange(NrIceCtx* aIceCtx,
|
||||
|
@ -150,25 +141,23 @@ class MediaTransportHandlerSTS : public MediaTransportHandler,
|
|||
RefPtr<NrIceCtx> mIceCtx;
|
||||
RefPtr<NrIceResolver> mDNSResolver;
|
||||
std::map<std::string, Transport> mTransports;
|
||||
std::map<std::string, TransportLayer::State> mStateCache;
|
||||
std::map<std::string, TransportLayer::State> mRtcpStateCache;
|
||||
bool mProxyOnly = false;
|
||||
};
|
||||
|
||||
/* static */
|
||||
already_AddRefed<MediaTransportHandler> MediaTransportHandler::Create(
|
||||
nsISerialEventTarget* aCallbackThread) {
|
||||
already_AddRefed<MediaTransportHandler> MediaTransportHandler::Create() {
|
||||
RefPtr<MediaTransportHandler> result;
|
||||
if (XRE_IsContentProcess() &&
|
||||
Preferences::GetBool("media.peerconnection.mtransport_process")) {
|
||||
result = new MediaTransportHandlerIPC(aCallbackThread);
|
||||
if (Preferences::GetBool("media.peerconnection.mtransport_process")) {
|
||||
// TODO: Return a MediaTransportHandlerIPC
|
||||
} else {
|
||||
result = new MediaTransportHandlerSTS(aCallbackThread);
|
||||
result = new MediaTransportHandlerSTS;
|
||||
}
|
||||
return result.forget();
|
||||
}
|
||||
|
||||
MediaTransportHandlerSTS::MediaTransportHandlerSTS(
|
||||
nsISerialEventTarget* aCallbackThread)
|
||||
: MediaTransportHandler(aCallbackThread) {
|
||||
MediaTransportHandlerSTS::MediaTransportHandlerSTS() {
|
||||
nsresult rv;
|
||||
mStsThread = do_GetService(NS_SOCKETTRANSPORTSERVICE_CONTRACTID, &rv);
|
||||
if (!mStsThread) {
|
||||
|
@ -295,17 +284,18 @@ static nsresult addNrIceServer(const nsString& aIceUrl,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
/* static */
|
||||
nsresult MediaTransportHandler::ConvertIceServers(
|
||||
const nsTArray<dom::RTCIceServer>& aIceServers,
|
||||
std::vector<NrIceStunServer>* aStunServers,
|
||||
std::vector<NrIceTurnServer>* aTurnServers) {
|
||||
nsresult MediaTransportHandlerSTS::Init(
|
||||
const std::string& aName, const nsTArray<dom::RTCIceServer>& aIceServers,
|
||||
dom::RTCIceTransportPolicy aIcePolicy) {
|
||||
std::vector<NrIceStunServer> stunServers;
|
||||
std::vector<NrIceTurnServer> turnServers;
|
||||
|
||||
nsresult rv;
|
||||
for (const auto& iceServer : aIceServers) {
|
||||
NS_ENSURE_STATE(iceServer.mUrls.WasPassed());
|
||||
NS_ENSURE_STATE(iceServer.mUrls.Value().IsStringSequence());
|
||||
for (const auto& iceUrl : iceServer.mUrls.Value().GetAsStringSequence()) {
|
||||
nsresult rv =
|
||||
addNrIceServer(iceUrl, iceServer, aStunServers, aTurnServers);
|
||||
rv = addNrIceServer(iceUrl, iceServer, &stunServers, &turnServers);
|
||||
if (NS_FAILED(rv)) {
|
||||
CSFLogError(LOGTAG, "%s: invalid STUN/TURN server: %s", __FUNCTION__,
|
||||
NS_ConvertUTF16toUTF8(iceUrl).get());
|
||||
|
@ -314,19 +304,6 @@ nsresult MediaTransportHandler::ConvertIceServers(
|
|||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult MediaTransportHandlerSTS::CreateIceCtx(
|
||||
const std::string& aName, const nsTArray<dom::RTCIceServer>& aIceServers,
|
||||
dom::RTCIceTransportPolicy aIcePolicy) {
|
||||
std::vector<NrIceStunServer> stunServers;
|
||||
std::vector<NrIceTurnServer> turnServers;
|
||||
nsresult rv = ConvertIceServers(aIceServers, &stunServers, &turnServers);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
// This stuff will probably live on the other side of IPC; errors down here
|
||||
// will either need to be ignored, or plumbed back in some way other than
|
||||
// the return.
|
||||
|
@ -380,13 +357,6 @@ nsresult MediaTransportHandlerSTS::CreateIceCtx(
|
|||
}
|
||||
|
||||
void MediaTransportHandlerSTS::Destroy() {
|
||||
if (!mStsThread->IsOnCurrentThread()) {
|
||||
mStsThread->Dispatch(WrapRunnable(RefPtr<MediaTransportHandlerSTS>(this),
|
||||
&MediaTransportHandlerSTS::Destroy),
|
||||
NS_DISPATCH_NORMAL);
|
||||
return;
|
||||
}
|
||||
|
||||
disconnect_all();
|
||||
if (mIceCtx) {
|
||||
NrIceStats stats = mIceCtx->Destroy();
|
||||
|
@ -411,28 +381,12 @@ void MediaTransportHandlerSTS::Destroy() {
|
|||
|
||||
void MediaTransportHandlerSTS::SetProxyServer(
|
||||
NrSocketProxyConfig&& aProxyConfig) {
|
||||
if (!mStsThread->IsOnCurrentThread()) {
|
||||
mStsThread->Dispatch(NewRunnableMethod<NrSocketProxyConfig&&>(
|
||||
__func__, this, &MediaTransportHandlerSTS::SetProxyServer,
|
||||
std::move(aProxyConfig)));
|
||||
return;
|
||||
}
|
||||
|
||||
mIceCtx->SetProxyServer(std::move(aProxyConfig));
|
||||
}
|
||||
|
||||
void MediaTransportHandlerSTS::EnsureProvisionalTransport(
|
||||
const std::string& aTransportId, const std::string& aUfrag,
|
||||
const std::string& aPwd, size_t aComponentCount) {
|
||||
if (!mStsThread->IsOnCurrentThread()) {
|
||||
mStsThread->Dispatch(
|
||||
WrapRunnable(RefPtr<MediaTransportHandlerSTS>(this),
|
||||
&MediaTransportHandlerSTS::EnsureProvisionalTransport,
|
||||
aTransportId, aUfrag, aPwd, aComponentCount),
|
||||
NS_DISPATCH_NORMAL);
|
||||
return;
|
||||
}
|
||||
|
||||
RefPtr<NrIceMediaStream> stream(mIceCtx->GetStream(aTransportId));
|
||||
if (!stream) {
|
||||
CSFLogDebug(LOGTAG, "%s: Creating ICE media stream=%s components=%u",
|
||||
|
@ -466,17 +420,6 @@ void MediaTransportHandlerSTS::ActivateTransport(
|
|||
const nsTArray<uint8_t>& aKeyDer, const nsTArray<uint8_t>& aCertDer,
|
||||
SSLKEAType aAuthType, bool aDtlsClient, const DtlsDigestList& aDigests,
|
||||
bool aPrivacyRequested) {
|
||||
if (!mStsThread->IsOnCurrentThread()) {
|
||||
mStsThread->Dispatch(
|
||||
WrapRunnable(RefPtr<MediaTransportHandlerSTS>(this),
|
||||
&MediaTransportHandlerSTS::ActivateTransport, aTransportId,
|
||||
aLocalUfrag, aLocalPwd, aComponentCount, aUfrag, aPassword,
|
||||
aKeyDer, aCertDer, aAuthType, aDtlsClient, aDigests,
|
||||
aPrivacyRequested),
|
||||
NS_DISPATCH_NORMAL);
|
||||
return;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(aComponentCount);
|
||||
RefPtr<DtlsIdentity> dtlsIdentity(
|
||||
DtlsIdentity::Deserialize(aKeyDer, aCertDer, aAuthType));
|
||||
|
@ -551,15 +494,6 @@ void MediaTransportHandlerSTS::ActivateTransport(
|
|||
|
||||
void MediaTransportHandlerSTS::StartIceGathering(
|
||||
bool aDefaultRouteOnly, const nsTArray<NrIceStunAddr>& aStunAddrs) {
|
||||
if (!mStsThread->IsOnCurrentThread()) {
|
||||
mStsThread->Dispatch(
|
||||
WrapRunnable(RefPtr<MediaTransportHandlerSTS>(this),
|
||||
&MediaTransportHandlerSTS::StartIceGathering,
|
||||
aDefaultRouteOnly, aStunAddrs),
|
||||
NS_DISPATCH_NORMAL);
|
||||
return;
|
||||
}
|
||||
|
||||
// Belt and suspenders - in e10s mode, the call below to SetStunAddrs
|
||||
// needs to have the proper flags set on ice ctx. For non-e10s,
|
||||
// setting those flags happens in StartGathering. We could probably
|
||||
|
@ -583,20 +517,12 @@ void MediaTransportHandlerSTS::StartIceGathering(
|
|||
// If there are no streams, we're probably in a situation where we've rolled
|
||||
// back while still waiting for our proxy configuration to come back. Make
|
||||
// sure content knows that the rollback has stuck wrt gathering.
|
||||
OnGatheringStateChange(dom::PCImplIceGatheringState::Complete);
|
||||
SignalGatheringStateChange(dom::PCImplIceGatheringState::Complete);
|
||||
}
|
||||
|
||||
void MediaTransportHandlerSTS::StartIceChecks(
|
||||
bool aIsControlling, bool aIsOfferer,
|
||||
const std::vector<std::string>& aIceOptions) {
|
||||
if (!mStsThread->IsOnCurrentThread()) {
|
||||
mStsThread->Dispatch(WrapRunnable(RefPtr<MediaTransportHandlerSTS>(this),
|
||||
&MediaTransportHandlerSTS::StartIceChecks,
|
||||
aIsControlling, aIsOfferer, aIceOptions),
|
||||
NS_DISPATCH_NORMAL);
|
||||
return;
|
||||
}
|
||||
|
||||
nsresult rv = mIceCtx->ParseGlobalAttributes(aIceOptions);
|
||||
if (NS_FAILED(rv)) {
|
||||
CSFLogError(LOGTAG, "%s: couldn't parse global parameters", __FUNCTION__);
|
||||
|
@ -620,15 +546,6 @@ void MediaTransportHandlerSTS::StartIceChecks(
|
|||
|
||||
void MediaTransportHandlerSTS::AddIceCandidate(const std::string& aTransportId,
|
||||
const std::string& aCandidate) {
|
||||
if (!mStsThread->IsOnCurrentThread()) {
|
||||
mStsThread->Dispatch(
|
||||
WrapRunnable(RefPtr<MediaTransportHandlerSTS>(this),
|
||||
&MediaTransportHandlerSTS::AddIceCandidate, aTransportId,
|
||||
aCandidate),
|
||||
NS_DISPATCH_NORMAL);
|
||||
return;
|
||||
}
|
||||
|
||||
RefPtr<NrIceMediaStream> stream(mIceCtx->GetStream(aTransportId));
|
||||
if (!stream) {
|
||||
CSFLogError(LOGTAG, "No ICE stream for candidate with transport id %s: %s",
|
||||
|
@ -646,33 +563,16 @@ void MediaTransportHandlerSTS::AddIceCandidate(const std::string& aTransportId,
|
|||
}
|
||||
|
||||
void MediaTransportHandlerSTS::UpdateNetworkState(bool aOnline) {
|
||||
if (!mStsThread->IsOnCurrentThread()) {
|
||||
mStsThread->Dispatch(
|
||||
WrapRunnable(RefPtr<MediaTransportHandlerSTS>(this),
|
||||
&MediaTransportHandlerSTS::UpdateNetworkState, aOnline),
|
||||
NS_DISPATCH_NORMAL);
|
||||
return;
|
||||
}
|
||||
|
||||
mIceCtx->UpdateNetworkState(aOnline);
|
||||
}
|
||||
|
||||
void MediaTransportHandlerSTS::RemoveTransportsExcept(
|
||||
const std::set<std::string>& aTransportIds) {
|
||||
if (!mStsThread->IsOnCurrentThread()) {
|
||||
mStsThread->Dispatch(
|
||||
WrapRunnable(RefPtr<MediaTransportHandlerSTS>(this),
|
||||
&MediaTransportHandlerSTS::RemoveTransportsExcept,
|
||||
aTransportIds),
|
||||
NS_DISPATCH_NORMAL);
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto it = mTransports.begin(); it != mTransports.end();) {
|
||||
if (!aTransportIds.count(it->first)) {
|
||||
if (it->second.mFlow) {
|
||||
OnStateChange(it->first, TransportLayer::TS_NONE);
|
||||
OnRtcpStateChange(it->first, TransportLayer::TS_NONE);
|
||||
SignalStateChange(it->first, TransportLayer::TS_NONE);
|
||||
SignalRtcpStateChange(it->first, TransportLayer::TS_NONE);
|
||||
}
|
||||
mIceCtx->DestroyStream(it->first);
|
||||
it = mTransports.erase(it);
|
||||
|
@ -685,13 +585,6 @@ void MediaTransportHandlerSTS::RemoveTransportsExcept(
|
|||
|
||||
void MediaTransportHandlerSTS::SendPacket(const std::string& aTransportId,
|
||||
MediaPacket&& aPacket) {
|
||||
if (!mStsThread->IsOnCurrentThread()) {
|
||||
mStsThread->Dispatch(NewRunnableMethod<std::string, MediaPacket&&>(
|
||||
__func__, this, &MediaTransportHandlerSTS::SendPacket, aTransportId,
|
||||
std::move(aPacket)));
|
||||
return;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(aPacket.type() != MediaPacket::UNCLASSIFIED);
|
||||
RefPtr<TransportFlow> flow =
|
||||
GetTransportFlow(aTransportId, aPacket.type() == MediaPacket::RTCP);
|
||||
|
@ -727,191 +620,45 @@ void MediaTransportHandlerSTS::SendPacket(const std::string& aTransportId,
|
|||
}
|
||||
}
|
||||
|
||||
TransportLayer::State MediaTransportHandler::GetState(
|
||||
TransportLayer::State MediaTransportHandlerSTS::GetState(
|
||||
const std::string& aTransportId, bool aRtcp) const {
|
||||
// TODO Bug 1520692: we should allow Datachannel to connect without
|
||||
// DTLS SRTP keys
|
||||
if (mCallbackThread) {
|
||||
MOZ_ASSERT(mCallbackThread->IsOnCurrentThread());
|
||||
}
|
||||
|
||||
const std::map<std::string, TransportLayer::State>* cache = nullptr;
|
||||
if (aRtcp) {
|
||||
cache = &mRtcpStateCache;
|
||||
} else {
|
||||
cache = &mStateCache;
|
||||
}
|
||||
|
||||
auto it = cache->find(aTransportId);
|
||||
if (it != cache->end()) {
|
||||
return it->second;
|
||||
RefPtr<TransportFlow> flow = GetTransportFlow(aTransportId, aRtcp);
|
||||
if (flow) {
|
||||
return flow->GetLayer(TransportLayerDtls::ID())->state();
|
||||
}
|
||||
return TransportLayer::TS_NONE;
|
||||
}
|
||||
|
||||
void MediaTransportHandler::OnCandidate(const std::string& aTransportId,
|
||||
const CandidateInfo& aCandidateInfo) {
|
||||
if (mCallbackThread && !mCallbackThread->IsOnCurrentThread()) {
|
||||
mCallbackThread->Dispatch(WrapRunnable(RefPtr<MediaTransportHandler>(this),
|
||||
&MediaTransportHandler::OnCandidate,
|
||||
aTransportId, aCandidateInfo),
|
||||
NS_DISPATCH_NORMAL);
|
||||
return;
|
||||
}
|
||||
|
||||
SignalCandidate(aTransportId, aCandidateInfo);
|
||||
}
|
||||
|
||||
void MediaTransportHandler::OnAlpnNegotiated(const std::string& aAlpn) {
|
||||
if (mCallbackThread && !mCallbackThread->IsOnCurrentThread()) {
|
||||
mCallbackThread->Dispatch(
|
||||
WrapRunnable(RefPtr<MediaTransportHandler>(this),
|
||||
&MediaTransportHandler::OnAlpnNegotiated, aAlpn),
|
||||
NS_DISPATCH_NORMAL);
|
||||
return;
|
||||
}
|
||||
|
||||
SignalAlpnNegotiated(aAlpn);
|
||||
}
|
||||
|
||||
void MediaTransportHandler::OnGatheringStateChange(
|
||||
dom::PCImplIceGatheringState aState) {
|
||||
if (mCallbackThread && !mCallbackThread->IsOnCurrentThread()) {
|
||||
mCallbackThread->Dispatch(
|
||||
WrapRunnable(RefPtr<MediaTransportHandler>(this),
|
||||
&MediaTransportHandler::OnGatheringStateChange, aState),
|
||||
NS_DISPATCH_NORMAL);
|
||||
return;
|
||||
}
|
||||
|
||||
SignalGatheringStateChange(aState);
|
||||
}
|
||||
|
||||
void MediaTransportHandler::OnConnectionStateChange(
|
||||
dom::PCImplIceConnectionState aState) {
|
||||
if (mCallbackThread && !mCallbackThread->IsOnCurrentThread()) {
|
||||
mCallbackThread->Dispatch(
|
||||
WrapRunnable(RefPtr<MediaTransportHandler>(this),
|
||||
&MediaTransportHandler::OnConnectionStateChange, aState),
|
||||
NS_DISPATCH_NORMAL);
|
||||
return;
|
||||
}
|
||||
|
||||
SignalConnectionStateChange(aState);
|
||||
}
|
||||
|
||||
void MediaTransportHandler::OnPacketReceived(const std::string& aTransportId,
|
||||
MediaPacket& aPacket) {
|
||||
if (mCallbackThread && !mCallbackThread->IsOnCurrentThread()) {
|
||||
mCallbackThread->Dispatch(
|
||||
WrapRunnable(RefPtr<MediaTransportHandler>(this),
|
||||
&MediaTransportHandler::OnPacketReceived, aTransportId,
|
||||
aPacket),
|
||||
NS_DISPATCH_NORMAL);
|
||||
return;
|
||||
}
|
||||
|
||||
SignalPacketReceived(aTransportId, aPacket);
|
||||
}
|
||||
|
||||
void MediaTransportHandler::OnEncryptedSending(const std::string& aTransportId,
|
||||
MediaPacket& aPacket) {
|
||||
if (mCallbackThread && !mCallbackThread->IsOnCurrentThread()) {
|
||||
mCallbackThread->Dispatch(
|
||||
WrapRunnable(RefPtr<MediaTransportHandler>(this),
|
||||
&MediaTransportHandler::OnEncryptedSending, aTransportId,
|
||||
aPacket),
|
||||
NS_DISPATCH_NORMAL);
|
||||
return;
|
||||
}
|
||||
|
||||
SignalEncryptedSending(aTransportId, aPacket);
|
||||
}
|
||||
|
||||
void MediaTransportHandler::OnStateChange(const std::string& aTransportId,
|
||||
TransportLayer::State aState) {
|
||||
if (mCallbackThread && !mCallbackThread->IsOnCurrentThread()) {
|
||||
mCallbackThread->Dispatch(
|
||||
WrapRunnable(RefPtr<MediaTransportHandler>(this),
|
||||
&MediaTransportHandler::OnStateChange, aTransportId,
|
||||
aState),
|
||||
NS_DISPATCH_NORMAL);
|
||||
return;
|
||||
}
|
||||
|
||||
if (aState == TransportLayer::TS_NONE) {
|
||||
mStateCache.erase(aTransportId);
|
||||
} else {
|
||||
mStateCache[aTransportId] = aState;
|
||||
}
|
||||
SignalStateChange(aTransportId, aState);
|
||||
}
|
||||
|
||||
void MediaTransportHandler::OnRtcpStateChange(const std::string& aTransportId,
|
||||
TransportLayer::State aState) {
|
||||
if (mCallbackThread && !mCallbackThread->IsOnCurrentThread()) {
|
||||
mCallbackThread->Dispatch(
|
||||
WrapRunnable(RefPtr<MediaTransportHandler>(this),
|
||||
&MediaTransportHandler::OnRtcpStateChange, aTransportId,
|
||||
aState),
|
||||
NS_DISPATCH_NORMAL);
|
||||
return;
|
||||
}
|
||||
|
||||
if (aState == TransportLayer::TS_NONE) {
|
||||
mRtcpStateCache.erase(aTransportId);
|
||||
} else {
|
||||
mRtcpStateCache[aTransportId] = aState;
|
||||
}
|
||||
SignalRtcpStateChange(aTransportId, aState);
|
||||
}
|
||||
|
||||
RefPtr<MediaTransportHandler::StatsPromise>
|
||||
MediaTransportHandlerSTS::GetIceStats(
|
||||
const std::string& aTransportId, DOMHighResTimeStamp aNow,
|
||||
std::unique_ptr<dom::RTCStatsReportInternal>&& aReport) {
|
||||
return InvokeAsync(
|
||||
mStsThread, __func__,
|
||||
[=, aReport = std::move(aReport),
|
||||
self = RefPtr<MediaTransportHandlerSTS>(this)]() mutable {
|
||||
if (mIceCtx) {
|
||||
for (const auto& stream : mIceCtx->GetStreams()) {
|
||||
if (aTransportId.empty() || aTransportId == stream->GetId()) {
|
||||
GetIceStats(*stream, aNow, aReport.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
return StatsPromise::CreateAndResolve(std::move(aReport), __func__);
|
||||
});
|
||||
for (const auto& stream : mIceCtx->GetStreams()) {
|
||||
if (aTransportId.empty() || aTransportId == stream->GetId()) {
|
||||
GetIceStats(*stream, aNow, aReport.get());
|
||||
}
|
||||
}
|
||||
return StatsPromise::CreateAndResolve(std::move(aReport), __func__);
|
||||
}
|
||||
|
||||
RefPtr<MediaTransportHandler::IceLogPromise>
|
||||
MediaTransportHandlerSTS::GetIceLog(const nsCString& aPattern) {
|
||||
return InvokeAsync(
|
||||
mStsThread, __func__, [=, self = RefPtr<MediaTransportHandlerSTS>(this)] {
|
||||
dom::Sequence<nsString> converted;
|
||||
RLogConnector* logs = RLogConnector::GetInstance();
|
||||
nsAutoPtr<std::deque<std::string>> result(new std::deque<std::string>);
|
||||
// Might not exist yet.
|
||||
if (logs) {
|
||||
logs->Filter(aPattern.get(), 0, result);
|
||||
}
|
||||
for (auto& line : *result) {
|
||||
converted.AppendElement(NS_ConvertUTF8toUTF16(line.c_str()),
|
||||
fallible);
|
||||
}
|
||||
return IceLogPromise::CreateAndResolve(std::move(converted), __func__);
|
||||
});
|
||||
RLogConnector* logs = RLogConnector::GetInstance();
|
||||
nsAutoPtr<std::deque<std::string>> result(new std::deque<std::string>);
|
||||
// Might not exist yet.
|
||||
if (logs) {
|
||||
logs->Filter(aPattern.get(), 0, result);
|
||||
}
|
||||
dom::Sequence<nsString> converted;
|
||||
for (auto& line : *result) {
|
||||
converted.AppendElement(NS_ConvertUTF8toUTF16(line.c_str()), fallible);
|
||||
}
|
||||
return IceLogPromise::CreateAndResolve(std::move(converted), __func__);
|
||||
}
|
||||
|
||||
void MediaTransportHandlerSTS::ClearIceLog() {
|
||||
if (!mStsThread->IsOnCurrentThread()) {
|
||||
mStsThread->Dispatch(WrapRunnable(RefPtr<MediaTransportHandlerSTS>(this),
|
||||
&MediaTransportHandlerSTS::ClearIceLog),
|
||||
NS_DISPATCH_NORMAL);
|
||||
return;
|
||||
}
|
||||
|
||||
RLogConnector* logs = RLogConnector::GetInstance();
|
||||
if (logs) {
|
||||
logs->Clear();
|
||||
|
@ -919,26 +666,10 @@ void MediaTransportHandlerSTS::ClearIceLog() {
|
|||
}
|
||||
|
||||
void MediaTransportHandlerSTS::EnterPrivateMode() {
|
||||
if (!mStsThread->IsOnCurrentThread()) {
|
||||
mStsThread->Dispatch(
|
||||
WrapRunnable(RefPtr<MediaTransportHandlerSTS>(this),
|
||||
&MediaTransportHandlerSTS::EnterPrivateMode),
|
||||
NS_DISPATCH_NORMAL);
|
||||
return;
|
||||
}
|
||||
|
||||
RLogConnector::CreateInstance()->EnterPrivateMode();
|
||||
}
|
||||
|
||||
void MediaTransportHandlerSTS::ExitPrivateMode() {
|
||||
if (!mStsThread->IsOnCurrentThread()) {
|
||||
mStsThread->Dispatch(
|
||||
WrapRunnable(RefPtr<MediaTransportHandlerSTS>(this),
|
||||
&MediaTransportHandlerSTS::ExitPrivateMode),
|
||||
NS_DISPATCH_NORMAL);
|
||||
return;
|
||||
}
|
||||
|
||||
auto* log = RLogConnector::GetInstance();
|
||||
MOZ_ASSERT(log);
|
||||
if (log) {
|
||||
|
@ -981,8 +712,6 @@ static void ToRTCIceCandidateStats(
|
|||
void MediaTransportHandlerSTS::GetIceStats(
|
||||
const NrIceMediaStream& aStream, DOMHighResTimeStamp aNow,
|
||||
dom::RTCStatsReportInternal* aReport) const {
|
||||
MOZ_ASSERT(mStsThread->IsOnCurrentThread());
|
||||
|
||||
NS_ConvertASCIItoUTF16 transportId(aStream.GetId().c_str());
|
||||
|
||||
std::vector<NrIceCandidatePair> candPairs;
|
||||
|
@ -1148,7 +877,7 @@ void MediaTransportHandlerSTS::OnGatheringStateChange(
|
|||
OnCandidateFound(stream, "");
|
||||
}
|
||||
}
|
||||
OnGatheringStateChange(toDomIceGatheringState(aState));
|
||||
SignalGatheringStateChange(toDomIceGatheringState(aState));
|
||||
}
|
||||
|
||||
static mozilla::dom::PCImplIceConnectionState toDomIceConnectionState(
|
||||
|
@ -1174,7 +903,7 @@ static mozilla::dom::PCImplIceConnectionState toDomIceConnectionState(
|
|||
|
||||
void MediaTransportHandlerSTS::OnConnectionStateChange(
|
||||
NrIceCtx* aIceCtx, NrIceCtx::ConnectionState aState) {
|
||||
OnConnectionStateChange(toDomIceConnectionState(aState));
|
||||
SignalConnectionStateChange(toDomIceConnectionState(aState));
|
||||
}
|
||||
|
||||
// The stuff below here will eventually go into the MediaTransportChild class
|
||||
|
@ -1202,7 +931,7 @@ void MediaTransportHandlerSTS::OnCandidateFound(NrIceMediaStream* aStream,
|
|||
info.mDefaultPortRtcp = defaultRtcpCandidate.cand_addr.port;
|
||||
}
|
||||
|
||||
OnCandidate(aStream->GetId(), info);
|
||||
SignalCandidate(aStream->GetId(), info);
|
||||
}
|
||||
|
||||
void MediaTransportHandlerSTS::OnStateChange(TransportLayer* aLayer,
|
||||
|
@ -1210,26 +939,36 @@ void MediaTransportHandlerSTS::OnStateChange(TransportLayer* aLayer,
|
|||
if (aState == TransportLayer::TS_OPEN) {
|
||||
MOZ_ASSERT(aLayer->id() == TransportLayerDtls::ID());
|
||||
TransportLayerDtls* dtlsLayer = static_cast<TransportLayerDtls*>(aLayer);
|
||||
OnAlpnNegotiated(dtlsLayer->GetNegotiatedAlpn());
|
||||
SignalAlpnNegotiated(dtlsLayer->GetNegotiatedAlpn());
|
||||
}
|
||||
|
||||
// DTLS state indicates the readiness of the transport as a whole, because
|
||||
// SRTP uses the keys from the DTLS handshake.
|
||||
MediaTransportHandler::OnStateChange(aLayer->flow_id(), aState);
|
||||
if (aState == TransportLayer::TS_NONE) {
|
||||
mStateCache.erase(aLayer->flow_id());
|
||||
} else {
|
||||
mStateCache[aLayer->flow_id()] = aState;
|
||||
}
|
||||
SignalStateChange(aLayer->flow_id(), aState);
|
||||
}
|
||||
|
||||
void MediaTransportHandlerSTS::OnRtcpStateChange(TransportLayer* aLayer,
|
||||
TransportLayer::State aState) {
|
||||
MediaTransportHandler::OnRtcpStateChange(aLayer->flow_id(), aState);
|
||||
if (aState == TransportLayer::TS_NONE) {
|
||||
mRtcpStateCache.erase(aLayer->flow_id());
|
||||
} else {
|
||||
mRtcpStateCache[aLayer->flow_id()] = aState;
|
||||
}
|
||||
SignalRtcpStateChange(aLayer->flow_id(), aState);
|
||||
}
|
||||
|
||||
void MediaTransportHandlerSTS::PacketReceived(TransportLayer* aLayer,
|
||||
MediaPacket& aPacket) {
|
||||
OnPacketReceived(aLayer->flow_id(), aPacket);
|
||||
SignalPacketReceived(aLayer->flow_id(), aPacket);
|
||||
}
|
||||
|
||||
void MediaTransportHandlerSTS::EncryptedPacketSending(TransportLayer* aLayer,
|
||||
MediaPacket& aPacket) {
|
||||
OnEncryptedSending(aLayer->flow_id(), aPacket);
|
||||
SignalEncryptedSending(aLayer->flow_id(), aPacket);
|
||||
}
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#include "nricectx.h" // Need some enums
|
||||
#include "nsDOMNavigationTiming.h" // DOMHighResTimeStamp
|
||||
#include "signaling/src/common/CandidateInfo.h"
|
||||
#include "nr_socket_proxy_config.h"
|
||||
|
||||
#include "nsString.h"
|
||||
|
||||
|
@ -38,20 +37,8 @@ struct RTCStatsReportInternal;
|
|||
class MediaTransportHandler {
|
||||
public:
|
||||
// Creates either a MediaTransportHandlerSTS or a MediaTransportHandlerIPC,
|
||||
// as appropriate. If you want signals to fire on a specific thread, pass
|
||||
// the event target here, otherwise they will fire on whatever is convenient.
|
||||
// Note: This also determines what thread the state cache is updated on!
|
||||
// Don't call GetState on any other thread!
|
||||
static already_AddRefed<MediaTransportHandler> Create(
|
||||
nsISerialEventTarget* aCallbackThread);
|
||||
|
||||
explicit MediaTransportHandler(nsISerialEventTarget* aCallbackThread)
|
||||
: mCallbackThread(aCallbackThread) {}
|
||||
|
||||
static nsresult ConvertIceServers(
|
||||
const nsTArray<dom::RTCIceServer>& aIceServers,
|
||||
std::vector<NrIceStunServer>* aStunServers,
|
||||
std::vector<NrIceTurnServer>* aTurnServers);
|
||||
// as appropriate.
|
||||
static already_AddRefed<MediaTransportHandler> Create();
|
||||
|
||||
typedef MozPromise<dom::Sequence<nsString>, nsresult, true> IceLogPromise;
|
||||
|
||||
|
@ -63,12 +50,11 @@ class MediaTransportHandler {
|
|||
virtual void EnterPrivateMode() = 0;
|
||||
virtual void ExitPrivateMode() = 0;
|
||||
|
||||
virtual nsresult Init(const std::string& aName,
|
||||
const nsTArray<dom::RTCIceServer>& aIceServers,
|
||||
dom::RTCIceTransportPolicy aIcePolicy) = 0;
|
||||
virtual void Destroy() = 0;
|
||||
|
||||
virtual nsresult CreateIceCtx(const std::string& aName,
|
||||
const nsTArray<dom::RTCIceServer>& aIceServers,
|
||||
dom::RTCIceTransportPolicy aIcePolicy) = 0;
|
||||
|
||||
// We will probably be able to move the proxy lookup stuff into
|
||||
// this class once we move mtransport to its own process.
|
||||
virtual void SetProxyServer(NrSocketProxyConfig&& aProxyConfig) = 0;
|
||||
|
@ -109,6 +95,9 @@ class MediaTransportHandler {
|
|||
|
||||
virtual void UpdateNetworkState(bool aOnline) = 0;
|
||||
|
||||
virtual TransportLayer::State GetState(const std::string& aTransportId,
|
||||
bool aRtcp) const = 0;
|
||||
|
||||
// dom::RTCStatsReportInternal doesn't have move semantics.
|
||||
typedef MozPromise<std::unique_ptr<dom::RTCStatsReportInternal>, nsresult,
|
||||
true>
|
||||
|
@ -129,26 +118,8 @@ class MediaTransportHandler {
|
|||
SignalRtcpStateChange;
|
||||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MediaTransportHandler)
|
||||
|
||||
TransportLayer::State GetState(const std::string& aTransportId,
|
||||
bool aRtcp) const;
|
||||
|
||||
protected:
|
||||
void OnCandidate(const std::string& aTransportId,
|
||||
const CandidateInfo& aCandidateInfo);
|
||||
void OnAlpnNegotiated(const std::string& aAlpn);
|
||||
void OnGatheringStateChange(dom::PCImplIceGatheringState aState);
|
||||
void OnConnectionStateChange(dom::PCImplIceConnectionState aState);
|
||||
void OnPacketReceived(const std::string& aTransportId, MediaPacket& aPacket);
|
||||
void OnEncryptedSending(const std::string& aTransportId,
|
||||
MediaPacket& aPacket);
|
||||
void OnStateChange(const std::string& aTransportId,
|
||||
TransportLayer::State aState);
|
||||
void OnRtcpStateChange(const std::string& aTransportId,
|
||||
TransportLayer::State aState);
|
||||
virtual ~MediaTransportHandler() = default;
|
||||
std::map<std::string, TransportLayer::State> mStateCache;
|
||||
std::map<std::string, TransportLayer::State> mRtcpStateCache;
|
||||
RefPtr<nsISerialEventTarget> mCallbackThread;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -1,380 +0,0 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "MediaTransportHandlerIPC.h"
|
||||
#include "mozilla/dom/MediaTransportChild.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "mozilla/net/SocketProcessBridgeChild.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
static const char* mthipcLogTag = "MediaTransportHandler";
|
||||
#ifdef LOGTAG
|
||||
#undef LOGTAG
|
||||
#endif
|
||||
#define LOGTAG mthipcLogTag
|
||||
|
||||
MediaTransportHandlerIPC::MediaTransportHandlerIPC(
|
||||
nsISerialEventTarget* aCallbackThread)
|
||||
: MediaTransportHandler(aCallbackThread) {
|
||||
mInitPromise = net::SocketProcessBridgeChild::GetSocketProcessBridge()->Then(
|
||||
GetMainThreadSerialEventTarget(), __func__,
|
||||
[this, self = RefPtr<MediaTransportHandlerIPC>(this)](
|
||||
const RefPtr<net::SocketProcessBridgeChild>& aBridge) {
|
||||
mChild = new MediaTransportChild(this);
|
||||
// SocketProcessBridgeChild owns mChild! When it is done with it,
|
||||
// mChild will let us know it it going away.
|
||||
aBridge->SetEventTargetForActor(mChild, GetMainThreadEventTarget());
|
||||
aBridge->SendPMediaTransportConstructor(mChild);
|
||||
return InitPromise::CreateAndResolve(true, __func__);
|
||||
},
|
||||
[=](const nsCString& aError) {
|
||||
CSFLogError(LOGTAG,
|
||||
"MediaTransportHandlerIPC async init failed! Webrtc "
|
||||
"networking will not work! Error was %s",
|
||||
aError.get());
|
||||
NS_WARNING(
|
||||
"MediaTransportHandlerIPC async init failed! Webrtc networking "
|
||||
"will not work!");
|
||||
return InitPromise::CreateAndReject(aError, __func__);
|
||||
});
|
||||
}
|
||||
|
||||
RefPtr<MediaTransportHandler::IceLogPromise>
|
||||
MediaTransportHandlerIPC::GetIceLog(const nsCString& aPattern) {
|
||||
return mInitPromise->Then(
|
||||
GetMainThreadSerialEventTarget(), __func__,
|
||||
[=, self = RefPtr<MediaTransportHandlerIPC>(this)](bool /* dummy */) {
|
||||
if (!mChild) {
|
||||
return IceLogPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
|
||||
}
|
||||
// Compiler has trouble deducing the return type here for some reason,
|
||||
// so we use a temp variable as a hint.
|
||||
// SendGetIceLog _almost_ returns an IceLogPromise; the reject value
|
||||
// differs (ipc::ResponseRejectReason vs nsresult) so we need to
|
||||
// convert.
|
||||
RefPtr<IceLogPromise> promise = mChild->SendGetIceLog(aPattern)->Then(
|
||||
GetMainThreadSerialEventTarget(), __func__,
|
||||
[](WebrtcGlobalLog&& aLogLines) {
|
||||
return IceLogPromise::CreateAndResolve(std::move(aLogLines),
|
||||
__func__);
|
||||
},
|
||||
[](ipc::ResponseRejectReason aReason) {
|
||||
return IceLogPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
|
||||
});
|
||||
return promise;
|
||||
},
|
||||
[](const nsCString& aError) {
|
||||
return IceLogPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
|
||||
});
|
||||
}
|
||||
|
||||
void MediaTransportHandlerIPC::ClearIceLog() {
|
||||
mInitPromise->Then(
|
||||
GetMainThreadSerialEventTarget(), __func__,
|
||||
[=, self = RefPtr<MediaTransportHandlerIPC>(this)](bool /*dummy*/) {
|
||||
if (mChild) {
|
||||
mChild->SendClearIceLog();
|
||||
}
|
||||
},
|
||||
[](const nsCString& aError) {});
|
||||
}
|
||||
|
||||
void MediaTransportHandlerIPC::EnterPrivateMode() {
|
||||
mInitPromise->Then(
|
||||
GetMainThreadSerialEventTarget(), __func__,
|
||||
[=, self = RefPtr<MediaTransportHandlerIPC>(this)](bool /*dummy*/) {
|
||||
if (mChild) {
|
||||
mChild->SendEnterPrivateMode();
|
||||
}
|
||||
},
|
||||
[](const nsCString& aError) {});
|
||||
}
|
||||
|
||||
void MediaTransportHandlerIPC::ExitPrivateMode() {
|
||||
mInitPromise->Then(
|
||||
GetMainThreadSerialEventTarget(), __func__,
|
||||
[=, self = RefPtr<MediaTransportHandlerIPC>(this)](bool /*dummy*/) {
|
||||
if (mChild) {
|
||||
mChild->SendExitPrivateMode();
|
||||
}
|
||||
},
|
||||
[](const nsCString& aError) {});
|
||||
}
|
||||
|
||||
nsresult MediaTransportHandlerIPC::CreateIceCtx(
|
||||
const std::string& aName, const nsTArray<dom::RTCIceServer>& aIceServers,
|
||||
dom::RTCIceTransportPolicy aIcePolicy) {
|
||||
// Run some validation on this side of the IPC boundary so we can return
|
||||
// errors synchronously. We don't actually use the results. It might make
|
||||
// sense to move this check to PeerConnection and have this API take the
|
||||
// converted form, but we would need to write IPC serialization code for
|
||||
// the NrIce*Server types.
|
||||
std::vector<NrIceStunServer> stunServers;
|
||||
std::vector<NrIceTurnServer> turnServers;
|
||||
nsresult rv = ConvertIceServers(aIceServers, &stunServers, &turnServers);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
mInitPromise->Then(
|
||||
GetMainThreadSerialEventTarget(), __func__,
|
||||
[=, self = RefPtr<MediaTransportHandlerIPC>(this)](bool /*dummy*/) {
|
||||
if (mChild) {
|
||||
mChild->SendCreateIceCtx(aName, aIceServers, aIcePolicy);
|
||||
}
|
||||
},
|
||||
[](const nsCString& aError) {});
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void MediaTransportHandlerIPC::Destroy() {
|
||||
mInitPromise->Then(
|
||||
GetMainThreadSerialEventTarget(), __func__,
|
||||
[=, self = RefPtr<MediaTransportHandlerIPC>(this)](bool /*dummy*/) {
|
||||
if (mChild) {
|
||||
MediaTransportChild::Send__delete__(mChild);
|
||||
mChild = nullptr;
|
||||
}
|
||||
},
|
||||
[](const nsCString& aError) {});
|
||||
}
|
||||
|
||||
// We will probably be able to move the proxy lookup stuff into
|
||||
// this class once we move mtransport to its own process.
|
||||
void MediaTransportHandlerIPC::SetProxyServer(
|
||||
NrSocketProxyConfig&& aProxyConfig) {
|
||||
// TODO(bug 1521113): This doesn't work on IPC
|
||||
#if 0
|
||||
mInitPromise->Then(
|
||||
GetMainThreadSerialEventTarget(), __func__,
|
||||
[aProxyConfig = std::move(aProxyConfig), this,
|
||||
self = RefPtr<MediaTransportHandlerIPC>(this)](bool /*dummy*/) mutable {
|
||||
if (mChild) {
|
||||
mChild->SendSetProxyServer(aProxyConfig.GetBrowser(),
|
||||
aProxyConfig.GetAlpn());
|
||||
}
|
||||
},
|
||||
[](const nsCString& aError) {});
|
||||
#endif
|
||||
}
|
||||
|
||||
void MediaTransportHandlerIPC::EnsureProvisionalTransport(
|
||||
const std::string& aTransportId, const std::string& aLocalUfrag,
|
||||
const std::string& aLocalPwd, size_t aComponentCount) {
|
||||
mInitPromise->Then(
|
||||
GetMainThreadSerialEventTarget(), __func__,
|
||||
[=, self = RefPtr<MediaTransportHandlerIPC>(this)](bool /*dummy*/) {
|
||||
if (mChild) {
|
||||
mChild->SendEnsureProvisionalTransport(aTransportId, aLocalUfrag,
|
||||
aLocalPwd, aComponentCount);
|
||||
}
|
||||
},
|
||||
[](const nsCString& aError) {});
|
||||
}
|
||||
|
||||
// We set default-route-only as late as possible because it depends on what
|
||||
// capture permissions have been granted on the window, which could easily
|
||||
// change between Init (ie; when the PC is created) and StartIceGathering
|
||||
// (ie; when we set the local description).
|
||||
void MediaTransportHandlerIPC::StartIceGathering(
|
||||
bool aDefaultRouteOnly,
|
||||
// TODO(bug 1522205): It probably makes sense to look this up internally
|
||||
const nsTArray<NrIceStunAddr>& aStunAddrs) {
|
||||
mInitPromise->Then(
|
||||
GetMainThreadSerialEventTarget(), __func__,
|
||||
[=, self = RefPtr<MediaTransportHandlerIPC>(this)](bool /*dummy*/) {
|
||||
if (mChild) {
|
||||
mChild->SendStartIceGathering(aDefaultRouteOnly, aStunAddrs);
|
||||
}
|
||||
},
|
||||
[](const nsCString& aError) {});
|
||||
}
|
||||
|
||||
void MediaTransportHandlerIPC::ActivateTransport(
|
||||
const std::string& aTransportId, const std::string& aLocalUfrag,
|
||||
const std::string& aLocalPwd, size_t aComponentCount,
|
||||
const std::string& aUfrag, const std::string& aPassword,
|
||||
const nsTArray<uint8_t>& aKeyDer, const nsTArray<uint8_t>& aCertDer,
|
||||
SSLKEAType aAuthType, bool aDtlsClient, const DtlsDigestList& aDigests,
|
||||
bool aPrivacyRequested) {
|
||||
mInitPromise->Then(
|
||||
GetMainThreadSerialEventTarget(), __func__,
|
||||
[=, self = RefPtr<MediaTransportHandlerIPC>(this)](bool /*dummy*/) {
|
||||
if (mChild) {
|
||||
mChild->SendActivateTransport(
|
||||
aTransportId, aLocalUfrag, aLocalPwd, aComponentCount, aUfrag,
|
||||
aPassword, aKeyDer, aCertDer, aAuthType, aDtlsClient, aDigests,
|
||||
aPrivacyRequested);
|
||||
}
|
||||
},
|
||||
[](const nsCString& aError) {});
|
||||
}
|
||||
|
||||
void MediaTransportHandlerIPC::RemoveTransportsExcept(
|
||||
const std::set<std::string>& aTransportIds) {
|
||||
std::vector<std::string> transportIds(aTransportIds.begin(),
|
||||
aTransportIds.end());
|
||||
mInitPromise->Then(
|
||||
GetMainThreadSerialEventTarget(), __func__,
|
||||
[=, self = RefPtr<MediaTransportHandlerIPC>(this)](bool /*dummy*/) {
|
||||
if (mChild) {
|
||||
mChild->SendRemoveTransportsExcept(transportIds);
|
||||
}
|
||||
},
|
||||
[](const nsCString& aError) {});
|
||||
}
|
||||
|
||||
void MediaTransportHandlerIPC::StartIceChecks(
|
||||
bool aIsControlling, bool aIsOfferer,
|
||||
const std::vector<std::string>& aIceOptions) {
|
||||
mInitPromise->Then(
|
||||
GetMainThreadSerialEventTarget(), __func__,
|
||||
[=, self = RefPtr<MediaTransportHandlerIPC>(this)](bool /*dummy*/) {
|
||||
if (mChild) {
|
||||
mChild->SendStartIceChecks(aIsControlling, aIsOfferer, aIceOptions);
|
||||
}
|
||||
},
|
||||
[](const nsCString& aError) {});
|
||||
}
|
||||
|
||||
void MediaTransportHandlerIPC::SendPacket(const std::string& aTransportId,
|
||||
MediaPacket&& aPacket) {
|
||||
mInitPromise->Then(
|
||||
GetMainThreadSerialEventTarget(), __func__,
|
||||
[this, self = RefPtr<MediaTransportHandlerIPC>(this), aTransportId,
|
||||
aPacket = std::move(aPacket)](bool /*dummy*/) mutable {
|
||||
if (mChild) {
|
||||
mChild->SendSendPacket(aTransportId, aPacket);
|
||||
}
|
||||
},
|
||||
[](const nsCString& aError) {});
|
||||
}
|
||||
|
||||
void MediaTransportHandlerIPC::AddIceCandidate(const std::string& aTransportId,
|
||||
const std::string& aCandidate) {
|
||||
mInitPromise->Then(
|
||||
GetMainThreadSerialEventTarget(), __func__,
|
||||
[=, self = RefPtr<MediaTransportHandlerIPC>(this)](bool /*dummy*/) {
|
||||
if (mChild) {
|
||||
mChild->SendAddIceCandidate(aTransportId, aCandidate);
|
||||
}
|
||||
},
|
||||
[](const nsCString& aError) {});
|
||||
}
|
||||
|
||||
void MediaTransportHandlerIPC::UpdateNetworkState(bool aOnline) {
|
||||
mInitPromise->Then(
|
||||
GetMainThreadSerialEventTarget(), __func__,
|
||||
[=, self = RefPtr<MediaTransportHandlerIPC>(this)](bool /*dummy*/) {
|
||||
if (mChild) {
|
||||
mChild->SendUpdateNetworkState(aOnline);
|
||||
}
|
||||
},
|
||||
[](const nsCString& aError) {});
|
||||
}
|
||||
|
||||
RefPtr<MediaTransportHandler::StatsPromise>
|
||||
MediaTransportHandlerIPC::GetIceStats(
|
||||
const std::string& aTransportId, DOMHighResTimeStamp aNow,
|
||||
std::unique_ptr<dom::RTCStatsReportInternal>&& aReport) {
|
||||
return mInitPromise->Then(
|
||||
GetMainThreadSerialEventTarget(), __func__,
|
||||
[aReport = std::move(aReport), aTransportId, aNow, this,
|
||||
self = RefPtr<MediaTransportHandlerIPC>(this)](bool /*dummy*/) mutable {
|
||||
if (!mChild) {
|
||||
return StatsPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
|
||||
}
|
||||
RefPtr<StatsPromise> promise =
|
||||
mChild->SendGetIceStats(aTransportId, aNow, *aReport)
|
||||
->Then(GetMainThreadSerialEventTarget(), __func__,
|
||||
[](const dom::MovableRTCStatsReportInternal& aReport) {
|
||||
std::unique_ptr<dom::RTCStatsReportInternal> report(
|
||||
new dom::RTCStatsReportInternal(aReport));
|
||||
return StatsPromise::CreateAndResolve(
|
||||
std::move(report), __func__);
|
||||
},
|
||||
[](ipc::ResponseRejectReason aReason) {
|
||||
return StatsPromise::CreateAndReject(NS_ERROR_FAILURE,
|
||||
__func__);
|
||||
});
|
||||
return promise;
|
||||
},
|
||||
[](const nsCString& aError) {
|
||||
return StatsPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
|
||||
});
|
||||
}
|
||||
|
||||
MediaTransportChild::MediaTransportChild(MediaTransportHandlerIPC* aUser)
|
||||
: mUser(aUser) {}
|
||||
|
||||
MediaTransportChild::~MediaTransportChild() {
|
||||
MOZ_ASSERT(GetMainThreadEventTarget()->IsOnCurrentThread());
|
||||
mUser->mChild = nullptr;
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult MediaTransportChild::RecvOnCandidate(
|
||||
const string& transportId, const CandidateInfo& candidateInfo) {
|
||||
MOZ_ASSERT(GetMainThreadEventTarget()->IsOnCurrentThread());
|
||||
mUser->OnCandidate(transportId, candidateInfo);
|
||||
return ipc::IPCResult::Ok();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult MediaTransportChild::RecvOnAlpnNegotiated(
|
||||
const string& alpn) {
|
||||
MOZ_ASSERT(GetMainThreadEventTarget()->IsOnCurrentThread());
|
||||
mUser->OnAlpnNegotiated(alpn);
|
||||
return ipc::IPCResult::Ok();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult MediaTransportChild::RecvOnGatheringStateChange(
|
||||
const int& state) {
|
||||
MOZ_ASSERT(GetMainThreadEventTarget()->IsOnCurrentThread());
|
||||
mUser->OnGatheringStateChange(
|
||||
static_cast<dom::PCImplIceGatheringState>(state));
|
||||
return ipc::IPCResult::Ok();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult MediaTransportChild::RecvOnConnectionStateChange(
|
||||
const int& state) {
|
||||
MOZ_ASSERT(GetMainThreadEventTarget()->IsOnCurrentThread());
|
||||
mUser->OnConnectionStateChange(
|
||||
static_cast<dom::PCImplIceConnectionState>(state));
|
||||
return ipc::IPCResult::Ok();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult MediaTransportChild::RecvOnPacketReceived(
|
||||
const string& transportId, const MediaPacket& packet) {
|
||||
MOZ_ASSERT(GetMainThreadEventTarget()->IsOnCurrentThread());
|
||||
MediaPacket copy(packet); // Laaaaaame! Might be safe to const_cast?
|
||||
mUser->OnPacketReceived(transportId, copy);
|
||||
return ipc::IPCResult::Ok();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult MediaTransportChild::RecvOnEncryptedSending(
|
||||
const string& transportId, const MediaPacket& packet) {
|
||||
MOZ_ASSERT(GetMainThreadEventTarget()->IsOnCurrentThread());
|
||||
MediaPacket copy(packet); // Laaaaaame! Might be safe to const_cast?
|
||||
mUser->OnEncryptedSending(transportId, copy);
|
||||
return ipc::IPCResult::Ok();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult MediaTransportChild::RecvOnStateChange(
|
||||
const string& transportId, const int& state) {
|
||||
MOZ_ASSERT(GetMainThreadEventTarget()->IsOnCurrentThread());
|
||||
mUser->OnStateChange(transportId, static_cast<TransportLayer::State>(state));
|
||||
return ipc::IPCResult::Ok();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult MediaTransportChild::RecvOnRtcpStateChange(
|
||||
const string& transportId, const int& state) {
|
||||
MOZ_ASSERT(GetMainThreadEventTarget()->IsOnCurrentThread());
|
||||
mUser->OnRtcpStateChange(transportId,
|
||||
static_cast<TransportLayer::State>(state));
|
||||
return ipc::IPCResult::Ok();
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
|
@ -1,91 +0,0 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef _MTRANSPORTHANDLER_IPC_H__
|
||||
#define _MTRANSPORTHANDLER_IPC_H__
|
||||
|
||||
#include "signaling/src/peerconnection/MediaTransportHandler.h"
|
||||
#include "mozilla/dom/PMediaTransportChild.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class MediaTransportChild;
|
||||
|
||||
// Implementation of MediaTransportHandler that uses IPC (PMediaTransport) to
|
||||
// talk to mtransport on another process.
|
||||
class MediaTransportHandlerIPC : public MediaTransportHandler {
|
||||
public:
|
||||
explicit MediaTransportHandlerIPC(nsISerialEventTarget* aCallbackThread);
|
||||
RefPtr<IceLogPromise> GetIceLog(const nsCString& aPattern) override;
|
||||
void ClearIceLog() override;
|
||||
void EnterPrivateMode() override;
|
||||
void ExitPrivateMode() override;
|
||||
|
||||
nsresult CreateIceCtx(const std::string& aName,
|
||||
const nsTArray<dom::RTCIceServer>& aIceServers,
|
||||
dom::RTCIceTransportPolicy aIcePolicy) override;
|
||||
void Destroy() override;
|
||||
|
||||
// We will probably be able to move the proxy lookup stuff into
|
||||
// this class once we move mtransport to its own process.
|
||||
void SetProxyServer(NrSocketProxyConfig&& aProxyConfig) override;
|
||||
|
||||
void EnsureProvisionalTransport(const std::string& aTransportId,
|
||||
const std::string& aLocalUfrag,
|
||||
const std::string& aLocalPwd,
|
||||
size_t aComponentCount) override;
|
||||
|
||||
// We set default-route-only as late as possible because it depends on what
|
||||
// capture permissions have been granted on the window, which could easily
|
||||
// change between Init (ie; when the PC is created) and StartIceGathering
|
||||
// (ie; when we set the local description).
|
||||
void StartIceGathering(bool aDefaultRouteOnly,
|
||||
// TODO: It probably makes sense to look
|
||||
// this up internally
|
||||
const nsTArray<NrIceStunAddr>& aStunAddrs) override;
|
||||
|
||||
void ActivateTransport(
|
||||
const std::string& aTransportId, const std::string& aLocalUfrag,
|
||||
const std::string& aLocalPwd, size_t aComponentCount,
|
||||
const std::string& aUfrag, const std::string& aPassword,
|
||||
const nsTArray<uint8_t>& aKeyDer, const nsTArray<uint8_t>& aCertDer,
|
||||
SSLKEAType aAuthType, bool aDtlsClient, const DtlsDigestList& aDigests,
|
||||
bool aPrivacyRequested) override;
|
||||
|
||||
void RemoveTransportsExcept(
|
||||
const std::set<std::string>& aTransportIds) override;
|
||||
|
||||
void StartIceChecks(bool aIsControlling, bool aIsOfferer,
|
||||
const std::vector<std::string>& aIceOptions) override;
|
||||
|
||||
void SendPacket(const std::string& aTransportId,
|
||||
MediaPacket&& aPacket) override;
|
||||
|
||||
void AddIceCandidate(const std::string& aTransportId,
|
||||
const std::string& aCandidate) override;
|
||||
|
||||
void UpdateNetworkState(bool aOnline) override;
|
||||
|
||||
RefPtr<StatsPromise> GetIceStats(
|
||||
const std::string& aTransportId, DOMHighResTimeStamp aNow,
|
||||
std::unique_ptr<dom::RTCStatsReportInternal>&& aReport) override;
|
||||
|
||||
private:
|
||||
friend class MediaTransportChild;
|
||||
|
||||
// We do not own this; it will tell us when it is going away.
|
||||
MediaTransportChild* mChild = nullptr;
|
||||
|
||||
// |mChild| can only be initted asynchronously, |mInitPromise| resolves
|
||||
// when that happens. The |Then| calls make it convenient to dispatch API
|
||||
// calls to main, which is a bonus.
|
||||
// Init promise is not exclusive; this lets us call |Then| on it for every
|
||||
// API call we get, instead of creating another promise each time.
|
||||
typedef MozPromise<bool, nsCString, false> InitPromise;
|
||||
RefPtr<InitPromise> mInitPromise;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif //_MTRANSPORTHANDLER_IPC_H__
|
|
@ -1,271 +0,0 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/dom/MediaTransportParent.h"
|
||||
#include "signaling/src/peerconnection/MediaTransportHandler.h"
|
||||
|
||||
#include "nss.h" // For NSS_NoDB_Init
|
||||
#include "mozilla/PublicSSL.h" // For psm::InitializeCipherSuite
|
||||
#include "sigslot.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
// Deals with the MediaTransportHandler interface, so MediaTransportParent
|
||||
// doesn't have to..
|
||||
class MediaTransportParent::Impl : public sigslot::has_slots<> {
|
||||
public:
|
||||
explicit Impl(MediaTransportParent* aParent)
|
||||
: mHandler(
|
||||
MediaTransportHandler::Create(GetMainThreadSerialEventTarget())),
|
||||
mParent(aParent) {
|
||||
mHandler->SignalCandidate.connect(this,
|
||||
&MediaTransportParent::Impl::OnCandidate);
|
||||
mHandler->SignalAlpnNegotiated.connect(
|
||||
this, &MediaTransportParent::Impl::OnAlpnNegotiated);
|
||||
mHandler->SignalGatheringStateChange.connect(
|
||||
this, &MediaTransportParent::Impl::OnGatheringStateChange);
|
||||
mHandler->SignalConnectionStateChange.connect(
|
||||
this, &MediaTransportParent::Impl::OnConnectionStateChange);
|
||||
mHandler->SignalPacketReceived.connect(
|
||||
this, &MediaTransportParent::Impl::OnPacketReceived);
|
||||
mHandler->SignalEncryptedSending.connect(
|
||||
this, &MediaTransportParent::Impl::OnEncryptedSending);
|
||||
mHandler->SignalStateChange.connect(
|
||||
this, &MediaTransportParent::Impl::OnStateChange);
|
||||
mHandler->SignalRtcpStateChange.connect(
|
||||
this, &MediaTransportParent::Impl::OnRtcpStateChange);
|
||||
}
|
||||
|
||||
virtual ~Impl() {
|
||||
disconnect_all();
|
||||
mHandler->Destroy();
|
||||
mHandler = nullptr;
|
||||
}
|
||||
|
||||
void OnCandidate(const std::string& aTransportId,
|
||||
const CandidateInfo& aCandidateInfo) {
|
||||
NS_ENSURE_TRUE_VOID(mParent->SendOnCandidate(aTransportId, aCandidateInfo));
|
||||
}
|
||||
|
||||
void OnAlpnNegotiated(const std::string& aAlpn) {
|
||||
NS_ENSURE_TRUE_VOID(mParent->SendOnAlpnNegotiated(aAlpn));
|
||||
}
|
||||
|
||||
void OnGatheringStateChange(dom::PCImplIceGatheringState aState) {
|
||||
NS_ENSURE_TRUE_VOID(
|
||||
mParent->SendOnGatheringStateChange(static_cast<int>(aState)));
|
||||
}
|
||||
|
||||
void OnConnectionStateChange(dom::PCImplIceConnectionState aState) {
|
||||
NS_ENSURE_TRUE_VOID(
|
||||
mParent->SendOnConnectionStateChange(static_cast<int>(aState)));
|
||||
}
|
||||
|
||||
void OnPacketReceived(const std::string& aTransportId, MediaPacket& aPacket) {
|
||||
NS_ENSURE_TRUE_VOID(mParent->SendOnPacketReceived(aTransportId, aPacket));
|
||||
}
|
||||
|
||||
void OnEncryptedSending(const std::string& aTransportId,
|
||||
MediaPacket& aPacket) {
|
||||
NS_ENSURE_TRUE_VOID(mParent->SendOnEncryptedSending(aTransportId, aPacket));
|
||||
}
|
||||
|
||||
void OnStateChange(const std::string& aTransportId,
|
||||
TransportLayer::State aState) {
|
||||
NS_ENSURE_TRUE_VOID(mParent->SendOnStateChange(aTransportId, aState));
|
||||
}
|
||||
|
||||
void OnRtcpStateChange(const std::string& aTransportId,
|
||||
TransportLayer::State aState) {
|
||||
NS_ENSURE_TRUE_VOID(mParent->SendOnRtcpStateChange(aTransportId, aState));
|
||||
}
|
||||
|
||||
RefPtr<MediaTransportHandler> mHandler;
|
||||
|
||||
private:
|
||||
MediaTransportParent* mParent;
|
||||
};
|
||||
|
||||
MediaTransportParent::MediaTransportParent() : mImpl(new Impl(this)) {}
|
||||
|
||||
MediaTransportParent::~MediaTransportParent() {}
|
||||
|
||||
mozilla::ipc::IPCResult MediaTransportParent::RecvGetIceLog(
|
||||
const nsCString& pattern, GetIceLogResolver&& aResolve) {
|
||||
MOZ_ASSERT(GetMainThreadEventTarget()->IsOnCurrentThread());
|
||||
mImpl->mHandler->GetIceLog(pattern)->Then(
|
||||
GetMainThreadSerialEventTarget(), __func__,
|
||||
// IPDL doesn't give us a reject function, so we cannot reject async, so
|
||||
// we are forced to resolve with an empty result. Laaaaaaame.
|
||||
[aResolve = std::move(aResolve)](
|
||||
MediaTransportHandler::IceLogPromise::ResolveOrRejectValue&&
|
||||
aResult) mutable {
|
||||
WebrtcGlobalLog logLines;
|
||||
if (aResult.IsResolve()) {
|
||||
logLines = std::move(aResult.ResolveValue());
|
||||
}
|
||||
aResolve(logLines);
|
||||
});
|
||||
|
||||
return ipc::IPCResult::Ok();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult MediaTransportParent::RecvClearIceLog() {
|
||||
MOZ_ASSERT(GetMainThreadEventTarget()->IsOnCurrentThread());
|
||||
mImpl->mHandler->ClearIceLog();
|
||||
return ipc::IPCResult::Ok();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult MediaTransportParent::RecvEnterPrivateMode() {
|
||||
MOZ_ASSERT(GetMainThreadEventTarget()->IsOnCurrentThread());
|
||||
mImpl->mHandler->EnterPrivateMode();
|
||||
return ipc::IPCResult::Ok();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult MediaTransportParent::RecvExitPrivateMode() {
|
||||
MOZ_ASSERT(GetMainThreadEventTarget()->IsOnCurrentThread());
|
||||
mImpl->mHandler->ExitPrivateMode();
|
||||
return ipc::IPCResult::Ok();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult MediaTransportParent::RecvCreateIceCtx(
|
||||
const string& name, nsTArray<RTCIceServer>&& iceServers,
|
||||
const RTCIceTransportPolicy& icePolicy) {
|
||||
MOZ_ASSERT(GetMainThreadEventTarget()->IsOnCurrentThread());
|
||||
static bool nssStarted = false;
|
||||
if (!nssStarted) {
|
||||
if (NSS_NoDB_Init(nullptr) != SECSuccess) {
|
||||
MOZ_CRASH();
|
||||
return ipc::IPCResult::Fail(WrapNotNull(this), __func__,
|
||||
"NSS_NoDB_Init failed");
|
||||
}
|
||||
|
||||
if (NS_FAILED(mozilla::psm::InitializeCipherSuite())) {
|
||||
MOZ_CRASH();
|
||||
return ipc::IPCResult::Fail(WrapNotNull(this), __func__,
|
||||
"InitializeCipherSuite failed");
|
||||
}
|
||||
|
||||
mozilla::psm::DisableMD5();
|
||||
}
|
||||
|
||||
nssStarted = true;
|
||||
|
||||
nsresult rv = mImpl->mHandler->CreateIceCtx(name, iceServers, icePolicy);
|
||||
if (NS_FAILED(rv)) {
|
||||
return ipc::IPCResult::Fail(WrapNotNull(this), __func__,
|
||||
"MediaTransportHandler::Init failed");
|
||||
}
|
||||
return ipc::IPCResult::Ok();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult MediaTransportParent::RecvSetProxyServer(
|
||||
const PBrowserOrId& browserOrId, const nsCString& alpn) {
|
||||
MOZ_ASSERT(GetMainThreadEventTarget()->IsOnCurrentThread());
|
||||
mImpl->mHandler->SetProxyServer(NrSocketProxyConfig(browserOrId, alpn));
|
||||
return ipc::IPCResult::Ok();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult MediaTransportParent::RecvEnsureProvisionalTransport(
|
||||
const string& transportId, const string& localUfrag, const string& localPwd,
|
||||
const int& componentCount) {
|
||||
MOZ_ASSERT(GetMainThreadEventTarget()->IsOnCurrentThread());
|
||||
mImpl->mHandler->EnsureProvisionalTransport(transportId, localUfrag, localPwd,
|
||||
componentCount);
|
||||
return ipc::IPCResult::Ok();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult MediaTransportParent::RecvStartIceGathering(
|
||||
const bool& defaultRouteOnly, const net::NrIceStunAddrArray& stunAddrs) {
|
||||
MOZ_ASSERT(GetMainThreadEventTarget()->IsOnCurrentThread());
|
||||
mImpl->mHandler->StartIceGathering(defaultRouteOnly, stunAddrs);
|
||||
return ipc::IPCResult::Ok();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult MediaTransportParent::RecvActivateTransport(
|
||||
const string& transportId, const string& localUfrag, const string& localPwd,
|
||||
const int& componentCount, const string& remoteUfrag,
|
||||
const string& remotePwd, nsTArray<uint8_t>&& keyDer,
|
||||
nsTArray<uint8_t>&& certDer, const int& authType, const bool& dtlsClient,
|
||||
const DtlsDigestList& digests, const bool& privacyRequested) {
|
||||
MOZ_ASSERT(GetMainThreadEventTarget()->IsOnCurrentThread());
|
||||
mImpl->mHandler->ActivateTransport(
|
||||
transportId, localUfrag, localPwd, componentCount, remoteUfrag, remotePwd,
|
||||
keyDer, certDer, static_cast<SSLKEAType>(authType), dtlsClient, digests,
|
||||
privacyRequested);
|
||||
return ipc::IPCResult::Ok();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult MediaTransportParent::RecvRemoveTransportsExcept(
|
||||
const StringVector& transportIds) {
|
||||
MOZ_ASSERT(GetMainThreadEventTarget()->IsOnCurrentThread());
|
||||
std::set<std::string> ids(transportIds.begin(), transportIds.end());
|
||||
mImpl->mHandler->RemoveTransportsExcept(ids);
|
||||
return ipc::IPCResult::Ok();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult MediaTransportParent::RecvStartIceChecks(
|
||||
const bool& isControlling, const bool& isOfferer,
|
||||
const StringVector& iceOptions) {
|
||||
MOZ_ASSERT(GetMainThreadEventTarget()->IsOnCurrentThread());
|
||||
mImpl->mHandler->StartIceChecks(isControlling, isOfferer, iceOptions);
|
||||
return ipc::IPCResult::Ok();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult MediaTransportParent::RecvSendPacket(
|
||||
const string& transportId, const MediaPacket& packet) {
|
||||
MOZ_ASSERT(GetMainThreadEventTarget()->IsOnCurrentThread());
|
||||
MediaPacket copy(packet); // Laaaaaaame.
|
||||
mImpl->mHandler->SendPacket(transportId, std::move(copy));
|
||||
return ipc::IPCResult::Ok();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult MediaTransportParent::RecvAddIceCandidate(
|
||||
const string& transportId, const string& candidate) {
|
||||
MOZ_ASSERT(GetMainThreadEventTarget()->IsOnCurrentThread());
|
||||
mImpl->mHandler->AddIceCandidate(transportId, candidate);
|
||||
return ipc::IPCResult::Ok();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult MediaTransportParent::RecvUpdateNetworkState(
|
||||
const bool& online) {
|
||||
MOZ_ASSERT(GetMainThreadEventTarget()->IsOnCurrentThread());
|
||||
mImpl->mHandler->UpdateNetworkState(online);
|
||||
return ipc::IPCResult::Ok();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult MediaTransportParent::RecvGetIceStats(
|
||||
const string& transportId, const double& now,
|
||||
const RTCStatsReportInternal& reportIn, GetIceStatsResolver&& aResolve) {
|
||||
MOZ_ASSERT(GetMainThreadEventTarget()->IsOnCurrentThread());
|
||||
// Copy, because we are handed a const reference (lame), and put in a
|
||||
// unique_ptr because RTCStatsReportInternal doesn't have move semantics
|
||||
// (also lame).
|
||||
std::unique_ptr<dom::RTCStatsReportInternal> report(
|
||||
new dom::RTCStatsReportInternal(reportIn));
|
||||
|
||||
mImpl->mHandler->GetIceStats(transportId, now, std::move(report))
|
||||
->Then(
|
||||
GetMainThreadSerialEventTarget(), __func__,
|
||||
// IPDL doesn't give us a reject function, so we cannot reject async,
|
||||
// so we are forced to resolve with an unmodified result. Laaaaaaame.
|
||||
[aResolve = std::move(aResolve),
|
||||
reportIn](MediaTransportHandler::StatsPromise::ResolveOrRejectValue&&
|
||||
aResult) {
|
||||
if (aResult.IsResolve()) {
|
||||
MovableRTCStatsReportInternal copy(*aResult.ResolveValue());
|
||||
aResolve(copy);
|
||||
} else {
|
||||
aResolve(MovableRTCStatsReportInternal(reportIn));
|
||||
}
|
||||
});
|
||||
|
||||
return ipc::IPCResult::Ok();
|
||||
}
|
||||
|
||||
void MediaTransportParent::ActorDestroy(ActorDestroyReason aWhy) {
|
||||
MOZ_ASSERT(GetMainThreadEventTarget()->IsOnCurrentThread());
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
|
@ -72,9 +72,7 @@ class PeerConnectionCtx {
|
|||
std::map<const std::string, PeerConnectionImpl*> mPeerConnections;
|
||||
|
||||
PeerConnectionCtx()
|
||||
: mGMPReady(false),
|
||||
mTransportHandler(
|
||||
MediaTransportHandler::Create(GetMainThreadSerialEventTarget())) {}
|
||||
: mGMPReady(false), mTransportHandler(MediaTransportHandler::Create()) {}
|
||||
// This is a singleton, so don't copy construct it, etc.
|
||||
PeerConnectionCtx(const PeerConnectionCtx& other) = delete;
|
||||
void operator=(const PeerConnectionCtx& other) = delete;
|
||||
|
|
|
@ -308,7 +308,7 @@ PeerConnectionImpl::PeerConnectionImpl(const GlobalObject* aGlobal)
|
|||
mSTSThread(nullptr),
|
||||
mForceIceTcp(false),
|
||||
mMedia(nullptr),
|
||||
mTransportHandler(nullptr),
|
||||
mTransportHandler(MediaTransportHandler::Create()),
|
||||
mUuidGen(MakeUnique<PCUuidGenerator>()),
|
||||
mIceRestartCount(0),
|
||||
mIceRollbackCount(0),
|
||||
|
@ -403,10 +403,6 @@ nsresult PeerConnectionImpl::Initialize(PeerConnectionObserver& aObserver,
|
|||
mSTSThread = do_GetService(NS_SOCKETTRANSPORTSERVICE_CONTRACTID, &res);
|
||||
MOZ_ASSERT(mSTSThread);
|
||||
|
||||
// We do callback handling on STS instead of main to avoid media jank.
|
||||
// Someday, we may have a dedicated thread for this.
|
||||
mTransportHandler = MediaTransportHandler::Create(mSTSThread);
|
||||
|
||||
// Initialize NSS if we are in content process. For chrome process, NSS should
|
||||
// already been initialized.
|
||||
if (XRE_IsParentProcess()) {
|
||||
|
@ -468,8 +464,8 @@ nsresult PeerConnectionImpl::Initialize(PeerConnectionObserver& aObserver,
|
|||
iceServers = aConfiguration.mIceServers.Value();
|
||||
}
|
||||
|
||||
res = mTransportHandler->CreateIceCtx("PC:" + GetName(), iceServers,
|
||||
aConfiguration.mIceTransportPolicy);
|
||||
res = mTransportHandler->Init("PC:" + GetName(), iceServers,
|
||||
aConfiguration.mIceTransportPolicy);
|
||||
if (NS_FAILED(res)) {
|
||||
CSFLogError(LOGTAG, "%s: Failed to init mtransport", __FUNCTION__);
|
||||
return NS_ERROR_FAILURE;
|
||||
|
|
|
@ -24,8 +24,6 @@ LOCAL_INCLUDES += [
|
|||
|
||||
UNIFIED_SOURCES += [
|
||||
'MediaTransportHandler.cpp',
|
||||
'MediaTransportHandlerIPC.cpp',
|
||||
'MediaTransportParent.cpp',
|
||||
'PacketDumper.cpp',
|
||||
'PeerConnectionCtx.cpp',
|
||||
'PeerConnectionImpl.cpp',
|
||||
|
|
|
@ -18,7 +18,6 @@ Classes = [
|
|||
'type': 'mozilla::Preferences',
|
||||
'headers': ['mozilla/Preferences.h'],
|
||||
'constructor': 'mozilla::Preferences::GetInstanceForService',
|
||||
'processes': ProcessSelector.ALLOW_IN_SOCKET_PROCESS,
|
||||
},
|
||||
{
|
||||
'cid': '{064d9cee-1dd2-11b2-83e3-d25ab0193c26}',
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
#include "mozilla/dom/network/UDPSocketChild.h"
|
||||
#include "mozilla/net/AltDataOutputStreamChild.h"
|
||||
#include "mozilla/net/TrackingDummyChannelChild.h"
|
||||
#include "mozilla/net/SocketProcessBridgeChild.h"
|
||||
#ifdef MOZ_WEBRTC
|
||||
# include "mozilla/net/StunAddrsRequestChild.h"
|
||||
# include "mozilla/net/WebrtcProxyChannelChild.h"
|
||||
|
@ -68,7 +67,6 @@ void NeckoChild::InitNeckoChild() {
|
|||
}
|
||||
gNeckoChild = cpc->SendPNeckoConstructor();
|
||||
NS_ASSERTION(gNeckoChild, "PNecko Protocol init failed!");
|
||||
SocketProcessBridgeChild::GetSocketProcessBridge();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
include protocol PBackground;
|
||||
include protocol PMediaTransport;
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
|
@ -20,13 +19,9 @@ namespace net {
|
|||
*/
|
||||
nested(upto inside_cpow) sync protocol PSocketProcessBridge
|
||||
{
|
||||
manages PMediaTransport;
|
||||
|
||||
parent:
|
||||
async InitBackground(Endpoint<PBackgroundParent> aEndpoint);
|
||||
|
||||
async PMediaTransport();
|
||||
|
||||
both:
|
||||
async Test();
|
||||
};
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include "mozilla/net/NeckoChild.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "mozilla/dom/PMediaTransportChild.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
|
@ -48,49 +47,35 @@ SocketProcessBridgeChild::GetSingleton() {
|
|||
}
|
||||
|
||||
// static
|
||||
RefPtr<SocketProcessBridgeChild::GetPromise>
|
||||
SocketProcessBridgeChild::GetSocketProcessBridge() {
|
||||
void SocketProcessBridgeChild::EnsureSocketProcessBridge(
|
||||
std::function<void()>&& aOnSuccess, std::function<void()>&& aOnFailure) {
|
||||
MOZ_ASSERT(IsNeckoChild() && gNeckoChild);
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
if (!gNeckoChild) {
|
||||
return GetPromise::CreateAndReject(nsCString("No NeckoChild!"), __func__);
|
||||
aOnFailure();
|
||||
return;
|
||||
}
|
||||
|
||||
if (sSocketProcessBridgeChild) {
|
||||
return GetPromise::CreateAndResolve(sSocketProcessBridgeChild, __func__);
|
||||
aOnSuccess();
|
||||
return;
|
||||
}
|
||||
|
||||
return gNeckoChild->SendInitSocketProcessBridge()->Then(
|
||||
gNeckoChild->SendInitSocketProcessBridge()->Then(
|
||||
GetMainThreadSerialEventTarget(), __func__,
|
||||
[](NeckoChild::InitSocketProcessBridgePromise::ResolveOrRejectValue&&
|
||||
aResult) {
|
||||
if (!sSocketProcessBridgeChild) {
|
||||
if (aResult.IsReject()) {
|
||||
return GetPromise::CreateAndReject(
|
||||
nsCString("SendInitSocketProcessBridge failed"), __func__);
|
||||
}
|
||||
|
||||
if (!aResult.ResolveValue().IsValid()) {
|
||||
return GetPromise::CreateAndReject(
|
||||
nsCString(
|
||||
"SendInitSocketProcessBridge resolved with an invalid "
|
||||
"endpoint!"),
|
||||
__func__);
|
||||
}
|
||||
|
||||
if (!SocketProcessBridgeChild::Create(
|
||||
std::move(aResult.ResolveValue()))) {
|
||||
return GetPromise::CreateAndReject(
|
||||
nsCString("SendInitSocketProcessBridge resolved with a valid "
|
||||
"endpoint, "
|
||||
"but SocketProcessBridgeChild::Create failed!"),
|
||||
__func__);
|
||||
[onSuccess = std::move(aOnSuccess), onFailure = std::move(aOnFailure)](
|
||||
Endpoint<PSocketProcessBridgeChild>&& aEndpoint) {
|
||||
if (aEndpoint.IsValid()) {
|
||||
if (SocketProcessBridgeChild::Create(std::move(aEndpoint))) {
|
||||
onSuccess();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
return GetPromise::CreateAndResolve(sSocketProcessBridgeChild,
|
||||
__func__);
|
||||
});
|
||||
onFailure();
|
||||
},
|
||||
[onFailure = std::move(aOnFailure)](
|
||||
const mozilla::ipc::ResponseRejectReason) { onFailure(); });
|
||||
}
|
||||
|
||||
SocketProcessBridgeChild::SocketProcessBridgeChild(
|
||||
|
@ -148,21 +133,5 @@ void SocketProcessBridgeChild::DeferredDestroy() {
|
|||
sSocketProcessBridgeChild = nullptr;
|
||||
}
|
||||
|
||||
dom::PMediaTransportChild*
|
||||
SocketProcessBridgeChild::AllocPMediaTransportChild() {
|
||||
// We don't allocate here: MediaTransportHandlerIPC is in charge of that,
|
||||
// so we don't need to know the implementation particulars here.
|
||||
MOZ_ASSERT_UNREACHABLE(
|
||||
"The only thing that ought to be creating a PMediaTransportChild is "
|
||||
"MediaTransportHandlerIPC!");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool SocketProcessBridgeChild::DeallocPMediaTransportChild(
|
||||
dom::PMediaTransportChild* aActor) {
|
||||
delete aActor;
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace net
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -22,10 +22,10 @@ class SocketProcessBridgeChild final : public PSocketProcessBridgeChild,
|
|||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIOBSERVER
|
||||
|
||||
static bool Create(Endpoint<PSocketProcessBridgeChild>&& aEndpoint);
|
||||
static already_AddRefed<SocketProcessBridgeChild> GetSingleton();
|
||||
typedef MozPromise<RefPtr<SocketProcessBridgeChild>, nsCString, false>
|
||||
GetPromise;
|
||||
static RefPtr<GetPromise> GetSocketProcessBridge();
|
||||
static void EnsureSocketProcessBridge(std::function<void()>&& aOnSuccess,
|
||||
std::function<void()>&& aOnFailure);
|
||||
|
||||
mozilla::ipc::IPCResult RecvTest();
|
||||
void ActorDestroy(ActorDestroyReason aWhy) override;
|
||||
|
@ -34,12 +34,8 @@ class SocketProcessBridgeChild final : public PSocketProcessBridgeChild,
|
|||
bool Inited() const { return mInited; };
|
||||
ProcessId SocketProcessPid() const { return mSocketProcessPid; };
|
||||
|
||||
dom::PMediaTransportChild* AllocPMediaTransportChild();
|
||||
bool DeallocPMediaTransportChild(dom::PMediaTransportChild* aActor);
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(SocketProcessBridgeChild);
|
||||
static bool Create(Endpoint<PSocketProcessBridgeChild>&& aEndpoint);
|
||||
explicit SocketProcessBridgeChild(
|
||||
Endpoint<PSocketProcessBridgeChild>&& aEndpoint);
|
||||
virtual ~SocketProcessBridgeChild();
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
|
||||
#include "mozilla/ipc/BackgroundParent.h"
|
||||
#include "SocketProcessChild.h"
|
||||
#include "mozilla/dom/MediaTransportParent.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
|
@ -57,21 +56,5 @@ void SocketProcessBridgeParent::DeferredDestroy() {
|
|||
SocketProcessChild::GetSingleton()->DestroySocketProcessBridgeParent(mId);
|
||||
}
|
||||
|
||||
dom::PMediaTransportParent*
|
||||
SocketProcessBridgeParent::AllocPMediaTransportParent() {
|
||||
#ifdef MOZ_WEBRTC
|
||||
return new MediaTransportParent;
|
||||
#endif
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool SocketProcessBridgeParent::DeallocPMediaTransportParent(
|
||||
dom::PMediaTransportParent* aActor) {
|
||||
#ifdef MOZ_WEBRTC
|
||||
delete aActor;
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace net
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -29,9 +29,6 @@ class SocketProcessBridgeParent final : public PSocketProcessBridgeParent {
|
|||
void ActorDestroy(ActorDestroyReason aWhy) override;
|
||||
void DeferredDestroy();
|
||||
|
||||
dom::PMediaTransportParent* AllocPMediaTransportParent();
|
||||
bool DeallocPMediaTransportParent(dom::PMediaTransportParent* aActor);
|
||||
|
||||
private:
|
||||
~SocketProcessBridgeParent();
|
||||
|
||||
|
|
|
@ -62,8 +62,6 @@ FINAL_LIBRARY = 'xul'
|
|||
LOCAL_INCLUDES += [
|
||||
'/caps',
|
||||
'/dom/base',
|
||||
'/media/mtransport',
|
||||
'/media/webrtc',
|
||||
'/modules/libjar',
|
||||
'/netwerk/base',
|
||||
'/netwerk/protocol/http',
|
||||
|
|
|
@ -18,9 +18,7 @@ treeherder:
|
|||
'Fxfn-r-e10s': 'Firefox functional tests (remote) with e10s'
|
||||
'M': 'Mochitests'
|
||||
'M-sw': 'Mochitests with serviceworker redesign'
|
||||
'M-spi': 'Mochitests with socket process'
|
||||
'M-e10s': 'Mochitests with e10s'
|
||||
'M-e10s-spi': 'Mochitests with socket process and e10s'
|
||||
'M-sw-e10s': 'Mochitests with serviceworker redesign and e10s'
|
||||
'M-V': 'Mochitests on Valgrind'
|
||||
'MSI': 'Repack installers into MSIs'
|
||||
|
|
|
@ -7,7 +7,6 @@ job-defaults:
|
|||
by-test-platform:
|
||||
linux64/debug: both
|
||||
default: false
|
||||
socketprocess-e10s: false
|
||||
mozharness:
|
||||
script:
|
||||
by-test-platform:
|
||||
|
@ -284,10 +283,6 @@ mochitest-media:
|
|||
macosx64-ccov/debug: 7200
|
||||
default: 5400
|
||||
run-on-projects: built-projects
|
||||
socketprocess-e10s:
|
||||
by-test-platform:
|
||||
android.*: false
|
||||
default: both
|
||||
loopback-video: true
|
||||
virtualization:
|
||||
by-test-platform:
|
||||
|
|
|
@ -136,12 +136,6 @@ serviceworker_e10s
|
|||
For test suites which distinguish whether or not they run with the serviceworker
|
||||
e10s redesign enabled.
|
||||
|
||||
socketprocess_e10s
|
||||
==================
|
||||
|
||||
For test suites which distinguish whether or not they run with the socket
|
||||
process enabled.
|
||||
|
||||
e10s
|
||||
====
|
||||
|
||||
|
|
|
@ -223,14 +223,6 @@ test_description_schema = Schema({
|
|||
'test-platform', 'project',
|
||||
Any(bool, 'both')),
|
||||
|
||||
# Whether to run this task with the socket process enabled (desktop-test
|
||||
# only). If 'both', run one task with and one task without. Tasks with
|
||||
# this enabled have have "-spi" appended to the test name and treeherder
|
||||
# group.
|
||||
Optional('socketprocess-e10s'): optionally_keyed_by(
|
||||
'test-platform', 'project',
|
||||
Any(bool, 'both')),
|
||||
|
||||
# Whether the task should run with WebRender enabled or not.
|
||||
Optional('webrender'): bool,
|
||||
|
||||
|
@ -492,7 +484,6 @@ def set_defaults(config, tests):
|
|||
test.setdefault('docker-image', {'in-tree': 'desktop1604-test'})
|
||||
test.setdefault('checkout', False)
|
||||
test.setdefault('serviceworker-e10s', False)
|
||||
test.setdefault('socketprocess-e10s', False)
|
||||
test.setdefault('require-signed-extensions', False)
|
||||
|
||||
test['mozharness'].setdefault('extra-options', [])
|
||||
|
@ -734,7 +725,6 @@ def handle_keyed_by(config, tests):
|
|||
'chunks',
|
||||
'serviceworker-e10s',
|
||||
'e10s',
|
||||
'socketprocess-e10s',
|
||||
'suite',
|
||||
'run-on-projects',
|
||||
'os-groups',
|
||||
|
@ -864,10 +854,6 @@ def handle_run_on_projects(config, tests):
|
|||
@transforms.add
|
||||
def split_serviceworker_e10s(config, tests):
|
||||
for test in tests:
|
||||
if test['attributes'].get('socketprocess_e10s'):
|
||||
yield test
|
||||
continue
|
||||
|
||||
sw = test.pop('serviceworker-e10s')
|
||||
|
||||
test['serviceworker-e10s'] = False
|
||||
|
@ -926,39 +912,6 @@ def split_e10s(config, tests):
|
|||
yield test
|
||||
|
||||
|
||||
@transforms.add
|
||||
def split_socketprocess_e10s(config, tests):
|
||||
for test in tests:
|
||||
if test['attributes'].get('serviceworker_e10s'):
|
||||
yield test
|
||||
continue
|
||||
|
||||
sw = test.pop('socketprocess-e10s')
|
||||
|
||||
test['socketprocess-e10s'] = False
|
||||
test['attributes']['socketprocess_e10s'] = False
|
||||
|
||||
if sw == 'both':
|
||||
yield copy.deepcopy(test)
|
||||
sw = True
|
||||
if sw:
|
||||
test['description'] += " with socket process enabled"
|
||||
test['test-name'] += '-spi'
|
||||
test['try-name'] += '-spi'
|
||||
test['attributes']['socketprocess_e10s'] = True
|
||||
group, symbol = split_symbol(test['treeherder-symbol'])
|
||||
if group != '?':
|
||||
group += '-spi'
|
||||
else:
|
||||
symbol += '-spi'
|
||||
test['treeherder-symbol'] = join_symbol(group, symbol)
|
||||
test['mozharness']['extra-options'].append(
|
||||
'--setpref="media.peerconnection.mtransport_process=true"')
|
||||
test['mozharness']['extra-options'].append(
|
||||
'--setpref="network.process.enabled=true"')
|
||||
yield test
|
||||
|
||||
|
||||
@transforms.add
|
||||
def split_chunks(config, tests):
|
||||
"""Based on the 'chunks' key, split tests up into chunks by duplicating
|
||||
|
|
|
@ -2551,8 +2551,6 @@ toolbar#nav-bar {
|
|||
"headless": options.headless,
|
||||
"serviceworker_e10s": self.extraPrefs.get(
|
||||
'dom.serviceWorkers.parent_intercept', False),
|
||||
"socketprocess_e10s": self.extraPrefs.get(
|
||||
'network.process.enabled', False),
|
||||
})
|
||||
|
||||
self.setTestRoot(options)
|
||||
|
@ -2779,8 +2777,6 @@ toolbar#nav-bar {
|
|||
self.log.info("runtests.py | Running with e10s: {}".format(options.e10s))
|
||||
self.log.info("runtests.py | Running with serviceworker_e10s: {}".format(
|
||||
mozinfo.info.get('serviceworker_e10s', False)))
|
||||
self.log.info("runtests.py | Running with socketprocess_e10s: {}".format(
|
||||
mozinfo.info.get('socketprocess_e10s', False)))
|
||||
self.log.info("runtests.py | Running tests: start.\n")
|
||||
ret, _ = self.runApp(
|
||||
testURL,
|
||||
|
|
Загрузка…
Ссылка в новой задаче