From 39cdece7feecba08dd1ed4b82db3332b30ded8b2 Mon Sep 17 00:00:00 2001 From: Randell Jesup Date: Thu, 9 Feb 2017 20:56:29 -0500 Subject: [PATCH] Bug 1300665: Add abs-send-time and toffset header extension usage and negotiation r=bwc MozReview-Commit-ID: 3h9C8XziNky --- .../signaling/src/jsep/JsepSessionImpl.cpp | 5 ++++ .../src/media-conduit/MediaConduitInterface.h | 6 ++-- .../src/media-conduit/VideoConduit.cpp | 9 +++--- .../src/media-conduit/VideoConduit.h | 5 ++-- .../peerconnection/MediaPipelineFactory.cpp | 30 +++++++++++-------- .../modules/rtp_rtcp/source/rtp_utility.cc | 4 ++- 6 files changed, 37 insertions(+), 22 deletions(-) diff --git a/media/webrtc/signaling/src/jsep/JsepSessionImpl.cpp b/media/webrtc/signaling/src/jsep/JsepSessionImpl.cpp index ed1df981e2be..3ccf58666829 100644 --- a/media/webrtc/signaling/src/jsep/JsepSessionImpl.cpp +++ b/media/webrtc/signaling/src/jsep/JsepSessionImpl.cpp @@ -2288,6 +2288,11 @@ JsepSessionImpl::SetupDefaultRtpExtensions() { AddAudioRtpExtension("urn:ietf:params:rtp-hdrext:ssrc-audio-level", SdpDirectionAttribute::Direction::kSendonly); + AddVideoRtpExtension( + "http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time", + SdpDirectionAttribute::Direction::kSendrecv); + AddVideoRtpExtension("urn:ietf:params:rtp-hdrext:toffset", + SdpDirectionAttribute::Direction::kSendrecv); } void diff --git a/media/webrtc/signaling/src/media-conduit/MediaConduitInterface.h b/media/webrtc/signaling/src/media-conduit/MediaConduitInterface.h index 28af0b4e259f..c00ec6644133 100755 --- a/media/webrtc/signaling/src/media-conduit/MediaConduitInterface.h +++ b/media/webrtc/signaling/src/media-conduit/MediaConduitInterface.h @@ -339,13 +339,15 @@ public: /** * Adds negotiated RTP extensions + * XXX Move to MediaSessionConduit */ - virtual void AddLocalRTPExtensions(const std::vector& extensions) = 0; + virtual void AddLocalRTPExtensions(bool aIsSend, + const std::vector& extensions) = 0; /** * Returns the negotiated RTP extensions */ - virtual std::vector GetLocalRTPExtensions() const = 0; + virtual std::vector GetLocalRTPExtensions(bool aIsSend) const = 0; /** diff --git a/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp b/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp index 2b9b70ee7881..ef7b6bd9641d 100755 --- a/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp +++ b/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp @@ -241,10 +241,11 @@ WebrtcVideoConduit::~WebrtcVideoConduit() } void -WebrtcVideoConduit::AddLocalRTPExtensions( +WebrtcVideoConduit::AddLocalRTPExtensions(bool aIsSend, const std::vector & aExtensions) { - auto& extList = mSendStreamConfig.rtp.extensions; + auto& extList = aIsSend ? mSendStreamConfig.rtp.extensions : + mRecvStreamConfig.rtp.extensions; std::remove_if(extList.begin(), extList.end(), [&](const webrtc::RtpExtension & i) { return std::find(aExtensions.begin(), aExtensions.end(),i) != aExtensions.end(); }); @@ -252,9 +253,9 @@ WebrtcVideoConduit::AddLocalRTPExtensions( } std::vector -WebrtcVideoConduit::GetLocalRTPExtensions() const +WebrtcVideoConduit::GetLocalRTPExtensions(bool aIsSend) const { - return mSendStreamConfig.rtp.extensions; + return aIsSend ? mSendStreamConfig.rtp.extensions : mRecvStreamConfig.rtp.extensions; } bool WebrtcVideoConduit::SetLocalSSRCs(const std::vector & aSSRCs) diff --git a/media/webrtc/signaling/src/media-conduit/VideoConduit.h b/media/webrtc/signaling/src/media-conduit/VideoConduit.h index 6d4ecba3c04d..be61a560942d 100755 --- a/media/webrtc/signaling/src/media-conduit/VideoConduit.h +++ b/media/webrtc/signaling/src/media-conduit/VideoConduit.h @@ -81,8 +81,9 @@ public: * TODO(@@NG) promote this the MediaConduitInterface when the VoE rework * hits Webrtc.org. */ - void AddLocalRTPExtensions(const std::vector& extensions) override; - std::vector GetLocalRTPExtensions() const override; + void AddLocalRTPExtensions(bool aIsSend, + const std::vector& extensions) override; + std::vector GetLocalRTPExtensions(bool aIsSend) const override; /** * Set up A/V sync between this (incoming) VideoConduit and an audio conduit. diff --git a/media/webrtc/signaling/src/peerconnection/MediaPipelineFactory.cpp b/media/webrtc/signaling/src/peerconnection/MediaPipelineFactory.cpp index fc00203d7a40..7f35b1217875 100644 --- a/media/webrtc/signaling/src/peerconnection/MediaPipelineFactory.cpp +++ b/media/webrtc/signaling/src/peerconnection/MediaPipelineFactory.cpp @@ -813,6 +813,17 @@ MediaPipelineFactory::GetOrCreateVideoConduit( const std::vector* ssrcs; + const JsepTrackNegotiatedDetails* details = aTrack.GetNegotiatedDetails(); + std::vector extmaps; + if (details) { + // @@NG read extmap from track + details->ForEachRTPHeaderExtension( + [&extmaps](const SdpExtmapAttributeList::Extmap& extmap) + { + extmaps.emplace_back(extmap.extensionname,extmap.entry); + }); + } + if (receiving) { // NOTE(pkerr) - the Call API requires the both local_ssrc and remote_ssrc be // set to a non-zero value or the CreateVideo...Stream call will fail. @@ -840,6 +851,9 @@ MediaPipelineFactory::GetOrCreateVideoConduit( } conduit->SetRemoteSSRC(ssrcs->front()); + if (!extmaps.empty()) { + conduit->AddLocalRTPExtensions(false, extmaps); + } auto error = conduit->ConfigureRecvMediaCodecs(configs.values); if (error) { MOZ_MTLOG(ML_ERROR, "ConfigureRecvMediaCodecs failed: " << error); @@ -865,26 +879,16 @@ MediaPipelineFactory::GetOrCreateVideoConduit( return rv; } + if (!extmaps.empty()) { + conduit->AddLocalRTPExtensions(true, extmaps); + } auto error = conduit->ConfigureSendMediaCodec(configs.values[0]); - if (error) { MOZ_MTLOG(ML_ERROR, "ConfigureSendMediaCodec failed: " << error); return NS_ERROR_FAILURE; } } - const JsepTrackNegotiatedDetails* details = aTrack.GetNegotiatedDetails(); - if (details) { - // @@NG read extmap from track - std::vector extmaps; - details->ForEachRTPHeaderExtension( - [&conduit,&extmaps](const SdpExtmapAttributeList::Extmap& extmap) - { - extmaps.emplace_back(extmap.extensionname,extmap.entry); - }); - conduit->AddLocalRTPExtensions(extmaps); - } - *aConduitp = conduit; return NS_OK; diff --git a/media/webrtc/trunk/webrtc/modules/rtp_rtcp/source/rtp_utility.cc b/media/webrtc/trunk/webrtc/modules/rtp_rtcp/source/rtp_utility.cc index 900ce70f6051..0d9773d21a82 100644 --- a/media/webrtc/trunk/webrtc/modules/rtp_rtcp/source/rtp_utility.cc +++ b/media/webrtc/trunk/webrtc/modules/rtp_rtcp/source/rtp_utility.cc @@ -336,7 +336,9 @@ void RtpHeaderParser::ParseOneByteExtensionHeader( RTPExtensionType type; if (ptrExtensionMap->GetType(id, &type) != 0) { // If we encounter an unknown extension, just skip over it. - LOG(LS_INFO) << "Failed to find extension id: " << id; + // Mozilla - we reuse the parse for demux, without registering extensions. + // Reduce log-spam by switching to VERBOSE + LOG(LS_VERBOSE) << "Failed to find extension id: " << id; } else { switch (type) { case kRtpExtensionTransmissionTimeOffset: {