Changeset 201920 in webkit
- Timestamp:
- Jun 10, 2016 2:15:07 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r201919 r201920 1 2016-06-10 Adam Bergkvist <adam.bergkvist@ericsson.com> 2 3 WebRTC: Imlement MediaEndpointPeerConnection::createAnswer() 4 https://bugs.webkit.org/show_bug.cgi?id=158566 5 6 Reviewed by Eric Carlson. 7 8 Add test for RTCPeerConnection.createAnswer. 9 10 * fast/mediastream/RTCPeerConnection-inspect-answer-expected.txt: Added. 11 * fast/mediastream/RTCPeerConnection-inspect-answer.html: Added. 12 Generate two answers, one with audio only and a second with audio and video, and inspect 13 the result. 14 * platform/mac/TestExpectations: 15 Skip tests for mac that require building with WEB_RTC enabled. 16 1 17 2016-06-08 Sergio Villar Senin <svillar@igalia.com> 2 18 -
trunk/LayoutTests/platform/mac/TestExpectations
r201902 r201920 194 194 fast/mediastream/RTCPeerConnection-setRemoteDescription-offer.html 195 195 fast/mediastream/RTCTrackEvent-constructor.html 196 fast/mediastream/RTCPeerConnection-inspect-answer.html 196 197 197 198 # Asserts in debug. -
trunk/Source/WebCore/ChangeLog
r201919 r201920 1 2016-06-10 Adam Bergkvist <adam.bergkvist@ericsson.com> 2 3 WebRTC: Imlement MediaEndpointPeerConnection::createAnswer() 4 https://bugs.webkit.org/show_bug.cgi?id=158566 5 6 Reviewed by Eric Carlson. 7 8 Add the MediaEndpointPeerConnection implementation of RTCPeerConnection.createAnswer [1]. 9 createAnswer() creates a 'reply' to an remote offer set with setRemoteDescription(), 10 completes the offer/answer dialog and brings the RTCPeerConnection back to the 'stable' 11 signaling state. 12 13 [1] https://w3c.github.io/webrtc-pc/archives/20160513/webrtc.html#dom-rtcpeerconnection-createanswer 14 15 Test: fast/mediastream/RTCPeerConnection-inspect-answer.html 16 17 * Modules/mediastream/MediaEndpointPeerConnection.cpp: 18 (WebCore::MediaEndpointPeerConnection::createOfferTask): 19 Align creation of RTCSessionDescription with createAnswerTask. 20 (WebCore::MediaEndpointPeerConnection::createAnswer): 21 (WebCore::MediaEndpointPeerConnection::createAnswerTask): 22 Add Implementation. 23 * Modules/mediastream/MediaEndpointPeerConnection.h: 24 1 25 2016-06-08 Sergio Villar Senin <svillar@igalia.com> 2 26 -
trunk/Source/WebCore/Modules/mediastream/MediaEndpointPeerConnection.cpp
r201851 r201920 192 192 } 193 193 194 String sdpString; 195 SDPProcessor::Result result = m_sdpProcessor->generate(*configurationSnapshot, sdpString); 196 if (result != SDPProcessor::Result::Success) { 197 LOG_ERROR("SDPProcessor internal error"); 198 return; 199 } 200 201 promise.resolve(RTCSessionDescription::create(RTCSessionDescription::SdpType::Offer, sdpString)); 194 auto description = MediaEndpointSessionDescription::create(RTCSessionDescription::SdpType::Offer, WTFMove(configurationSnapshot)); 195 promise.resolve(*description->toRTCSessionDescription(*m_sdpProcessor)); 202 196 } 203 197 204 198 void MediaEndpointPeerConnection::createAnswer(RTCAnswerOptions& options, SessionDescriptionPromise&& promise) 205 199 { 206 UNUSED_PARAM(options); 207 208 notImplemented(); 209 210 promise.reject(NOT_SUPPORTED_ERR); 200 runTask([this, protectedOptions = RefPtr<RTCAnswerOptions>(&options), protectedPromise = WTFMove(promise)]() mutable { 201 createAnswerTask(*protectedOptions, protectedPromise); 202 }); 203 } 204 205 void MediaEndpointPeerConnection::createAnswerTask(RTCAnswerOptions&, SessionDescriptionPromise& promise) 206 { 207 ASSERT(!m_dtlsFingerprint.isEmpty()); 208 209 if (m_client->internalSignalingState() == SignalingState::Closed) 210 return; 211 212 if (!internalRemoteDescription()) { 213 promise.reject(INVALID_STATE_ERR, "No remote description set"); 214 return; 215 } 216 217 MediaEndpointSessionDescription* localDescription = internalLocalDescription(); 218 RefPtr<MediaEndpointSessionConfiguration> configurationSnapshot = localDescription ? 219 localDescription->configuration()->clone() : MediaEndpointSessionConfiguration::create(); 220 221 configurationSnapshot->setSessionVersion(m_sdpAnswerSessionVersion++); 222 223 auto transceivers = RtpTransceiverVector(m_client->getTransceivers()); 224 const MediaDescriptionVector& remoteMediaDescriptions = internalRemoteDescription()->configuration()->mediaDescriptions(); 225 226 for (unsigned i = 0; i < remoteMediaDescriptions.size(); ++i) { 227 PeerMediaDescription& remoteMediaDescription = *remoteMediaDescriptions[i]; 228 229 RTCRtpTransceiver* transceiver = matchTransceiverByMid(transceivers, remoteMediaDescription.mid()); 230 if (!transceiver) { 231 LOG_ERROR("Could not find a matching transceiver for remote description while creating answer"); 232 continue; 233 } 234 235 if (i >= configurationSnapshot->mediaDescriptions().size()) { 236 auto newMediaDescription = PeerMediaDescription::create(); 237 238 RTCRtpSender& sender = *transceiver->sender(); 239 if (sender.track()) { 240 if (sender.mediaStreamIds().size()) 241 newMediaDescription->setMediaStreamId(sender.mediaStreamIds()[0]); 242 newMediaDescription->setMediaStreamTrackId(sender.trackId()); 243 newMediaDescription->addSsrc(cryptographicallyRandomNumber()); 244 } 245 246 newMediaDescription->setMode(transceiver->directionString()); 247 newMediaDescription->setType(remoteMediaDescription.type()); 248 newMediaDescription->setMid(remoteMediaDescription.mid()); 249 newMediaDescription->setDtlsSetup(remoteMediaDescription.dtlsSetup() == "active" ? "passive" : "active"); 250 newMediaDescription->setDtlsFingerprintHashFunction(m_dtlsFingerprintFunction); 251 newMediaDescription->setDtlsFingerprint(m_dtlsFingerprint); 252 newMediaDescription->setCname(m_cname); 253 newMediaDescription->setIceUfrag(m_iceUfrag); 254 newMediaDescription->setIcePassword(m_icePassword); 255 256 configurationSnapshot->addMediaDescription(WTFMove(newMediaDescription)); 257 } 258 259 PeerMediaDescription& localMediaDescription = *configurationSnapshot->mediaDescriptions()[i]; 260 261 localMediaDescription.setPayloads(remoteMediaDescription.payloads()); 262 localMediaDescription.setRtcpMux(remoteMediaDescription.rtcpMux()); 263 264 if (!localMediaDescription.ssrcs().size()) 265 localMediaDescription.addSsrc(cryptographicallyRandomNumber()); 266 267 if (localMediaDescription.dtlsSetup() == "actpass") 268 localMediaDescription.setDtlsSetup("passive"); 269 270 transceivers.removeFirst(transceiver); 271 } 272 273 // Unassociated (non-stopped) transceivers need to be negotiated in a follow-up offer. 274 if (hasUnassociatedTransceivers(transceivers)) 275 markAsNeedingNegotiation(); 276 277 auto description = MediaEndpointSessionDescription::create(RTCSessionDescription::SdpType::Answer, WTFMove(configurationSnapshot)); 278 promise.resolve(*description->toRTCSessionDescription(*m_sdpProcessor)); 211 279 } 212 280 -
trunk/Source/WebCore/Modules/mediastream/MediaEndpointPeerConnection.h
r201851 r201920 88 88 89 89 void createOfferTask(RTCOfferOptions&, PeerConnection::SessionDescriptionPromise&); 90 void createAnswerTask(RTCAnswerOptions&, PeerConnection::SessionDescriptionPromise&); 90 91 91 92 void setLocalDescriptionTask(RefPtr<RTCSessionDescription>&&, PeerConnection::VoidPromise&); … … 121 122 String m_dtlsFingerprintFunction; 122 123 unsigned m_sdpOfferSessionVersion { 0 }; 124 unsigned m_sdpAnswerSessionVersion { 0 }; 123 125 124 126 RefPtr<MediaEndpointSessionDescription> m_currentLocalDescription;
Note: See TracChangeset
for help on using the changeset viewer.