Changeset 116127 in webkit
- Timestamp:
- May 4, 2012 10:55:20 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r116122 r116127 1 2012-05-04 Tommy Widenflycht <tommyw@google.com> 2 3 MediaStream API: Make PeerConnection00's API fully compliant with the draft 4 https://bugs.webkit.org/show_bug.cgi?id=85491 5 6 Reviewed by Adam Barth. 7 8 * fast/mediastream/peerconnection-Attributes-expected.txt: 9 * fast/mediastream/peerconnection-iceoptions-expected.txt: Added. 10 * fast/mediastream/peerconnection-iceoptions.html: Added. 11 1 12 2012-05-04 Zan Dobersek <zandobersek@gmail.com> 2 13 -
trunk/LayoutTests/fast/mediastream/peerconnection-Attributes-expected.txt
r115810 r116127 8 8 PASS typeof pc.close === 'function' is true 9 9 PASS pc.NEW === 0 is true 10 FAIL pc.OPENING === 1 should be true. Was false. 10 PASS pc.OPENING === 1 is true 11 11 PASS pc.ACTIVE === 2 is true 12 12 PASS pc.CLOSED === 3 is true -
trunk/Source/Platform/ChangeLog
r115930 r116127 1 2012-05-04 Tommy Widenflycht <tommyw@google.com> 2 3 MediaStream API: Make PeerConnection00's API fully compliant with the draft 4 https://bugs.webkit.org/show_bug.cgi?id=85491 5 6 Reviewed by Adam Barth. 7 8 * chromium/public/WebPeerConnection00HandlerClient.h: 9 1 10 2012-05-02 Dana Jansens <danakj@chromium.org> 2 11 -
trunk/Source/Platform/chromium/public/WebPeerConnection00HandlerClient.h
r112784 r116127 41 41 enum ReadyState { 42 42 ReadyStateNew = 0, 43 ReadyStateOpening = 1, 44 ReadyStateActive = 2, 45 ReadyStateClosed = 3, 46 47 // DEPRECATED 43 48 ReadyStateNegotiating = 1, 44 ReadyStateActive = 2,45 ReadyStateClosed = 346 49 }; 47 50 -
trunk/Source/WebCore/ChangeLog
r116125 r116127 1 2012-05-04 Tommy Widenflycht <tommyw@google.com> 2 3 MediaStream API: Make PeerConnection00's API fully compliant with the draft 4 https://bugs.webkit.org/show_bug.cgi?id=85491 5 6 Reviewed by Adam Barth. 7 8 Mainly making the relevant API's use objects (aka Dictionaries) instead of the temporary strings, 9 but also making a few API's exception aware and changing the name of a flag. 10 11 Test: fast/mediastream/peerconnection-iceoptions.html 12 13 * Modules/mediastream/PeerConnection00.cpp: 14 (WebCore::PeerConnection00::createMediaHints): 15 (WebCore::PeerConnection00::createOffer): 16 (WebCore): 17 (WebCore::PeerConnection00::createAnswer): 18 (WebCore::PeerConnection00::createIceOptions): 19 (WebCore::PeerConnection00::createDefaultIceOptions): 20 (WebCore::PeerConnection00::startIce): 21 (WebCore::PeerConnection00::addStream): 22 (WebCore::PeerConnection00::changeReadyState): 23 * Modules/mediastream/PeerConnection00.h: 24 (WebCore): 25 (PeerConnection00): 26 * Modules/mediastream/PeerConnection00.idl: 27 * platform/mediastream/chromium/PeerConnection00HandlerInternal.cpp: 28 (WebCore::PeerConnection00HandlerInternal::startIce): 29 1 30 2012-05-04 David Tseng <dtseng@google.com> 2 31 -
trunk/Source/WebCore/Modules/mediastream/PeerConnection00.cpp
r112513 r116127 92 92 } 93 93 94 PassRefPtr<MediaHints> PeerConnection00::parseMediaHints(const String& mediaHints) 95 { 96 Vector<String> hintsList; 97 mediaHints.split(",", hintsList); 94 PassRefPtr<MediaHints> PeerConnection00::createMediaHints(const Dictionary& dictionary) 95 { 98 96 bool audio = hasLocalAudioTrack(); 99 97 bool video = hasLocalVideoTrack(); 100 for (Vector<String>::iterator i = hintsList.begin(); i != hintsList.end(); ++i) { 101 if (*i == "audio") 102 audio = true; 103 else if (*i == "no_audio") 104 audio = false; 105 else if (*i == "video") 106 video = true; 107 else if (*i == "no_video") 108 video = false; 109 } 110 98 dictionary.get("has_audio", audio); 99 dictionary.get("has_video", audio); 111 100 return MediaHints::create(audio, video); 112 101 } 113 102 114 PassRefPtr<SessionDescription> PeerConnection00::createOffer() 115 { 116 return createOffer(""); 117 } 118 119 PassRefPtr<SessionDescription> PeerConnection00::createOffer(const String& mediaHintsString) 120 { 121 RefPtr<MediaHints> mediaHints = parseMediaHints(mediaHintsString); 122 RefPtr<SessionDescriptionDescriptor> descriptor = m_peerHandler->createOffer(mediaHints.release()); 123 if (!descriptor) 103 PassRefPtr<MediaHints> PeerConnection00::createMediaHints() 104 { 105 bool audio = hasLocalAudioTrack(); 106 bool video = hasLocalVideoTrack(); 107 return MediaHints::create(audio, video); 108 } 109 110 PassRefPtr<SessionDescription> PeerConnection00::createOffer(ExceptionCode& ec) 111 { 112 return createOffer(createMediaHints(), ec); 113 } 114 115 PassRefPtr<SessionDescription> PeerConnection00::createOffer(const Dictionary& dictionary, ExceptionCode& ec) 116 { 117 return createOffer(createMediaHints(dictionary), ec); 118 } 119 120 PassRefPtr<SessionDescription> PeerConnection00::createOffer(PassRefPtr<MediaHints> mediaHints, ExceptionCode& ec) 121 { 122 RefPtr<SessionDescriptionDescriptor> descriptor = m_peerHandler->createOffer(mediaHints); 123 if (!descriptor) { 124 ec = SYNTAX_ERR; 124 125 return 0; 126 } 125 127 126 128 return SessionDescription::create(descriptor.release()); 127 129 } 128 130 129 PassRefPtr<SessionDescription> PeerConnection00::createAnswer(const String& offer) 130 { 131 return createAnswer(offer, ""); 132 } 133 134 PassRefPtr<SessionDescription> PeerConnection00::createAnswer(const String& offer, const String& mediaHintsString) 135 { 136 RefPtr<MediaHints> mediaHints = parseMediaHints(mediaHintsString); 137 RefPtr<SessionDescriptionDescriptor> descriptor = m_peerHandler->createAnswer(offer, mediaHints.release()); 138 if (!descriptor) 131 PassRefPtr<SessionDescription> PeerConnection00::createAnswer(const String& offer, ExceptionCode& ec) 132 { 133 return createAnswer(offer, createMediaHints(), ec); 134 } 135 136 PassRefPtr<SessionDescription> PeerConnection00::createAnswer(const String& offer, const Dictionary& dictionary, ExceptionCode& ec) 137 { 138 return createAnswer(offer, createMediaHints(dictionary), ec); 139 } 140 141 PassRefPtr<SessionDescription> PeerConnection00::createAnswer(const String& offer, PassRefPtr<MediaHints> hints, ExceptionCode& ec) 142 { 143 RefPtr<SessionDescriptionDescriptor> descriptor = m_peerHandler->createAnswer(offer, hints); 144 if (!descriptor) { 145 ec = SYNTAX_ERR; 139 146 return 0; 147 } 140 148 141 149 return SessionDescription::create(descriptor.release()); … … 216 224 } 217 225 218 void PeerConnection00::startIce(ExceptionCode& ec) 219 { 220 startIce("", ec); 221 } 222 223 void PeerConnection00::startIce(const String& options, ExceptionCode& ec) 224 { 225 if (m_readyState == CLOSED) { 226 ec = INVALID_STATE_ERR; 227 return; 228 } 226 PassRefPtr<IceOptions> PeerConnection00::createIceOptions(const Dictionary& dictionary, ExceptionCode& ec) 227 { 228 String useCandidates = ""; 229 dictionary.get("use_candidates", useCandidates); 229 230 230 231 IceOptions::UseCandidatesOption option; 231 232 if (options == "" || options == "all") 232 if (useCandidates == "" || useCandidates == "all") 233 233 option = IceOptions::ALL; 234 else if ( options == "no_relay")234 else if (useCandidates == "no_relay") 235 235 option = IceOptions::NO_RELAY; 236 else if ( options == "only_relay")236 else if (useCandidates == "only_relay") 237 237 option = IceOptions::ONLY_RELAY; 238 238 else { 239 239 ec = TYPE_MISMATCH_ERR; 240 return; 241 } 242 243 bool valid = m_peerHandler->startIce(IceOptions::create(option)); 240 return 0; 241 } 242 243 return IceOptions::create(option); 244 } 245 246 PassRefPtr<IceOptions> PeerConnection00::createDefaultIceOptions() 247 { 248 return IceOptions::create(IceOptions::ALL); 249 } 250 251 void PeerConnection00::startIce(ExceptionCode& ec) 252 { 253 startIce(createDefaultIceOptions(), ec); 254 } 255 256 void PeerConnection00::startIce(const Dictionary& dictionary, ExceptionCode& ec) 257 { 258 RefPtr<IceOptions> iceOptions = createIceOptions(dictionary, ec); 259 if (ec) 260 return; 261 262 startIce(iceOptions.release(), ec); 263 } 264 265 void PeerConnection00::startIce(PassRefPtr<IceOptions> iceOptions, ExceptionCode& ec) 266 { 267 if (m_readyState == CLOSED) { 268 ec = INVALID_STATE_ERR; 269 return; 270 } 271 272 bool valid = m_peerHandler->startIce(iceOptions); 244 273 if (!valid) 245 274 ec = SYNTAX_ERR; … … 274 303 } 275 304 276 void PeerConnection00::addStream(PassRefPtr<MediaStream> stream, ExceptionCode& ec) 277 { 278 String emptyHints; 279 return addStream(stream, emptyHints, ec); 280 } 281 282 void PeerConnection00::addStream(PassRefPtr<MediaStream> prpStream, const String& mediaStreamHints, ExceptionCode& ec) 305 void PeerConnection00::addStream(PassRefPtr<MediaStream> prpStream, ExceptionCode& ec) 283 306 { 284 307 RefPtr<MediaStream> stream = prpStream; … … 298 321 m_localStreams->append(stream); 299 322 300 // FIXME: When the spec says what the mediaStreamHints should look like send it down.301 323 m_peerHandler->addStream(stream->descriptor()); 324 } 325 326 void PeerConnection00::addStream(PassRefPtr<MediaStream> stream, const Dictionary& mediaStreamHints, ExceptionCode& ec) 327 { 328 // FIXME: When the spec says what the mediaStreamHints should look like use it. 329 addStream(stream, ec); 302 330 } 303 331 … … 436 464 437 465 switch (m_readyState) { 438 case NEGOTIATING:466 case OPENING: 439 467 dispatchEvent(Event::create(eventNames().connectingEvent, false, false)); 440 468 break; -
trunk/Source/WebCore/Modules/mediastream/PeerConnection00.h
r111876 r116127 35 35 36 36 #include "ActiveDOMObject.h" 37 #include "Dictionary.h" 37 38 #include "EventTarget.h" 38 39 #include "ExceptionBase.h" … … 50 51 51 52 class MediaHints; 53 class IceOptions; 52 54 53 55 // Note: … … 64 66 enum ReadyState { 65 67 NEW = 0, 66 NEGOTIATING = 1,68 OPENING = 1, 67 69 ACTIVE = 2, 68 70 CLOSED = 3 … … 88 90 ~PeerConnection00(); 89 91 90 PassRefPtr<SessionDescription> createOffer( );91 PassRefPtr<SessionDescription> createOffer(const String& mediaHints);92 PassRefPtr<SessionDescription> createAnswer(const String& offer );93 PassRefPtr<SessionDescription> createAnswer(const String& offer, const String& mediaHints);92 PassRefPtr<SessionDescription> createOffer(ExceptionCode&); 93 PassRefPtr<SessionDescription> createOffer(const Dictionary& mediaHints, ExceptionCode&); 94 PassRefPtr<SessionDescription> createAnswer(const String& offer, ExceptionCode&); 95 PassRefPtr<SessionDescription> createAnswer(const String& offer, const Dictionary& mediaHints, ExceptionCode&); 94 96 95 97 void setLocalDescription(int action, PassRefPtr<SessionDescription>, ExceptionCode&); … … 99 101 100 102 void startIce(ExceptionCode&); 101 void startIce(const String& options, ExceptionCode&);103 void startIce(const Dictionary& iceOptions, ExceptionCode&); 102 104 void processIceMessage(PassRefPtr<IceCandidate>, ExceptionCode&); 103 105 … … 106 108 107 109 void addStream(const PassRefPtr<MediaStream>, ExceptionCode&); 108 void addStream(const PassRefPtr<MediaStream>, const String& mediaStreamHints, ExceptionCode&);110 void addStream(const PassRefPtr<MediaStream>, const Dictionary& mediaStreamHints, ExceptionCode&); 109 111 void removeStream(MediaStream*, ExceptionCode&); 110 112 MediaStreamList* localStreams() const; … … 148 150 void changeReadyState(ReadyState); 149 151 void changeIceState(IceState); 152 150 153 bool hasLocalAudioTrack(); 151 154 bool hasLocalVideoTrack(); 152 PassRefPtr<MediaHints> parseMediaHints(const String& mediaHintsString); 155 PassRefPtr<MediaHints> createMediaHints(const Dictionary&); 156 PassRefPtr<MediaHints> createMediaHints(); 157 PassRefPtr<IceOptions> createIceOptions(const Dictionary&, ExceptionCode&); 158 PassRefPtr<IceOptions> createDefaultIceOptions(); 159 PassRefPtr<SessionDescription> createOffer(PassRefPtr<MediaHints>, ExceptionCode&); 160 PassRefPtr<SessionDescription> createAnswer(const String& offer, PassRefPtr<MediaHints>, ExceptionCode&); 161 void startIce(PassRefPtr<IceOptions>, ExceptionCode&); 153 162 154 163 RefPtr<IceCallback> m_iceCallback; -
trunk/Source/WebCore/Modules/mediastream/PeerConnection00.idl
r111876 r116127 38 38 EventTarget 39 39 ] PeerConnection00 { 40 // FIXME: Make mediaHints an object 41 SessionDescription createOffer(in [Optional] DOMString mediaHints); 42 43 // FIXME: Make mediaHints an object 44 SessionDescription createAnswer(in DOMString offer, in [Optional] DOMString mediaHints); 40 SessionDescription createOffer(in [Optional] Dictionary mediaHints) 41 raises(DOMException); 42 SessionDescription createAnswer(in DOMString offer, in [Optional] Dictionary mediaHints) 43 raises(DOMException); 45 44 46 45 // Actions, for setLocalDescription/setRemoteDescription. … … 51 50 void setLocalDescription(in unsigned short action, in SessionDescription desc) 52 51 raises(DOMException); 53 54 52 void setRemoteDescription(in unsigned short action, in SessionDescription desc) 55 53 raises(DOMException); 56 54 57 55 readonly attribute SessionDescription localDescription; 58 59 56 readonly attribute SessionDescription remoteDescription; 60 57 61 58 const unsigned short NEW = 0; 62 const unsigned short NEGOTIATING = 1;59 const unsigned short OPENING = 1; 63 60 const unsigned short ACTIVE = 2; 64 61 const unsigned short CLOSED = 3; 65 62 readonly attribute unsigned short readyState; 66 63 67 // FIXME: Make iceOptions an object 68 void startIce(in [Optional] DOMString iceOptions) 64 void startIce(in [Optional] Dictionary iceOptions) 69 65 raises(DOMException); 70 66 … … 81 77 readonly attribute unsigned short iceState; 82 78 83 // FIXME: Make mediaStreamHints an object 84 [StrictTypeChecking] void addStream(in MediaStream stream, in [Optional] DOMString mediaStreamHints) 79 [StrictTypeChecking] void addStream(in MediaStream stream, in [Optional] Dictionary mediaStreamHints) 85 80 raises(DOMException); 86 81 [StrictTypeChecking] void removeStream(in MediaStream stream) -
trunk/Source/WebCore/platform/mediastream/chromium/PeerConnection00HandlerInternal.cpp
r112784 r116127 120 120 { 121 121 if (!m_webHandler) 122 return false;122 return true; 123 123 124 124 return m_webHandler->startIce(iceOptions); -
trunk/Source/WebKit/chromium/ChangeLog
r116121 r116127 1 2012-05-04 Tommy Widenflycht <tommyw@google.com> 2 3 MediaStream API: Make PeerConnection00's API fully compliant with the draft 4 https://bugs.webkit.org/show_bug.cgi?id=85491 5 6 Reviewed by Adam Barth. 7 8 * src/AssertMatchingEnums.cpp: 9 1 10 2012-05-04 Nate Chapin <japhet@chromium.org> 2 11 -
trunk/Source/WebKit/chromium/src/AssertMatchingEnums.cpp
r115291 r116127 548 548 549 549 COMPILE_ASSERT_MATCHING_ENUM(WebPeerConnection00HandlerClient::ReadyStateNew, PeerConnection00::NEW); 550 COMPILE_ASSERT_MATCHING_ENUM(WebPeerConnection00HandlerClient::ReadyStateNegotiating, PeerConnection00::NEGOTIATING); 550 COMPILE_ASSERT_MATCHING_ENUM(WebPeerConnection00HandlerClient::ReadyStateOpening, PeerConnection00::OPENING); 551 COMPILE_ASSERT_MATCHING_ENUM(WebPeerConnection00HandlerClient::ReadyStateNegotiating, PeerConnection00::OPENING); 551 552 COMPILE_ASSERT_MATCHING_ENUM(WebPeerConnection00HandlerClient::ReadyStateActive, PeerConnection00::ACTIVE); 552 553 COMPILE_ASSERT_MATCHING_ENUM(WebPeerConnection00HandlerClient::ReadyStateClosed, PeerConnection00::CLOSED);
Note: See TracChangeset
for help on using the changeset viewer.