diff --git a/dom/media/tests/mochitest/test_peerConnection_simulcastOffer.html b/dom/media/tests/mochitest/test_peerConnection_simulcastOffer.html index e9d5a48d74cfa..b70580763c671 100644 --- a/dom/media/tests/mochitest/test_peerConnection_simulcastOffer.html +++ b/dom/media/tests/mochitest/test_peerConnection_simulcastOffer.html @@ -86,8 +86,8 @@ ok(vremote, "Should have remote video element for pcRemote"); ok(vlocal.videoWidth > 0, "source width is positive"); ok(vlocal.videoHeight > 0, "source height is positive"); - is(vremote.videoWidth, vlocal.videoWidth, "sink is same width as source"); - is(vremote.videoHeight, vlocal.videoHeight, "sink is same height as source"); + is(vremote.videoWidth, vlocal.videoWidth / 2, "sink is 1/2 width of source"); + is(vremote.videoHeight, vlocal.videoHeight / 2, "sink is 1/2 height of source"); }, function PC_REMOTE_SET_RTP_SECOND_RID(test) { // Now, cause pcRemote to filter out everything but the second SSRC. @@ -116,18 +116,8 @@ ok(vremote, "Should have remote video element for pcRemote"); ok(vlocal.videoWidth > 0, "source width is positive"); ok(vlocal.videoHeight > 0, "source height is positive"); - is(vremote.videoWidth, vlocal.videoWidth / 2, "sink is 1/2 width of source"); - is(vremote.videoHeight, vlocal.videoHeight / 2, "sink is 1/2 height of source"); - }, - function PC_REMOTE_SET_RTP_NONEXISTENT_RID(test) { - // Now, cause pcRemote to filter out everything, just to make sure - // selectRecvSsrc is working. - selectRecvSsrc(test.pcRemote, 2); - }, - function PC_REMOTE_ENSURE_NO_FRAMES() { - var vremote = test.pcRemote.remoteMediaElements[0]; - ok(vremote, "Should have remote video element for pcRemote"); - return helper.verifyNoFrames(vremote); + is(vremote.videoWidth, vlocal.videoWidth, "sink is same width as source"); + is(vremote.videoHeight, vlocal.videoHeight, "sink is same height as source"); }, ]); diff --git a/media/webrtc/signaling/src/media-conduit/AudioConduit.h b/media/webrtc/signaling/src/media-conduit/AudioConduit.h index bc5d4cb8fe708..ecdd427d382c3 100755 --- a/media/webrtc/signaling/src/media-conduit/AudioConduit.h +++ b/media/webrtc/signaling/src/media-conduit/AudioConduit.h @@ -196,6 +196,10 @@ class WebrtcAudioConduit: public AudioSessionConduit */ bool SetLocalSSRCs(const std::vector& aSSRCs) override; std::vector GetLocalSSRCs() const override; + bool SetRemoteSSRC(unsigned int ssrc) override + { + return false; + } bool GetRemoteSSRC(unsigned int* ssrc) override; bool SetLocalCNAME(const char* cname) override; bool GetVideoEncoderStats(double* framerateMean, diff --git a/media/webrtc/signaling/src/media-conduit/MediaConduitInterface.h b/media/webrtc/signaling/src/media-conduit/MediaConduitInterface.h index 7b6e91037e298..28af0b4e259f1 100755 --- a/media/webrtc/signaling/src/media-conduit/MediaConduitInterface.h +++ b/media/webrtc/signaling/src/media-conduit/MediaConduitInterface.h @@ -245,6 +245,7 @@ class MediaSessionConduit virtual std::vector GetLocalSSRCs() const = 0; virtual bool GetRemoteSSRC(unsigned int* ssrc) = 0; + virtual bool SetRemoteSSRC(unsigned int ssrc) = 0; virtual bool SetLocalCNAME(const char* cname) = 0; /** diff --git a/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp b/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp index 917cde501f455..34f4d6848084d 100755 --- a/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp +++ b/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp @@ -408,6 +408,7 @@ WebrtcVideoConduit::CreateRecvStream() std::unique_ptr decoder; webrtc::VideoDecoder::DecoderType decoder_type; + mRecvStreamConfig.decoders.clear(); for (auto& config : mRecvCodecList) { decoder_type = PayloadNameToDecoderType(config->mName); if (decoder_type == webrtc::VideoDecoder::DecoderType::kUnsupportedCodec) { @@ -692,6 +693,12 @@ WebrtcVideoConduit::SetRemoteSSRC(unsigned int ssrc) } DeleteRecvStream(); + MediaConduitErrorCode rval = CreateRecvStream(); + if (rval != kMediaConduitNoError) { + CSFLogError(logTag, "%s Start Receive Error %d ", __FUNCTION__, rval); + return false; + } + return (StartReceiving() == kMediaConduitNoError); } @@ -1148,10 +1155,15 @@ WebrtcVideoConduit::ConfigureRecvMediaCodecs( // XXX Copy over those that are the same and don't rebuild them mRecvCodecList.SwapElements(recv_codecs); recv_codecs.Clear(); - mRecvStreamConfig.decoders.clear(); mRecvStreamConfig.rtp.rtx.clear(); // Rebuilds mRecvStream from mRecvStreamConfig DeleteRecvStream(); + MediaConduitErrorCode rval = CreateRecvStream(); + if (rval != kMediaConduitNoError) { + CSFLogError(logTag, "%s Start Receive Error %d ", __FUNCTION__, rval); + return rval; + } + return StartReceiving(); } return kMediaConduitNoError; @@ -1812,14 +1824,7 @@ WebrtcVideoConduit::StartReceiving() { // Start Receive on the video engine MutexAutoLock lock(mCodecMutex); - - if (!mRecvStream) { - MediaConduitErrorCode rval = CreateRecvStream(); - if (rval != kMediaConduitNoError) { - CSFLogError(logTag, "%s Start Receive Error %d ", __FUNCTION__, rval); - return rval; - } - } + MOZ_ASSERT(mRecvStream); mRecvStream->Start(); mEngineReceiving = true; diff --git a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp index 32b1b125b5d4c..87e15d775cdb1 100644 --- a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp +++ b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp @@ -750,25 +750,24 @@ MediaPipeline::UpdateTransport_s(int level, void MediaPipeline::SelectSsrc_m(size_t ssrc_index) { - RUN_ON_THREAD(sts_thread_, - WrapRunnable( - this, - &MediaPipeline::SelectSsrc_s, - ssrc_index), - NS_DISPATCH_NORMAL); + if (ssrc_index < ssrcs_received_.size()) { + uint32_t ssrc = ssrcs_received_[ssrc_index]; + RUN_ON_THREAD(sts_thread_, + WrapRunnable( + this, + &MediaPipeline::SelectSsrc_s, + ssrc), + NS_DISPATCH_NORMAL); + + conduit_->SetRemoteSSRC(ssrc); + } } void -MediaPipeline::SelectSsrc_s(size_t ssrc_index) +MediaPipeline::SelectSsrc_s(uint32_t ssrc) { filter_ = new MediaPipelineFilter; - if (ssrc_index < ssrcs_received_.size()) { - filter_->AddRemoteSSRC(ssrcs_received_[ssrc_index]); - } else { - MOZ_MTLOG(ML_WARNING, "SelectSsrc called with " << ssrc_index << " but we " - << "have only seen " << ssrcs_received_.size() - << " ssrcs"); - } + filter_->AddRemoteSSRC(ssrc); } void MediaPipeline::StateChange(TransportFlow *flow, TransportLayer::State state) { diff --git a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.h b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.h index 38cc0bf9ab33e..3e744b31ebf54 100644 --- a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.h +++ b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.h @@ -124,7 +124,7 @@ class MediaPipeline : public sigslot::has_slots<> { // Used only for testing; installs a MediaPipelineFilter that filters // everything but the nth ssrc void SelectSsrc_m(size_t ssrc_index); - void SelectSsrc_s(size_t ssrc_index); + void SelectSsrc_s(uint32_t ssrc); virtual Direction direction() const { return direction_; } virtual const std::string& trackid() const { return track_id_; }