зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1616875: Move some receiver-related testing functions from RTCPeerConnection to RTCRtpReceiver. r=ng,smaug
Differential Revision: https://phabricator.services.mozilla.com/D64262 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
88d739273e
Коммит
72efb619af
|
@ -1547,33 +1547,6 @@ class RTCPeerConnection {
|
|||
.map(transceiver => transceiver.receiver);
|
||||
}
|
||||
|
||||
// test-only: insert a contributing source entry for a track
|
||||
mozInsertAudioLevelForContributingSource(
|
||||
receiver,
|
||||
source,
|
||||
timestamp,
|
||||
rtpTimestamp,
|
||||
hasLevel,
|
||||
level
|
||||
) {
|
||||
this._impl.insertAudioLevelForContributingSource(
|
||||
receiver.track,
|
||||
source,
|
||||
timestamp,
|
||||
rtpTimestamp,
|
||||
hasLevel,
|
||||
level
|
||||
);
|
||||
}
|
||||
|
||||
mozAddRIDExtension(receiver, extensionId) {
|
||||
this._impl.addRIDExtension(receiver.track, extensionId);
|
||||
}
|
||||
|
||||
mozAddRIDFilter(receiver, rid) {
|
||||
this._impl.addRIDFilter(receiver.track, rid);
|
||||
}
|
||||
|
||||
mozSetPacketCallback(callback) {
|
||||
this._onPacket = callback;
|
||||
}
|
||||
|
|
|
@ -45,8 +45,7 @@
|
|||
// Audio level as expected to be returned
|
||||
const expectedAudioLevel0 = 10 ** (-audioLevel0 / 20);
|
||||
|
||||
SpWrap(test.pcRemote).mozInsertAudioLevelForContributingSource(
|
||||
remoteReceiver,
|
||||
SpecialPowers.wrap(remoteReceiver).mozInsertAudioLevelForContributingSource(
|
||||
csrc0,
|
||||
timestamp0,
|
||||
rtpTimestamp0,
|
||||
|
@ -59,8 +58,7 @@
|
|||
const hasAudioLevel1 = false;
|
||||
const audioLevel1 = 0;
|
||||
|
||||
SpWrap(test.pcRemote).mozInsertAudioLevelForContributingSource(
|
||||
remoteReceiver,
|
||||
SpecialPowers.wrap(remoteReceiver).mozInsertAudioLevelForContributingSource(
|
||||
csrc1,
|
||||
timestamp1,
|
||||
rtpTimestamp1,
|
||||
|
@ -73,8 +71,7 @@
|
|||
const hasAudioLevel2 = true;
|
||||
const audioLevel2 = 127;
|
||||
|
||||
SpWrap(test.pcRemote).mozInsertAudioLevelForContributingSource(
|
||||
remoteReceiver,
|
||||
SpecialPowers.wrap(remoteReceiver).mozInsertAudioLevelForContributingSource(
|
||||
csrc2,
|
||||
timestamp2,
|
||||
rtpTimestamp2,
|
||||
|
@ -126,8 +123,7 @@
|
|||
// Larger offsets are further back in time
|
||||
const testOffsets = [3, 7, 5, 6, 1, 4];
|
||||
for (const offset of testOffsets) {
|
||||
SpWrap(test.pcLocal).mozInsertAudioLevelForContributingSource(
|
||||
localReceiver,
|
||||
SpecialPowers.wrap(localReceiver).mozInsertAudioLevelForContributingSource(
|
||||
offset, // Using offset for SSRC for convenience
|
||||
timestamp3 - offset,
|
||||
rtpTimestamp3,
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
is(receivers.length, 1, "We have exactly one RTP receiver");
|
||||
const receiver = receivers[0];
|
||||
|
||||
SpecialPowers.wrap(pc._pc).mozAddRIDExtension(receiver, extensionId);
|
||||
SpecialPowers.wrap(receiver).mozAddRIDExtension(extensionId);
|
||||
}
|
||||
|
||||
function selectRecvRID(pc, rid) {
|
||||
|
@ -26,7 +26,7 @@
|
|||
is(receivers.length, 1, "We have exactly one RTP receiver");
|
||||
const receiver = receivers[0];
|
||||
|
||||
SpecialPowers.wrap(pc._pc).mozAddRIDFilter(receiver, rid);
|
||||
SpecialPowers.wrap(receiver).mozAddRIDFilter(rid);
|
||||
}
|
||||
|
||||
runNetworkTest(() =>
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
is(receivers.length, 1, "We have exactly one RTP receiver");
|
||||
const receiver = receivers[0];
|
||||
|
||||
SpecialPowers.wrap(pc._pc).mozAddRIDExtension(receiver, extensionId);
|
||||
SpecialPowers.wrap(receiver).mozAddRIDExtension(extensionId);
|
||||
}
|
||||
|
||||
function selectRecvRID(pc, rid) {
|
||||
|
@ -30,7 +30,7 @@
|
|||
is(receivers.length, 1, "We have exactly one RTP receiver");
|
||||
const receiver = receivers[0];
|
||||
|
||||
SpecialPowers.wrap(pc._pc).mozAddRIDFilter(receiver, rid);
|
||||
SpecialPowers.wrap(receiver).mozAddRIDFilter(rid);
|
||||
}
|
||||
|
||||
async function changeSourceResolution(test, emitter, width, height) {
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
is(receivers.length, 1, "We have exactly one RTP receiver");
|
||||
const receiver = receivers[0];
|
||||
|
||||
SpecialPowers.wrap(pc._pc).mozAddRIDExtension(receiver, extensionId);
|
||||
SpecialPowers.wrap(receiver).mozAddRIDExtension(extensionId);
|
||||
}
|
||||
|
||||
function selectRecvRID(pc, rid) {
|
||||
|
@ -27,7 +27,7 @@
|
|||
is(receivers.length, 1, "We have exactly one RTP receiver");
|
||||
const receiver = receivers[0];
|
||||
|
||||
SpecialPowers.wrap(pc._pc).mozAddRIDFilter(receiver, rid);
|
||||
SpecialPowers.wrap(receiver).mozAddRIDFilter(rid);
|
||||
}
|
||||
|
||||
runNetworkTest(() =>
|
||||
|
|
|
@ -60,20 +60,6 @@ interface PeerConnectionImpl {
|
|||
[Throws]
|
||||
void closeStreams();
|
||||
|
||||
[Throws]
|
||||
void addRIDExtension(MediaStreamTrack recvTrack, unsigned short extensionId);
|
||||
[Throws]
|
||||
void addRIDFilter(MediaStreamTrack recvTrack, DOMString rid);
|
||||
|
||||
// Inserts CSRC data for the RtpSourceObserver for testing
|
||||
[Throws]
|
||||
void insertAudioLevelForContributingSource(MediaStreamTrack recvTrack,
|
||||
unsigned long source,
|
||||
DOMHighResTimeStamp timestamp,
|
||||
unsigned long rtpTimestamp,
|
||||
boolean hasLevel,
|
||||
byte level);
|
||||
|
||||
[Throws]
|
||||
void enablePacketDump(unsigned long level,
|
||||
mozPacketDumpType type,
|
||||
|
|
|
@ -138,18 +138,6 @@ interface RTCPeerConnection : EventTarget {
|
|||
sequence<RTCRtpReceiver> getReceivers();
|
||||
sequence<RTCRtpTransceiver> getTransceivers();
|
||||
|
||||
// test-only: for testing getContributingSources
|
||||
[ChromeOnly]
|
||||
void mozInsertAudioLevelForContributingSource(RTCRtpReceiver receiver,
|
||||
unsigned long source,
|
||||
DOMHighResTimeStamp timestamp,
|
||||
unsigned long rtpTimestamp,
|
||||
boolean hasLevel,
|
||||
byte level);
|
||||
[ChromeOnly]
|
||||
void mozAddRIDExtension(RTCRtpReceiver receiver, unsigned short extensionId);
|
||||
[ChromeOnly]
|
||||
void mozAddRIDFilter(RTCRtpReceiver receiver, DOMString rid);
|
||||
[ChromeOnly]
|
||||
void mozSetPacketCallback(mozPacketCallback callback);
|
||||
[ChromeOnly]
|
||||
|
|
|
@ -16,4 +16,16 @@ interface RTCRtpReceiver {
|
|||
sequence<RTCRtpContributingSource> getContributingSources();
|
||||
[Pref="media.peerconnection.rtpsourcesapi.enabled"]
|
||||
sequence<RTCRtpSynchronizationSource> getSynchronizationSources();
|
||||
|
||||
[ChromeOnly]
|
||||
void mozAddRIDExtension(unsigned short extensionId);
|
||||
[ChromeOnly]
|
||||
void mozAddRIDFilter(DOMString rid);
|
||||
// test-only: for testing getContributingSources
|
||||
[ChromeOnly]
|
||||
void mozInsertAudioLevelForContributingSource(unsigned long source,
|
||||
DOMHighResTimeStamp timestamp,
|
||||
unsigned long rtpTimestamp,
|
||||
boolean hasLevel,
|
||||
byte level);
|
||||
};
|
||||
|
|
|
@ -1693,35 +1693,6 @@ void PeerConnectionImpl::DumpPacket_m(size_t level, dom::mozPacketDumpType type,
|
|||
mPCObserver->OnPacket(level, type, sending, arrayBuffer, jrv);
|
||||
}
|
||||
|
||||
// test-only: adds fake CSRCs and audio data
|
||||
nsresult PeerConnectionImpl::InsertAudioLevelForContributingSource(
|
||||
const dom::MediaStreamTrack& aRecvTrack, const unsigned long aSource,
|
||||
const DOMHighResTimeStamp aTimestamp, const unsigned long aRtpTimestamp,
|
||||
const bool aHasLevel, const uint8_t aLevel) {
|
||||
PC_AUTO_ENTER_API_CALL(true);
|
||||
std::vector<RefPtr<TransceiverImpl>>& transceivers =
|
||||
mMedia->GetTransceivers();
|
||||
for (RefPtr<TransceiverImpl>& transceiver : transceivers) {
|
||||
if (transceiver->HasReceiveTrack(&aRecvTrack)) {
|
||||
transceiver->InsertAudioLevelForContributingSource(
|
||||
aSource, aTimestamp, aRtpTimestamp, aHasLevel, aLevel);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult PeerConnectionImpl::AddRIDExtension(MediaStreamTrack& aRecvTrack,
|
||||
unsigned short aExtensionId) {
|
||||
return mMedia->AddRIDExtension(aRecvTrack, aExtensionId);
|
||||
}
|
||||
|
||||
nsresult PeerConnectionImpl::AddRIDFilter(MediaStreamTrack& aRecvTrack,
|
||||
const nsAString& aRid) {
|
||||
return mMedia->AddRIDFilter(aRecvTrack, aRid);
|
||||
}
|
||||
|
||||
nsresult PeerConnectionImpl::EnablePacketDump(unsigned long level,
|
||||
dom::mozPacketDumpType type,
|
||||
bool sending) {
|
||||
|
|
|
@ -306,32 +306,6 @@ class PeerConnectionImpl final
|
|||
rv = ReplaceTrackNoRenegotiation(aTransceiver, aWithTrack);
|
||||
}
|
||||
|
||||
// test-only: called from contributing sources mochitests.
|
||||
NS_IMETHODIMP_TO_ERRORRESULT(InsertAudioLevelForContributingSource,
|
||||
ErrorResult& rv,
|
||||
const dom::MediaStreamTrack& aRecvTrack,
|
||||
const unsigned long aSource,
|
||||
const DOMHighResTimeStamp aTimestamp,
|
||||
const unsigned long aRtpTimestamp,
|
||||
const bool aHasLevel, const uint8_t aLevel) {
|
||||
rv = InsertAudioLevelForContributingSource(
|
||||
aRecvTrack, aSource, aTimestamp, aRtpTimestamp, aHasLevel, aLevel);
|
||||
}
|
||||
|
||||
// test-only: called from simulcast mochitests.
|
||||
NS_IMETHODIMP_TO_ERRORRESULT(AddRIDExtension, ErrorResult& rv,
|
||||
dom::MediaStreamTrack& aRecvTrack,
|
||||
unsigned short aExtensionId) {
|
||||
rv = AddRIDExtension(aRecvTrack, aExtensionId);
|
||||
}
|
||||
|
||||
// test-only: called from simulcast mochitests.
|
||||
NS_IMETHODIMP_TO_ERRORRESULT(AddRIDFilter, ErrorResult& rv,
|
||||
dom::MediaStreamTrack& aRecvTrack,
|
||||
const nsAString& aRid) {
|
||||
rv = AddRIDFilter(aRecvTrack, aRid);
|
||||
}
|
||||
|
||||
// test-only
|
||||
NS_IMETHODIMP_TO_ERRORRESULT(EnablePacketDump, ErrorResult& rv,
|
||||
unsigned long level, dom::mozPacketDumpType type,
|
||||
|
|
|
@ -740,33 +740,6 @@ std::string PeerConnectionMedia::GetTransportIdMatchingSendTrack(
|
|||
return std::string();
|
||||
}
|
||||
|
||||
nsresult PeerConnectionMedia::AddRIDExtension(MediaStreamTrack& aRecvTrack,
|
||||
unsigned short aExtensionId) {
|
||||
DebugOnly<bool> trackFound = false;
|
||||
for (RefPtr<TransceiverImpl>& transceiver : mTransceivers) {
|
||||
if (transceiver->HasReceiveTrack(&aRecvTrack)) {
|
||||
transceiver->AddRIDExtension(aExtensionId);
|
||||
trackFound = true;
|
||||
}
|
||||
}
|
||||
MOZ_ASSERT(trackFound);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult PeerConnectionMedia::AddRIDFilter(MediaStreamTrack& aRecvTrack,
|
||||
const nsAString& aRid) {
|
||||
DebugOnly<bool> trackFound = false;
|
||||
for (RefPtr<TransceiverImpl>& transceiver : mTransceivers) {
|
||||
MOZ_ASSERT(transceiver->HasReceiveTrack(&aRecvTrack));
|
||||
if (transceiver->HasReceiveTrack(&aRecvTrack)) {
|
||||
transceiver->AddRIDFilter(aRid);
|
||||
trackFound = true;
|
||||
}
|
||||
}
|
||||
MOZ_ASSERT(trackFound);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void PeerConnectionMedia::IceGatheringStateChange_s(
|
||||
dom::RTCIceGatheringState aState) {
|
||||
ASSERT_ON_THREAD(mSTSThread);
|
||||
|
|
|
@ -91,11 +91,6 @@ class PeerConnectionMedia : public sigslot::has_slots<> {
|
|||
const dom::MediaStreamTrack* aTrack,
|
||||
nsTArray<RefPtr<MediaPipelineTransmit>>* aPipelines);
|
||||
|
||||
nsresult AddRIDExtension(dom::MediaStreamTrack& aRecvTrack,
|
||||
unsigned short aExtensionId);
|
||||
|
||||
nsresult AddRIDFilter(dom::MediaStreamTrack& aRecvTrack,
|
||||
const nsAString& aRid);
|
||||
std::string GetTransportIdMatchingSendTrack(
|
||||
const dom::MediaStreamTrack& aTrack) const;
|
||||
|
||||
|
|
|
@ -511,6 +511,31 @@ void RTCRtpReceiver::UpdateStreams(StreamAssociationChanges* aChanges) {
|
|||
}
|
||||
}
|
||||
|
||||
void RTCRtpReceiver::MozAddRIDExtension(unsigned short aExtensionId) {
|
||||
if (mPipeline) {
|
||||
mPipeline->AddRIDExtension_m(aExtensionId);
|
||||
}
|
||||
}
|
||||
|
||||
void RTCRtpReceiver::MozAddRIDFilter(const nsAString& aRid) {
|
||||
if (mPipeline) {
|
||||
mPipeline->AddRIDFilter_m(NS_ConvertUTF16toUTF8(aRid).get());
|
||||
}
|
||||
}
|
||||
|
||||
// test-only: adds fake CSRCs and audio data
|
||||
void RTCRtpReceiver::MozInsertAudioLevelForContributingSource(
|
||||
const uint32_t aSource, const DOMHighResTimeStamp aTimestamp,
|
||||
const uint32_t aRtpTimestamp, const bool aHasLevel, const uint8_t aLevel) {
|
||||
if (!mPipeline || mPipeline->IsVideo() || !mPipeline->Conduit()) {
|
||||
return;
|
||||
}
|
||||
WebrtcAudioConduit* audio_conduit =
|
||||
static_cast<WebrtcAudioConduit*>(mPipeline->Conduit());
|
||||
audio_conduit->InsertAudioLevelForContributingSource(
|
||||
aSource, aTimestamp, aRtpTimestamp, aHasLevel, aLevel);
|
||||
}
|
||||
|
||||
void RTCRtpReceiver::OnRtcpBye() { SetReceiveTrackMuted(true); }
|
||||
|
||||
void RTCRtpReceiver::OnRtcpTimeout() { SetReceiveTrackMuted(true); }
|
||||
|
|
|
@ -55,6 +55,13 @@ class RTCRtpReceiver : public nsISupports,
|
|||
nsTArray<dom::RTCRtpContributingSource>& aSources);
|
||||
void GetSynchronizationSources(
|
||||
nsTArray<dom::RTCRtpSynchronizationSource>& aSources);
|
||||
// test-only: called from simulcast mochitests.
|
||||
void MozAddRIDExtension(unsigned short aExtensionId);
|
||||
void MozAddRIDFilter(const nsAString& aRid);
|
||||
// test-only: insert fake CSRCs and audio levels for testing
|
||||
void MozInsertAudioLevelForContributingSource(
|
||||
const uint32_t aSource, const DOMHighResTimeStamp aTimestamp,
|
||||
const uint32_t aRtpTimestamp, const bool aHasLevel, const uint8_t aLevel);
|
||||
|
||||
nsPIDOMWindowInner* GetParentObject() const;
|
||||
nsTArray<RefPtr<RTCStatsPromise>> GetStatsInternal();
|
||||
|
|
|
@ -507,22 +507,6 @@ RefPtr<MediaPipelineReceive> TransceiverImpl::GetReceivePipeline() {
|
|||
return mReceivePipeline;
|
||||
}
|
||||
|
||||
void TransceiverImpl::AddRIDExtension(unsigned short aExtensionId) {
|
||||
if (mJsepTransceiver->IsStopped()) {
|
||||
return;
|
||||
}
|
||||
|
||||
mReceivePipeline->AddRIDExtension_m(aExtensionId);
|
||||
}
|
||||
|
||||
void TransceiverImpl::AddRIDFilter(const nsAString& aRid) {
|
||||
if (mJsepTransceiver->IsStopped()) {
|
||||
return;
|
||||
}
|
||||
|
||||
mReceivePipeline->AddRIDFilter_m(NS_ConvertUTF16toUTF8(aRid).get());
|
||||
}
|
||||
|
||||
static nsresult JsepCodecDescToAudioCodecConfig(
|
||||
const JsepCodecDescription& aCodec, UniquePtr<AudioCodecConfig>* aConfig) {
|
||||
MOZ_ASSERT(aCodec.mType == SdpMediaSection::kAudio);
|
||||
|
@ -823,16 +807,4 @@ bool TransceiverImpl::IsVideo() const {
|
|||
return mJsepTransceiver->GetMediaType() == SdpMediaSection::MediaType::kVideo;
|
||||
}
|
||||
|
||||
void TransceiverImpl::InsertAudioLevelForContributingSource(
|
||||
const uint32_t aSource, const int64_t aTimestamp,
|
||||
const uint32_t aRtpTimestamp, const bool aHasLevel, const uint8_t aLevel) {
|
||||
if (!IsValid() || IsVideo()) {
|
||||
return;
|
||||
}
|
||||
WebrtcAudioConduit* audio_conduit =
|
||||
static_cast<WebrtcAudioConduit*>(mConduit.get());
|
||||
audio_conduit->InsertAudioLevelForContributingSource(
|
||||
aSource, aTimestamp, aRtpTimestamp, aHasLevel, aLevel);
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -107,10 +107,6 @@ class TransceiverImpl : public nsISupports, public nsWrapperCache {
|
|||
return mJsepTransceiver->mTransport.mTransportId;
|
||||
}
|
||||
|
||||
void AddRIDExtension(unsigned short aExtensionId);
|
||||
|
||||
void AddRIDFilter(const nsAString& aRid);
|
||||
|
||||
bool IsVideo() const;
|
||||
|
||||
bool IsSending() const {
|
||||
|
@ -121,12 +117,6 @@ class TransceiverImpl : public nsISupports, public nsWrapperCache {
|
|||
void GetRtpSources(const int64_t aTimeNow,
|
||||
nsTArray<dom::RTCRtpSourceEntry>& outSources) const;
|
||||
|
||||
// test-only: insert fake CSRCs and audio levels for testing
|
||||
void InsertAudioLevelForContributingSource(const uint32_t aSource,
|
||||
const int64_t aTimestamp,
|
||||
const uint32_t aRtpTimestamp,
|
||||
const bool aHasLevel,
|
||||
const uint8_t aLevel);
|
||||
MediaSessionConduit* GetConduit() const { return mConduit; }
|
||||
|
||||
// nsISupports
|
||||
|
|
Загрузка…
Ссылка в новой задаче