Changeset 201728 in webkit
- Timestamp:
- Jun 6, 2016 2:40:58 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r201727 r201728 1 2016-06-06 Adam Bergkvist <adam.bergkvist@ericsson.com> 2 3 WebRTC: Update MediaEndpointPeerConnection::createOffer() to use the transceiver set 4 https://bugs.webkit.org/show_bug.cgi?id=158203 5 6 Reviewed by Eric Carlson. 7 8 Updated existing test. 9 10 * fast/mediastream/RTCPeerConnection-inspect-offer-expected.txt: 11 * fast/mediastream/RTCPeerConnection-inspect-offer.html: 12 Add verification of mid attribute [1] (corresponds to the RTCRtpTransceiver mid attribute). 13 [1] https://tools.ietf.org/html/rfc5888 14 * fast/mediastream/resources/sdp-utils.js: Added. 15 (printComparableSessionDescription): 16 (verified): 17 (match): 18 Move the printComparableSessionDescription function to a separate file 19 to make it usable in other (future) tests. 20 1 21 2016-06-06 Antoine Quint <graouts@apple.com> 2 22 -
trunk/LayoutTests/fast/mediastream/RTCPeerConnection-inspect-offer-expected.txt
r197702 r201728 16 16 a=rtcp-mux 17 17 a=sendrecv 18 a=mid:{mid:OK} 18 19 a=rtpmap:111 OPUS/48000/2 19 20 a=rtpmap:8 PCMA/8000 … … 39 40 a=rtcp-mux 40 41 a=sendrecv 42 a=mid:{mid:OK} 41 43 a=rtpmap:111 OPUS/48000/2 42 44 a=rtpmap:8 PCMA/8000 … … 52 54 a=rtcp-mux 53 55 a=sendrecv 56 a=mid:{mid:OK} 54 57 a=rtpmap:103 H264/90000 55 58 a=rtpmap:100 VP8/90000 -
trunk/LayoutTests/fast/mediastream/RTCPeerConnection-inspect-offer.html
r197702 r201728 3 3 <head> 4 4 <script src="../../resources/js-test-pre.js"></script> 5 <script src="./resources/sdp-utils.js"></script> 5 6 </head> 6 7 <body> … … 52 53 }); 53 54 54 // Variable fields (e.g. generated ids) are verified and replaced with predictable55 // lables. The result can be compared with a predefined expected output.56 function printComparableSessionDescription(sessionDescription, mdescVariables) {57 debug("=== RTCSessionDescription ===");58 debug("type: " + sessionDescription.type + ", sdp:");59 60 var sdp = sessionDescription.sdp;61 62 var regexp = {63 "oline": "^o=(-) ([\\d]+) .*$",64 "msidsemantic": "^a=msid-semantic: *WMS .*$",65 "mline": "^m=.*$",66 "cname": "^a=ssrc:(\\d+) cname:([\\w+/\\-@\\.\\{\\}]+).*$",67 "msid": "^a=(ssrc:\\d+ )?msid:([\\w+/\\-=]+) +([\\w+/\\-=]+).*$",68 "iceufrag": "^a=ice-ufrag:([\\w+/]*).*$",69 "icepwd": "^a=ice-pwd:([\\w+/]*=*).*$",70 };71 72 var mdescIndex = -1;73 sdp.split("\r\n").forEach(function (line) {74 if (match(line, regexp.mline)) {75 // Media block ("header" line)76 mdescIndex++;77 } else if (mdescIndex < 0) {78 // Session block79 var oline;80 81 if (oline = match(line, regexp.oline))82 line = line.replace(oline[2], verified("session-id"));83 else if (match(line, regexp.msidsemantic)) {84 mdescVariables.forEach(function (variables) {85 line = line.replace(variables.streamId, verified("media-stream-id"));86 });87 }88 } else {89 // Media block (content lines)90 var cname;91 var msid;92 var iceufrag;93 var icepwd;94 95 if (cname = match(line, regexp.cname)) {96 line = line.replace(cname[1], verified("ssrc"));97 line = line.replace(cname[2], verified("cname"));98 99 } else if (msid = match(line, regexp.msid)) {100 if (msid[1])101 line = line.replace(msid[1], verified("ssrc"));102 103 var variables = mdescVariables[mdescIndex];104 105 var mediaStreamId = msid[2];106 var streamIdVerified = verified("media-stream-id", mediaStreamId != variables.streamId);107 line = line.replace(mediaStreamId, streamIdVerified);108 109 var mediaStreamTrackId = msid[3];110 var trackIdVerified = verified("media-stream-track-id", mediaStreamTrackId != variables.trackId);111 line = line.replace(mediaStreamTrackId, trackIdVerified);112 113 } else if (iceufrag = match(line, regexp.iceufrag))114 line = line.replace(iceufrag[1], verified("ice-ufrag"));115 else if (icepwd = match(line, regexp.icepwd))116 line = line.replace(icepwd[1], verified("ice-password"));117 }118 119 if (line)120 debug(line);121 });122 123 debug("===");124 debug("");125 }126 127 function verified(name, isFailure) {128 return "{" + name + ":" + (isFailure ? "FAILED" : "OK") + "}";129 }130 131 function match(data, pattern) {132 return data.match(new RegExp(pattern));133 }134 135 55 window.jsTestIsAsync = true; 136 56 window.successfullyParsed = true; -
trunk/Source/WebCore/ChangeLog
r201724 r201728 1 2016-06-06 Adam Bergkvist <adam.bergkvist@ericsson.com> 2 3 WebRTC: Update MediaEndpointPeerConnection::createOffer() to use the transceiver set 4 https://bugs.webkit.org/show_bug.cgi?id=158203 5 6 Reviewed by Eric Carlson. 7 8 Create an SDP offer based on the RTCPeerConnection object's set of RTCRtpTransceiver objects 9 (instead of RTCRtpSender objects). 10 11 Updated existing test: fast/mediastream/RTCPeerConnection-inspect-offer.html 12 13 * Modules/mediastream/MediaEndpointPeerConnection.cpp: 14 (WebCore::matchTransceiver): 15 (WebCore::matchTransceiverByMid): 16 (WebCore::MediaEndpointPeerConnection::createOfferTask): 17 * Modules/mediastream/MediaEndpointPeerConnection.h: 18 * Modules/mediastream/PeerConnectionBackend.h: 19 Remove getSenders() which is replaced by getTransceivers(). 20 * Modules/mediastream/RTCPeerConnection.h: 21 * Modules/mediastream/SDPProcessor.cpp: 22 (WebCore::configurationFromJSON): 23 (WebCore::configurationToJSON): 24 * Modules/mediastream/sdp.js: 25 (SDP.parse): 26 (SDP.generate): 27 Add support for mid attribute. 28 * platform/mediastream/PeerMediaDescription.h: 29 (WebCore::PeerMediaDescription::mid): 30 (WebCore::PeerMediaDescription::setMid): 31 (WebCore::PeerMediaDescription::clone): 32 1 33 2016-06-06 George Ruan <gruan@apple.com> 2 34 -
trunk/Source/WebCore/Modules/mediastream/MediaEndpointPeerConnection.cpp
r201673 r201728 46 46 47 47 using namespace PeerConnection; 48 using namespace PeerConnectionStates; 48 49 49 50 static std::unique_ptr<PeerConnectionBackend> createMediaEndpointPeerConnection(PeerConnectionBackendClient* client) … … 96 97 } 97 98 99 static RTCRtpTransceiver* matchTransceiver(const RtpTransceiverVector& transceivers, const std::function<bool(RTCRtpTransceiver&)>& matchFunction) 100 { 101 for (auto& transceiver : transceivers) { 102 if (matchFunction(*transceiver)) 103 return transceiver.get(); 104 } 105 return nullptr; 106 } 107 108 static RTCRtpTransceiver* matchTransceiverByMid(const RtpTransceiverVector& transceivers, const String& mid) 109 { 110 return matchTransceiver(transceivers, [&mid] (RTCRtpTransceiver& current) { 111 return current.mid() == mid; 112 }); 113 } 114 98 115 void MediaEndpointPeerConnection::runTask(NoncopyableFunction<void ()>&& task) 99 116 { … … 129 146 ASSERT(!m_dtlsFingerprint.isEmpty()); 130 147 148 if (m_client->internalSignalingState() == SignalingState::Closed) 149 return; 150 131 151 RefPtr<MediaEndpointSessionConfiguration> configurationSnapshot = MediaEndpointSessionConfiguration::create(); 132 152 133 configurationSnapshot->setSessionVersion(m_sdpSessionVersion++); 134 135 RtpSenderVector senders = RtpSenderVector(m_client->getSenders()); 136 137 // Add media descriptions for senders. 138 for (auto& sender : senders) { 153 configurationSnapshot->setSessionVersion(m_sdpOfferSessionVersion++); 154 155 auto transceivers = RtpTransceiverVector(m_client->getTransceivers()); 156 157 // Remove any transceiver objects from transceivers that can be matched to an existing media description. 158 for (auto& mediaDescription : configurationSnapshot->mediaDescriptions()) { 159 if (!mediaDescription->port()) { 160 // This media description should be recycled. 161 continue; 162 } 163 164 RTCRtpTransceiver* transceiver = matchTransceiverByMid(transceivers, mediaDescription->mid()); 165 if (!transceiver) 166 continue; 167 168 mediaDescription->setMode(transceiver->directionString()); 169 if (transceiver->hasSendingDirection()) { 170 RTCRtpSender& sender = *transceiver->sender(); 171 172 mediaDescription->setMediaStreamId(sender.mediaStreamIds()[0]); 173 mediaDescription->setMediaStreamTrackId(sender.trackId()); 174 } 175 176 transceivers.removeFirst(transceiver); 177 } 178 179 // Add media descriptions for remaining transceivers. 180 for (auto& transceiver : transceivers) { 139 181 RefPtr<PeerMediaDescription> mediaDescription = PeerMediaDescription::create(); 140 MediaStreamTrack& track = *sender->track(); 141 142 mediaDescription->setMediaStreamId(sender->mediaStreamIds()[0]); 143 mediaDescription->setMediaStreamTrackId(track.id()); 144 mediaDescription->setType(track.kind()); 145 mediaDescription->setPayloads(track.kind() == "audio" ? m_defaultAudioPayloads : m_defaultVideoPayloads); 182 RTCRtpSender& sender = *transceiver->sender(); 183 184 mediaDescription->setMode(transceiver->directionString()); 185 mediaDescription->setMid(transceiver->provisionalMid()); 186 mediaDescription->setMediaStreamId(sender.mediaStreamIds()[0]); 187 mediaDescription->setType(sender.trackKind()); 188 mediaDescription->setPayloads(sender.trackKind() == "audio" ? m_defaultAudioPayloads : m_defaultVideoPayloads); 146 189 mediaDescription->setDtlsFingerprintHashFunction(m_dtlsFingerprintFunction); 147 190 mediaDescription->setDtlsFingerprint(m_dtlsFingerprint); … … 151 194 mediaDescription->setIcePassword(m_icePassword); 152 195 196 if (sender.track()) 197 mediaDescription->setMediaStreamTrackId(sender.trackId()); 198 153 199 configurationSnapshot->addMediaDescription(WTFMove(mediaDescription)); 154 200 } -
trunk/Source/WebCore/Modules/mediastream/MediaEndpointPeerConnection.h
r201673 r201728 47 47 48 48 typedef Vector<RefPtr<RTCRtpSender>> RtpSenderVector; 49 typedef Vector<RefPtr<RTCRtpTransceiver>> RtpTransceiverVector; 49 50 50 51 class MediaEndpointPeerConnection : public PeerConnectionBackend, public MediaEndpointClient { … … 106 107 String m_dtlsFingerprint; 107 108 String m_dtlsFingerprintFunction; 108 unsigned m_sdp SessionVersion { 0 };109 unsigned m_sdpOfferSessionVersion { 0 }; 109 110 }; 110 111 -
trunk/Source/WebCore/Modules/mediastream/PeerConnectionBackend.h
r201601 r201728 63 63 public: 64 64 virtual const Vector<RefPtr<RTCRtpTransceiver>>& getTransceivers() const = 0; 65 virtual const Vector<RefPtr<RTCRtpSender>>& getSenders() const = 0;66 65 virtual void fireEvent(Event&) = 0; 67 66 -
trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.h
r201601 r201728 64 64 ~RTCPeerConnection(); 65 65 66 const Vector<RefPtr<RTCRtpSender>>& getSenders() const override{ return m_transceiverSet->getSenders(); }66 const Vector<RefPtr<RTCRtpSender>>& getSenders() const { return m_transceiverSet->getSenders(); } 67 67 const Vector<RefPtr<RTCRtpReceiver>>& getReceivers() const { return m_transceiverSet->getReceivers(); } 68 68 const Vector<RefPtr<RTCRtpTransceiver>>& getTransceivers() const override { return m_transceiverSet->list(); } -
trunk/Source/WebCore/Modules/mediastream/SDPProcessor.cpp
r199619 r201728 71 71 STRING_FUNCTION(mediaStreamId) 72 72 STRING_FUNCTION(mediaStreamTrackId) 73 STRING_FUNCTION(mid) 73 74 STRING_FUNCTION(mode) 74 75 STRING_FUNCTION(mux) … … 212 213 mediaDescription->setMode(stringValue); 213 214 215 if (mediaDescriptionObject->getString(midString(), stringValue)) 216 mediaDescription->setMid(stringValue); 217 214 218 RefPtr<InspectorArray> payloadsArray = InspectorArray::create(); 215 219 mediaDescriptionObject->getArray(payloadsString(), payloadsArray); … … 354 358 mediaDescriptionObject->setString(addressString(), mediaDescription->address()); 355 359 mediaDescriptionObject->setString(modeString(), mediaDescription->mode()); 360 mediaDescriptionObject->setString(midString(), mediaDescription->mid()); 356 361 357 362 RefPtr<InspectorArray> payloadsArray = InspectorArray::create(); -
trunk/Source/WebCore/Modules/mediastream/sdp.js
r197702 r201728 41 41 "mblock": "^m=(audio|video|application) ([\\d]+) ([A-Z/]+)([\\d ]*)$\\r?\\n", 42 42 "mode": "^a=(sendrecv|sendonly|recvonly|inactive).*$", 43 "mid": "^a=mid:([!#$%&'*+-.\\w]*).*$", 43 44 "rtpmap": "^a=rtpmap:${type} ([\\w\\-]+)/([\\d]+)/?([\\d]+)?.*$", 44 "fmtp": "^a=fmtp:${type} ([\\w\\-=; ]+).*$",45 "fmtp": "^a=fmtp:${type} ([\\w\\-=; ]+).*$", 45 46 "param": "([\\w\\-]+)=([\\w\\-]+);?", 46 47 "nack": "^a=rtcp-fb:${type} nack$", … … 78 79 "${rtcpMuxLine}" + 79 80 "a=${mode}\r\n" + 81 "${midLine}" + 80 82 "${rtpMapLines}" + 81 83 "${fmtpLines}" + … … 94 96 "rtcp": "a=rtcp:${port}${[ ]netType}${[ ]addressType}${[ ]address}\r\n", 95 97 "rtcpMux": "a=rtcp-mux\r\n", 98 "mid": "a=mid:${mid}\r\n", 96 99 97 100 "rtpMap": "a=rtpmap:${type} ${encodingName}/${clockRate}${[/]channels}\r\n", … … 202 205 if (mode) 203 206 mediaDescription.mode = mode[1]; 207 208 var mid = match(mblock, regexps.mid, "m", sblock); 209 if (mid) 210 mediaDescription.mid = mid[1]; 204 211 205 212 var payloadTypes = []; … … 406 413 var mblock = fillTemplate(templates.mblock, mediaDescription); 407 414 415 var midInfo = {"midLine": ""}; 416 if (mediaDescription.mid) 417 midInfo.midLine = fillTemplate(templates.mid, mediaDescription); 418 mblock = fillTemplate(mblock, midInfo); 419 408 420 var payloadInfo = {"rtpMapLines": "", "fmtpLines": "", "nackLines": "", 409 421 "nackpliLines": "", "ccmfirLines": "", "ericScreamLines": ""}; -
trunk/Source/WebCore/platform/mediastream/PeerMediaDescription.h
r198492 r201728 62 62 void setMode(const String& mode) { m_mode = mode; } 63 63 64 const String& mid() const { return m_mid; } 65 void setMid(const String& mid) { m_mid = mid; } 66 64 67 const Vector<RefPtr<MediaPayload>>& payloads() const { return m_payloads; } 65 68 void addPayload(RefPtr<MediaPayload>&& payload) { m_payloads.append(WTFMove(payload)); } … … 118 121 copy->m_address = String(m_address); 119 122 copy->m_mode = String(m_mode); 123 copy->m_mid = String(m_mid); 120 124 121 125 for (auto& payload : m_payloads) … … 154 158 String m_address { "0.0.0.0" }; 155 159 String m_mode { "sendrecv" }; 160 String m_mid; 156 161 157 162 Vector<RefPtr<MediaPayload>> m_payloads;
Note: See TracChangeset
for help on using the changeset viewer.