Changeset 127425 in webkit
- Timestamp:
- Sep 3, 2012 9:08:07 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 5 added
- 25 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r127418 r127425 1 2012-09-03 Tommy Widenflycht <tommyw@google.com> 2 3 MediaStream API: Add Ice-related functionality to RTCPeerConnection 4 https://bugs.webkit.org/show_bug.cgi?id=95565 5 6 Reviewed by Adam Barth. 7 8 * fast/mediastream/RTCPeerConnection-ice-expected.txt: Added. 9 * fast/mediastream/RTCPeerConnection-ice.html: Added. 10 1 11 2012-09-03 Alexander Pavlov <apavlov@chromium.org> 2 12 -
trunk/Source/Platform/ChangeLog
r127365 r127425 1 2012-09-03 Tommy Widenflycht <tommyw@google.com> 2 3 MediaStream API: Add Ice-related functionality to RTCPeerConnection 4 https://bugs.webkit.org/show_bug.cgi?id=95565 5 6 Reviewed by Adam Barth. 7 8 * Platform.gypi: 9 * chromium/public/WebRTCICECandidateDescriptor.h: Copied from Source/Platform/chromium/public/WebRTCPeerConnectionHandlerClient.h. 10 (WebCore): 11 (WebKit): 12 (WebRTCICECandidateDescriptor): 13 (WebKit::WebRTCICECandidateDescriptor::WebRTCICECandidateDescriptor): 14 (WebKit::WebRTCICECandidateDescriptor::~WebRTCICECandidateDescriptor): 15 (WebKit::WebRTCICECandidateDescriptor::operator=): 16 (WebKit::WebRTCICECandidateDescriptor::isNull): 17 * chromium/public/WebRTCPeerConnectionHandler.h: 18 (WebKit): 19 (WebRTCPeerConnectionHandler): 20 * chromium/public/WebRTCPeerConnectionHandlerClient.h: 21 (WebKit): 22 (WebRTCPeerConnectionHandlerClient): 23 1 24 2012-09-01 Tommy Widenflycht <tommyw@google.com> 2 25 -
trunk/Source/Platform/Platform.gypi
r127225 r127425 105 105 'chromium/public/WebPrivatePtr.h', 106 106 'chromium/public/WebRTCConfiguration.h', 107 'chromium/public/WebRTCICECandidateDescriptor.h', 107 108 'chromium/public/WebRTCPeerConnectionHandler.h', 108 109 'chromium/public/WebRTCPeerConnectionHandlerClient.h', -
trunk/Source/Platform/chromium/public/WebRTCICECandidateDescriptor.h
r127423 r127425 29 29 */ 30 30 31 #ifndef WebRTCPeerConnectionHandlerClient_h 32 #define WebRTCPeerConnectionHandlerClient_h 31 #ifndef WebRTCICECandidateDescriptor_h 32 #define WebRTCICECandidateDescriptor_h 33 34 #include "WebCommon.h" 35 #include "WebPrivatePtr.h" 36 37 namespace WebCore { 38 class RTCIceCandidateDescriptor; 39 } 33 40 34 41 namespace WebKit { 35 class WebMediaStreamDescriptor;36 42 37 class WebRTCPeerConnectionHandlerClient { 43 class WebString; 44 45 class WebRTCICECandidateDescriptor { 38 46 public: 39 enum ReadyState { 40 ReadyStateNew = 1, 41 ReadyStateOpening = 2, 42 ReadyStateActive = 3, 43 ReadyStateClosing = 4, 44 ReadyStateClosed = 5 45 }; 47 WebRTCICECandidateDescriptor() { } 48 WebRTCICECandidateDescriptor(const WebRTCICECandidateDescriptor& other) { assign(other); } 49 ~WebRTCICECandidateDescriptor() { reset(); } 46 50 47 virtual ~WebRTCPeerConnectionHandlerClient() { } 51 WebRTCICECandidateDescriptor& operator=(const WebRTCICECandidateDescriptor& other) 52 { 53 assign(other); 54 return *this; 55 } 48 56 49 virtual void didChangeReadyState(ReadyState) = 0; 50 virtual void didAddRemoteStream(const WebMediaStreamDescriptor&) = 0; 51 virtual void didRemoveRemoteStream(const WebMediaStreamDescriptor&) = 0; 57 WEBKIT_EXPORT void assign(const WebRTCICECandidateDescriptor&); 58 59 WEBKIT_EXPORT void initialize(const WebString& candidate, const WebString& sdpMid, unsigned short sdpMLineIndex); 60 WEBKIT_EXPORT void reset(); 61 bool isNull() const { return m_private.isNull(); } 62 63 WEBKIT_EXPORT WebString candidate() const; 64 WEBKIT_EXPORT WebString sdpMid() const; 65 WEBKIT_EXPORT unsigned short sdpMLineIndex() const; 66 67 #if WEBKIT_IMPLEMENTATION 68 WebRTCICECandidateDescriptor(WebCore::RTCIceCandidateDescriptor*); 69 WebRTCICECandidateDescriptor(WTF::PassRefPtr<WebCore::RTCIceCandidateDescriptor>); 70 71 operator WTF::PassRefPtr<WebCore::RTCIceCandidateDescriptor>() const; 72 #endif 73 74 private: 75 WebPrivatePtr<WebCore::RTCIceCandidateDescriptor> m_private; 52 76 }; 53 77 54 78 } // namespace WebKit 55 79 56 #endif // WebRTC PeerConnectionHandlerClient_h80 #endif // WebRTCICECandidateDescriptor_h -
trunk/Source/Platform/chromium/public/WebRTCPeerConnectionHandler.h
r127365 r127425 36 36 class WebMediaStreamDescriptor; 37 37 class WebRTCConfiguration; 38 class WebRTCICECandidateDescriptor; 38 39 class WebRTCPeerConnectionHandlerClient; 39 40 … … 44 45 virtual bool initialize(const WebRTCConfiguration&, const WebMediaConstraints&) = 0; 45 46 47 virtual bool updateICE(const WebRTCConfiguration&, const WebMediaConstraints&) = 0; 48 virtual bool addICECandidate(const WebRTCICECandidateDescriptor&) = 0; 46 49 virtual bool addStream(const WebMediaStreamDescriptor&, const WebMediaConstraints&) = 0; 47 50 virtual void removeStream(const WebMediaStreamDescriptor&) = 0; -
trunk/Source/Platform/chromium/public/WebRTCPeerConnectionHandlerClient.h
r127365 r127425 34 34 namespace WebKit { 35 35 class WebMediaStreamDescriptor; 36 class WebRTCICECandidateDescriptor; 36 37 37 38 class WebRTCPeerConnectionHandlerClient { … … 45 46 }; 46 47 48 enum ICEState { 49 ICEStateNew = 1, 50 ICEStateGathering = 2, 51 ICEStateWaiting = 3, 52 ICEStateChecking = 4, 53 ICEStateConnected = 5, 54 ICEStateCompleted = 6, 55 ICEStateFailed = 7, 56 ICEStateClosed = 8 57 }; 58 47 59 virtual ~WebRTCPeerConnectionHandlerClient() { } 48 60 61 virtual void didGenerateICECandidate(const WebRTCICECandidateDescriptor&) = 0; 49 62 virtual void didChangeReadyState(ReadyState) = 0; 63 virtual void didChangeICEState(ICEState) = 0; 50 64 virtual void didAddRemoteStream(const WebMediaStreamDescriptor&) = 0; 51 65 virtual void didRemoveRemoteStream(const WebMediaStreamDescriptor&) = 0; -
trunk/Source/WebCore/CMakeLists.txt
r127178 r127425 224 224 Modules/mediastream/PeerConnection00.idl 225 225 Modules/mediastream/RTCIceCandidate.idl 226 Modules/mediastream/RTCIceCandidateEvent.idl 226 227 Modules/mediastream/RTCPeerConnection.idl 227 228 Modules/mediastream/RTCSessionDescription.idl … … 856 857 Modules/mediastream/PeerConnection00.cpp 857 858 Modules/mediastream/RTCIceCandidate.cpp 859 Modules/mediastream/RTCIceCandidateEvent.cpp 858 860 Modules/mediastream/RTCPeerConnection.cpp 859 861 Modules/mediastream/RTCSessionDescription.cpp -
trunk/Source/WebCore/ChangeLog
r127423 r127425 1 2012-09-03 Tommy Widenflycht <tommyw@google.com> 2 3 MediaStream API: Add Ice-related functionality to RTCPeerConnection 4 https://bugs.webkit.org/show_bug.cgi?id=95565 5 6 Reviewed by Adam Barth. 7 8 Adds all Ice-related functionality to RTCPeerConnection, including 9 events, callbacks and methods. 10 11 Test: fast/mediastream/RTCPeerConnection-ice.html 12 13 * CMakeLists.txt: 14 * GNUmakefile.list.am: 15 * Modules/mediastream/RTCIceCandidateEvent.cpp: Added. 16 (WebCore): 17 (WebCore::RTCIceCandidateEvent::create): 18 (WebCore::RTCIceCandidateEvent::RTCIceCandidateEvent): 19 (WebCore::RTCIceCandidateEvent::~RTCIceCandidateEvent): 20 (WebCore::RTCIceCandidateEvent::candidate): 21 (WebCore::RTCIceCandidateEvent::interfaceName): 22 * Modules/mediastream/RTCIceCandidateEvent.h: Added. 23 (WebCore): 24 (RTCIceCandidateEvent): 25 * Modules/mediastream/RTCIceCandidateEvent.idl: Added. 26 * Modules/mediastream/RTCPeerConnection.cpp: 27 (WebCore::RTCPeerConnection::RTCPeerConnection): 28 (WebCore::RTCPeerConnection::updateIce): 29 (WebCore): 30 (WebCore::RTCPeerConnection::addIceCandidate): 31 (WebCore::RTCPeerConnection::iceState): 32 (WebCore::RTCPeerConnection::close): 33 (WebCore::RTCPeerConnection::didGenerateIceCandidate): 34 (WebCore::RTCPeerConnection::didChangeIceState): 35 (WebCore::RTCPeerConnection::stop): 36 (WebCore::RTCPeerConnection::changeIceState): 37 * Modules/mediastream/RTCPeerConnection.h: 38 (RTCPeerConnection): 39 * Modules/mediastream/RTCPeerConnection.idl: 40 * WebCore.gypi: 41 * dom/EventNames.h: 42 (WebCore): 43 * dom/EventNames.in: 44 * platform/chromium/support/WebRTCICECandidateDescriptor.cpp: Copied from Source/WebCore/platform/mediastream/chromium/RTCPeerConnectionHandlerChromium.cpp. 45 (WebKit): 46 (WebKit::WebRTCICECandidateDescriptor::WebRTCICECandidateDescriptor): 47 (WebKit::WebRTCICECandidateDescriptor::assign): 48 (WebKit::WebRTCICECandidateDescriptor::reset): 49 (WebKit::WebRTCICECandidateDescriptor::initialize): 50 (WebKit::WebRTCICECandidateDescriptor::operator PassRefPtr<WebCore::RTCIceCandidateDescriptor>): 51 (WebKit::WebRTCICECandidateDescriptor::candidate): 52 (WebKit::WebRTCICECandidateDescriptor::sdpMid): 53 (WebKit::WebRTCICECandidateDescriptor::sdpMLineIndex): 54 * platform/mediastream/RTCIceCandidateDescriptor.h: 55 (WebCore::RTCIceCandidateDescriptor::candidate): 56 (WebCore::RTCIceCandidateDescriptor::sdpMid): 57 (WebCore::RTCIceCandidateDescriptor::sdpMLineIndex): 58 * platform/mediastream/RTCPeerConnectionHandler.h: 59 (WebCore): 60 (RTCPeerConnectionHandler): 61 * platform/mediastream/RTCPeerConnectionHandlerClient.h: 62 (WebCore): 63 (RTCPeerConnectionHandlerClient): 64 * platform/mediastream/chromium/RTCPeerConnectionHandlerChromium.cpp: 65 (WebCore::RTCPeerConnectionHandlerChromium::updateIce): 66 (WebCore): 67 (WebCore::RTCPeerConnectionHandlerChromium::addIceCandidate): 68 (WebCore::RTCPeerConnectionHandlerChromium::didGenerateICECandidate): 69 (WebCore::RTCPeerConnectionHandlerChromium::didChangeICEState): 70 * platform/mediastream/chromium/RTCPeerConnectionHandlerChromium.h: 71 (WebKit): 72 (RTCPeerConnectionHandlerChromium): 73 1 74 2012-09-03 Allan Sandfeld Jensen <allan.jensen@nokia.com> 2 75 -
trunk/Source/WebCore/GNUmakefile.list.am
r127217 r127425 630 630 DerivedSources/WebCore/JSRTCIceCandidate.cpp \ 631 631 DerivedSources/WebCore/JSRTCIceCandidate.h \ 632 DerivedSources/WebCore/JSRTCIceCandidateEvent.cpp \ 633 DerivedSources/WebCore/JSRTCIceCandidateEvent.h \ 632 634 DerivedSources/WebCore/JSRTCPeerConnection.cpp \ 633 635 DerivedSources/WebCore/JSRTCPeerConnection.h \ … … 1225 1227 $(WebCore)/Modules/mediastream/PeerConnection00.idl \ 1226 1228 $(WebCore)/Modules/mediastream/RTCIceCandidate.idl \ 1229 $(WebCore)/Modules/mediastream/RTCIceCandidateEvent.idl \ 1227 1230 $(WebCore)/Modules/mediastream/RTCPeerConnection.idl \ 1228 1231 $(WebCore)/Modules/mediastream/RTCSessionDescription.idl \ … … 1920 1923 Source/WebCore/Modules/mediastream/RTCIceCandidate.cpp \ 1921 1924 Source/WebCore/Modules/mediastream/RTCIceCandidate.h \ 1925 Source/WebCore/Modules/mediastream/RTCIceCandidateEvent.cpp \ 1926 Source/WebCore/Modules/mediastream/RTCIceCandidateEvent.h \ 1922 1927 Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp \ 1923 1928 Source/WebCore/Modules/mediastream/RTCPeerConnection.h \ -
trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp
r127365 r127425 41 41 #include "MediaStreamEvent.h" 42 42 #include "RTCConfiguration.h" 43 #include "RTCIceCandidate.h" 44 #include "RTCIceCandidateDescriptor.h" 45 #include "RTCIceCandidateEvent.h" 43 46 #include "ScriptExecutionContext.h" 44 47 … … 115 118 : ActiveDOMObject(context, this) 116 119 , m_readyState(ReadyStateNew) 120 , m_iceState(IceStateClosed) 117 121 , m_localStreams(MediaStreamList::create()) 118 122 , m_remoteStreams(MediaStreamList::create()) … … 127 131 } 128 132 133 void RTCPeerConnection::updateIce(const Dictionary& rtcConfiguration, const Dictionary& mediaConstraints, ExceptionCode& ec) 134 { 135 if (m_readyState == ReadyStateClosing || m_readyState == ReadyStateClosed) { 136 ec = INVALID_STATE_ERR; 137 return; 138 } 139 140 RefPtr<RTCConfiguration> configuration = parseConfiguration(rtcConfiguration, ec); 141 if (ec) 142 return; 143 144 RefPtr<MediaConstraints> constraints = MediaConstraintsImpl::create(mediaConstraints, ec); 145 if (ec) 146 return; 147 148 bool valid = m_peerHandler->updateIce(configuration, constraints); 149 if (!valid) 150 ec = SYNTAX_ERR; 151 } 152 153 void RTCPeerConnection::addIceCandidate(RTCIceCandidate* iceCandidate, ExceptionCode& ec) 154 { 155 if (m_readyState == ReadyStateClosing || m_readyState == ReadyStateClosed) { 156 ec = INVALID_STATE_ERR; 157 return; 158 } 159 160 if (!iceCandidate) { 161 ec = TYPE_MISMATCH_ERR; 162 return; 163 } 164 165 bool valid = m_peerHandler->addIceCandidate(iceCandidate->descriptor()); 166 if (!valid) 167 ec = SYNTAX_ERR; 168 } 169 129 170 String RTCPeerConnection::readyState() const 130 171 { 131 172 switch (m_readyState) { 132 173 case ReadyStateNew: 133 return "new";174 return ASCIILiteral("new"); 134 175 case ReadyStateOpening: 135 return "opening";176 return ASCIILiteral("opening"); 136 177 case ReadyStateActive: 137 return "active";178 return ASCIILiteral("active"); 138 179 case ReadyStateClosing: 139 return "closing";180 return ASCIILiteral("closing"); 140 181 case ReadyStateClosed: 141 return "closed";182 return ASCIILiteral("closed"); 142 183 } 143 184 144 185 ASSERT_NOT_REACHED(); 145 return ""; 186 return ASCIILiteral(""); 187 } 188 189 String RTCPeerConnection::iceState() const 190 { 191 switch (m_iceState) { 192 case IceStateNew: 193 return ASCIILiteral("new"); 194 case IceStateGathering: 195 return ASCIILiteral("gathering"); 196 case IceStateWaiting: 197 return ASCIILiteral("waiting"); 198 case IceStateChecking: 199 return ASCIILiteral("checking"); 200 case IceStateConnected: 201 return ASCIILiteral("connected"); 202 case IceStateCompleted: 203 return ASCIILiteral("completed"); 204 case IceStateFailed: 205 return ASCIILiteral("failed"); 206 case IceStateClosed: 207 return ASCIILiteral("closed"); 208 } 209 210 ASSERT_NOT_REACHED(); 211 return ASCIILiteral(""); 146 212 } 147 213 … … 210 276 } 211 277 278 changeIceState(IceStateClosed); 212 279 changeReadyState(ReadyStateClosed); 213 280 stop(); 214 281 } 215 282 283 void RTCPeerConnection::didGenerateIceCandidate(PassRefPtr<RTCIceCandidateDescriptor> iceCandidateDescriptor) 284 { 285 ASSERT(scriptExecutionContext()->isContextThread()); 286 if (!iceCandidateDescriptor) 287 dispatchEvent(RTCIceCandidateEvent::create(false, false, 0)); 288 else { 289 RefPtr<RTCIceCandidate> iceCandidate = RTCIceCandidate::create(iceCandidateDescriptor); 290 dispatchEvent(RTCIceCandidateEvent::create(false, false, iceCandidate.release())); 291 } 292 } 293 216 294 void RTCPeerConnection::didChangeReadyState(ReadyState newState) 217 295 { … … 220 298 } 221 299 300 void RTCPeerConnection::didChangeIceState(IceState newState) 301 { 302 ASSERT(scriptExecutionContext()->isContextThread()); 303 changeIceState(newState); 304 } 305 222 306 void RTCPeerConnection::didAddRemoteStream(PassRefPtr<MediaStreamDescriptor> streamDescriptor) 223 307 { … … 262 346 void RTCPeerConnection::stop() 263 347 { 348 m_iceState = IceStateClosed; 264 349 m_readyState = ReadyStateClosed; 265 350 … … 304 389 } 305 390 391 void RTCPeerConnection::changeIceState(IceState iceState) 392 { 393 if (iceState == m_iceState || m_readyState == ReadyStateClosed) 394 return; 395 396 m_iceState = iceState; 397 dispatchEvent(Event::create(eventNames().icechangeEvent, false, false)); 398 } 399 306 400 } // namespace WebCore 307 401 -
trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.h
r127365 r127425 40 40 #include "MediaStream.h" 41 41 #include "MediaStreamList.h" 42 #include "RTCIceCandidate.h" 42 43 #include "RTCPeerConnectionHandler.h" 43 44 #include "RTCPeerConnectionHandlerClient.h" … … 56 57 String readyState() const; 57 58 59 void updateIce(const Dictionary& rtcConfiguration, const Dictionary& mediaConstraints, ExceptionCode&); 60 61 void addIceCandidate(RTCIceCandidate*, ExceptionCode&); 62 63 String iceState() const; 64 58 65 MediaStreamList* localStreams() const; 66 59 67 MediaStreamList* remoteStreams() const; 68 60 69 void addStream(const PassRefPtr<MediaStream>, const Dictionary& mediaConstraints, ExceptionCode&); 70 61 71 void removeStream(MediaStream*, ExceptionCode&); 62 72 63 73 void close(ExceptionCode&); 64 74 75 DEFINE_ATTRIBUTE_EVENT_LISTENER(icecandidate); 65 76 DEFINE_ATTRIBUTE_EVENT_LISTENER(open); 66 77 DEFINE_ATTRIBUTE_EVENT_LISTENER(statechange); 67 78 DEFINE_ATTRIBUTE_EVENT_LISTENER(addstream); 68 79 DEFINE_ATTRIBUTE_EVENT_LISTENER(removestream); 80 DEFINE_ATTRIBUTE_EVENT_LISTENER(icechange); 69 81 70 82 // RTCPeerConnectionHandlerClient 83 virtual void didGenerateIceCandidate(PassRefPtr<RTCIceCandidateDescriptor>) OVERRIDE; 71 84 virtual void didChangeReadyState(ReadyState) OVERRIDE; 85 virtual void didChangeIceState(IceState) OVERRIDE; 72 86 virtual void didAddRemoteStream(PassRefPtr<MediaStreamDescriptor>) OVERRIDE; 73 87 virtual void didRemoveRemoteStream(MediaStreamDescriptor*) OVERRIDE; … … 96 110 97 111 void changeReadyState(ReadyState); 112 void changeIceState(IceState); 98 113 99 114 ReadyState m_readyState; 115 IceState m_iceState; 100 116 101 117 RefPtr<MediaStreamList> m_localStreams; -
trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.idl
r127365 r127425 34 34 Conditional=MEDIA_STREAM, 35 35 ActiveDOMObject, 36 Constructor(in Dictionary rtcI CEServers, in [Optional=DefaultIsUndefined] Dictionary mediaConstraints),36 Constructor(in Dictionary rtcIceServers, in [Optional=DefaultIsUndefined] Dictionary mediaConstraints), 37 37 ConstructorRaisesException, 38 38 CallWith=ScriptExecutionContext, … … 40 40 ] RTCPeerConnection { 41 41 readonly attribute DOMString readyState; 42 43 void updateIce(in [Optional=DefaultIsUndefined] Dictionary configuration, in [Optional=DefaultIsUndefined] Dictionary mediaConstraints) 44 raises(DOMException); 45 46 void addIceCandidate(in RTCIceCandidate candidate) 47 raises(DOMException); 48 49 readonly attribute DOMString iceState; 42 50 43 51 readonly attribute MediaStreamList localStreams; … … 52 60 raises(DOMException); 53 61 62 attribute EventListener onicecandidate; 54 63 attribute EventListener onopen; 55 64 attribute EventListener onstatechange; 56 65 attribute EventListener onaddstream; 57 66 attribute EventListener onremovestream; 67 attribute EventListener onicechange; 58 68 59 69 // EventTarget interface -
trunk/Source/WebCore/WebCore.gypi
r127417 r127425 864 864 'Modules/mediastream/PeerConnection00.idl', 865 865 'Modules/mediastream/RTCIceCandidate.idl', 866 'Modules/mediastream/RTCIceCandidateEvent.idl', 866 867 'Modules/mediastream/RTCPeerConnection.idl', 867 868 'Modules/mediastream/RTCSessionDescription.idl', … … 1606 1607 'Modules/mediastream/RTCIceCandidate.cpp', 1607 1608 'Modules/mediastream/RTCIceCandidate.h', 1609 'Modules/mediastream/RTCIceCandidateEvent.cpp', 1610 'Modules/mediastream/RTCIceCandidateEvent.h', 1608 1611 'Modules/mediastream/RTCPeerConnection.cpp', 1609 1612 'Modules/mediastream/RTCPeerConnection.h', … … 8338 8341 'platform/chromium/support/WebPrerender.cpp', 8339 8342 'platform/chromium/support/WebRTCConfiguration.cpp', 8343 'platform/chromium/support/WebRTCICECandidateDescriptor.cpp', 8340 8344 'platform/chromium/support/WebScrollbarThemeGeometryNative.cpp', 8341 8345 'platform/chromium/support/WebScrollbarThemeGeometryNative.h', -
trunk/Source/WebCore/dom/EventNames.h
r125850 r127425 228 228 macro(mute) \ 229 229 macro(unmute) \ 230 macro(icechange) \ 231 macro(icecandidate) \ 230 232 \ 231 233 macro(show) \ -
trunk/Source/WebCore/dom/EventNames.in
r125850 r127425 32 32 MediaStreamEvent conditional=MEDIA_STREAM 33 33 MediaStreamTrackEvent conditional=MEDIA_STREAM 34 RTCIceCandidateEvent conditional=MEDIA_STREAM 34 35 SpeechInputEvent conditional=INPUT_SPEECH 35 36 SpeechRecognitionError conditional=SCRIPTED_SPEECH -
trunk/Source/WebCore/platform/chromium/support/WebRTCICECandidateDescriptor.cpp
r127423 r127425 29 29 */ 30 30 31 #ifndef MockWebRTCPeerConnectionHandler_h 32 #define MockWebRTCPeerConnectionHandler_h 31 #include "config.h" 33 32 34 33 #if ENABLE(MEDIA_STREAM) 35 #include <public/WebRTCPeerConnectionHandler.h> 34 35 #include <public/WebRTCICECandidateDescriptor.h> 36 37 #include "RTCIceCandidateDescriptor.h" 38 #include <public/WebString.h> 39 40 using namespace WebCore; 36 41 37 42 namespace WebKit { 38 class WebRTCPeerConnectionHandlerClient;39 };40 43 41 class MockWebRTCPeerConnectionHandler : public WebKit::WebRTCPeerConnectionHandler { 42 public: 43 explicit MockWebRTCPeerConnectionHandler(WebKit::WebRTCPeerConnectionHandlerClient*); 44 WebRTCICECandidateDescriptor::WebRTCICECandidateDescriptor(RTCIceCandidateDescriptor* iceCandidate) 45 : m_private(iceCandidate) 46 { 47 } 44 48 45 virtual bool initialize(const WebKit::WebRTCConfiguration&, const WebKit::WebMediaConstraints&) OVERRIDE; 49 WebRTCICECandidateDescriptor::WebRTCICECandidateDescriptor(PassRefPtr<RTCIceCandidateDescriptor> iceCandidate) 50 : m_private(iceCandidate) 51 { 52 } 46 53 47 virtual bool addStream(const WebKit::WebMediaStreamDescriptor&, const WebKit::WebMediaConstraints&) OVERRIDE; 48 virtual void removeStream(const WebKit::WebMediaStreamDescriptor&) OVERRIDE; 49 virtual void stop() OVERRIDE; 54 void WebRTCICECandidateDescriptor::assign(const WebRTCICECandidateDescriptor& other) 55 { 56 m_private = other.m_private; 57 } 50 58 51 private: 52 MockWebRTCPeerConnectionHandler() { } 59 void WebRTCICECandidateDescriptor::reset() 60 { 61 m_private.reset(); 62 } 53 63 54 WebKit::WebRTCPeerConnectionHandlerClient* m_client; 55 }; 64 void WebRTCICECandidateDescriptor::initialize(const WebString& candidate, const WebString& sdpMid, unsigned short sdpMLineIndex) 65 { 66 m_private = RTCIceCandidateDescriptor::create(candidate, sdpMid, sdpMLineIndex); 67 } 68 69 WebRTCICECandidateDescriptor::operator PassRefPtr<WebCore::RTCIceCandidateDescriptor>() const 70 { 71 return m_private.get(); 72 } 73 74 WebString WebRTCICECandidateDescriptor::candidate() const 75 { 76 ASSERT(!m_private.isNull()); 77 return m_private->candidate(); 78 } 79 80 WebString WebRTCICECandidateDescriptor::sdpMid() const 81 { 82 ASSERT(!m_private.isNull()); 83 return m_private->sdpMid(); 84 } 85 86 unsigned short WebRTCICECandidateDescriptor::sdpMLineIndex() const 87 { 88 ASSERT(!m_private.isNull()); 89 return m_private->sdpMLineIndex(); 90 } 91 92 } // namespace WebKit 56 93 57 94 #endif // ENABLE(MEDIA_STREAM) 58 95 59 #endif // MockWebRTCPeerConnectionHandler_h60 -
trunk/Source/WebCore/platform/mediastream/RTCIceCandidateDescriptor.h
r126328 r127425 45 45 virtual ~RTCIceCandidateDescriptor(); 46 46 47 const String& candidate() { return m_candidate; }48 const String& sdpMid() { return m_sdpMid; }49 unsigned short sdpMLineIndex() { return m_sdpMLineIndex; }47 const String& candidate() const { return m_candidate; } 48 const String& sdpMid() const { return m_sdpMid; } 49 unsigned short sdpMLineIndex() const { return m_sdpMLineIndex; } 50 50 51 51 private: -
trunk/Source/WebCore/platform/mediastream/RTCPeerConnectionHandler.cpp
r127365 r127425 49 49 virtual bool initialize(PassRefPtr<RTCConfiguration>, PassRefPtr<MediaConstraints>) OVERRIDE; 50 50 51 virtual bool updateIce(PassRefPtr<RTCConfiguration>, PassRefPtr<MediaConstraints>) OVERRIDE; 52 virtual bool addIceCandidate(PassRefPtr<RTCIceCandidateDescriptor>) OVERRIDE; 51 53 virtual bool addStream(PassRefPtr<MediaStreamDescriptor>, PassRefPtr<MediaConstraints>) OVERRIDE; 52 54 virtual void removeStream(PassRefPtr<MediaStreamDescriptor>) OVERRIDE; … … 86 88 } 87 89 90 bool RTCPeerConnectionHandlerDummy::updateIce(PassRefPtr<RTCConfiguration>, PassRefPtr<MediaConstraints>) 91 { 92 return false; 93 } 94 95 bool RTCPeerConnectionHandlerDummy::addIceCandidate(PassRefPtr<RTCIceCandidateDescriptor>) 96 { 97 return false; 98 } 99 88 100 void RTCPeerConnectionHandlerDummy::stop() 89 101 { -
trunk/Source/WebCore/platform/mediastream/RTCPeerConnectionHandler.h
r127365 r127425 42 42 class MediaConstraints; 43 43 class RTCConfiguration; 44 class RTCIceCandidateDescriptor; 44 45 class RTCPeerConnectionHandlerClient; 45 46 … … 51 52 virtual bool initialize(PassRefPtr<RTCConfiguration>, PassRefPtr<MediaConstraints>) = 0; 52 53 54 virtual bool updateIce(PassRefPtr<RTCConfiguration>, PassRefPtr<MediaConstraints>) = 0; 55 virtual bool addIceCandidate(PassRefPtr<RTCIceCandidateDescriptor>) = 0; 53 56 virtual bool addStream(PassRefPtr<MediaStreamDescriptor>, PassRefPtr<MediaConstraints>) = 0; 54 57 virtual void removeStream(PassRefPtr<MediaStreamDescriptor>) = 0; -
trunk/Source/WebCore/platform/mediastream/RTCPeerConnectionHandlerClient.h
r127365 r127425 39 39 40 40 class MediaStreamDescriptor; 41 class RTCIceCandidateDescriptor; 41 42 42 43 class RTCPeerConnectionHandlerClient { … … 50 51 }; 51 52 53 enum IceState { 54 IceStateNew = 1, 55 IceStateGathering = 2, 56 IceStateWaiting = 3, 57 IceStateChecking = 4, 58 IceStateConnected = 5, 59 IceStateCompleted = 6, 60 IceStateFailed = 7, 61 IceStateClosed = 8 62 }; 63 52 64 virtual ~RTCPeerConnectionHandlerClient() { } 53 65 66 virtual void didGenerateIceCandidate(PassRefPtr<RTCIceCandidateDescriptor>) = 0; 54 67 virtual void didChangeReadyState(ReadyState) = 0; 68 virtual void didChangeIceState(IceState) = 0; 55 69 virtual void didAddRemoteStream(PassRefPtr<MediaStreamDescriptor>) = 0; 56 70 virtual void didRemoveRemoteStream(MediaStreamDescriptor*) = 0; -
trunk/Source/WebCore/platform/mediastream/chromium/RTCPeerConnectionHandlerChromium.cpp
r127365 r127425 37 37 #include "MediaConstraints.h" 38 38 #include "RTCConfiguration.h" 39 #include "RTCIceCandidateDescriptor.h" 39 40 #include "RTCPeerConnectionHandlerClient.h" 40 41 #include <public/Platform.h> … … 42 43 #include <public/WebMediaStreamDescriptor.h> 43 44 #include <public/WebRTCConfiguration.h> 45 #include <public/WebRTCICECandidateDescriptor.h> 44 46 #include <wtf/PassOwnPtr.h> 45 47 … … 65 67 m_webHandler = adoptPtr(WebKit::Platform::current()->createRTCPeerConnectionHandler(this)); 66 68 return m_webHandler ? m_webHandler->initialize(configuration, constraints) : false; 69 } 70 71 bool RTCPeerConnectionHandlerChromium::updateIce(PassRefPtr<RTCConfiguration> configuration, PassRefPtr<MediaConstraints> constraints) 72 { 73 if (!m_webHandler) 74 return false; 75 76 return m_webHandler->updateICE(configuration, constraints); 77 } 78 79 bool RTCPeerConnectionHandlerChromium::addIceCandidate(PassRefPtr<RTCIceCandidateDescriptor> iceCandidate) 80 { 81 if (!m_webHandler) 82 return false; 83 84 return m_webHandler->addICECandidate(iceCandidate); 67 85 } 68 86 … … 91 109 } 92 110 111 void RTCPeerConnectionHandlerChromium::didGenerateICECandidate(const WebKit::WebRTCICECandidateDescriptor& iceCandidate) 112 { 113 m_client->didGenerateIceCandidate(iceCandidate); 114 } 115 93 116 void RTCPeerConnectionHandlerChromium::didChangeReadyState(WebKit::WebRTCPeerConnectionHandlerClient::ReadyState state) 94 117 { 95 118 m_client->didChangeReadyState(static_cast<RTCPeerConnectionHandlerClient::ReadyState>(state)); 119 } 120 121 void RTCPeerConnectionHandlerChromium::didChangeICEState(WebKit::WebRTCPeerConnectionHandlerClient::ICEState state) 122 { 123 m_client->didChangeIceState(static_cast<RTCPeerConnectionHandlerClient::IceState>(state)); 96 124 } 97 125 -
trunk/Source/WebCore/platform/mediastream/chromium/RTCPeerConnectionHandlerChromium.h
r127365 r127425 43 43 namespace WebKit { 44 44 class WebMediaStreamDescriptor; 45 class WebRTCICECandidateDescriptor; 45 46 } 46 47 … … 54 55 virtual bool initialize(PassRefPtr<RTCConfiguration>, PassRefPtr<MediaConstraints>) OVERRIDE; 55 56 57 virtual bool updateIce(PassRefPtr<RTCConfiguration>, PassRefPtr<MediaConstraints>) OVERRIDE; 58 virtual bool addIceCandidate(PassRefPtr<RTCIceCandidateDescriptor>) OVERRIDE; 56 59 virtual bool addStream(PassRefPtr<MediaStreamDescriptor>, PassRefPtr<MediaConstraints>) OVERRIDE; 57 60 virtual void removeStream(PassRefPtr<MediaStreamDescriptor>) OVERRIDE; … … 59 62 60 63 // WebKit::WebRTCPeerConnectionHandlerClient implementation. 64 virtual void didGenerateICECandidate(const WebKit::WebRTCICECandidateDescriptor&) OVERRIDE; 61 65 virtual void didChangeReadyState(WebKit::WebRTCPeerConnectionHandlerClient::ReadyState) OVERRIDE; 66 virtual void didChangeICEState(WebKit::WebRTCPeerConnectionHandlerClient::ICEState) OVERRIDE; 62 67 virtual void didAddRemoteStream(const WebKit::WebMediaStreamDescriptor&) OVERRIDE; 63 68 virtual void didRemoveRemoteStream(const WebKit::WebMediaStreamDescriptor&) OVERRIDE; -
trunk/Source/WebKit/chromium/ChangeLog
r127378 r127425 1 2012-09-03 Tommy Widenflycht <tommyw@google.com> 2 3 MediaStream API: Add Ice-related functionality to RTCPeerConnection 4 https://bugs.webkit.org/show_bug.cgi?id=95565 5 6 Reviewed by Adam Barth. 7 8 * src/AssertMatchingEnums.cpp: 9 1 10 2012-09-01 James Robinson <jamesr@chromium.org> 2 11 -
trunk/Source/WebKit/chromium/src/AssertMatchingEnums.cpp
r127365 r127425 603 603 COMPILE_ASSERT_MATCHING_ENUM(WebRTCPeerConnectionHandlerClient::ReadyStateClosing, RTCPeerConnectionHandlerClient::ReadyStateClosing); 604 604 COMPILE_ASSERT_MATCHING_ENUM(WebRTCPeerConnectionHandlerClient::ReadyStateClosed, RTCPeerConnectionHandlerClient::ReadyStateClosed); 605 606 COMPILE_ASSERT_MATCHING_ENUM(WebRTCPeerConnectionHandlerClient::ICEStateNew, RTCPeerConnectionHandlerClient::IceStateNew); 607 COMPILE_ASSERT_MATCHING_ENUM(WebRTCPeerConnectionHandlerClient::ICEStateGathering, RTCPeerConnectionHandlerClient::IceStateGathering); 608 COMPILE_ASSERT_MATCHING_ENUM(WebRTCPeerConnectionHandlerClient::ICEStateWaiting, RTCPeerConnectionHandlerClient::IceStateWaiting); 609 COMPILE_ASSERT_MATCHING_ENUM(WebRTCPeerConnectionHandlerClient::ICEStateChecking, RTCPeerConnectionHandlerClient::IceStateChecking); 610 COMPILE_ASSERT_MATCHING_ENUM(WebRTCPeerConnectionHandlerClient::ICEStateConnected, RTCPeerConnectionHandlerClient::IceStateConnected); 611 COMPILE_ASSERT_MATCHING_ENUM(WebRTCPeerConnectionHandlerClient::ICEStateCompleted, RTCPeerConnectionHandlerClient::IceStateCompleted); 612 COMPILE_ASSERT_MATCHING_ENUM(WebRTCPeerConnectionHandlerClient::ICEStateFailed, RTCPeerConnectionHandlerClient::IceStateFailed); 613 COMPILE_ASSERT_MATCHING_ENUM(WebRTCPeerConnectionHandlerClient::ICEStateClosed, RTCPeerConnectionHandlerClient::IceStateClosed); 605 614 #endif 606 615 -
trunk/Tools/ChangeLog
r127411 r127425 1 2012-09-03 Tommy Widenflycht <tommyw@google.com> 2 3 MediaStream API: Add Ice-related functionality to RTCPeerConnection 4 https://bugs.webkit.org/show_bug.cgi?id=95565 5 6 Reviewed by Adam Barth. 7 8 * DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.cpp: 9 (MockWebRTCPeerConnectionHandler::MockWebRTCPeerConnectionHandler): 10 (MockWebRTCPeerConnectionHandler::updateICE): 11 (MockWebRTCPeerConnectionHandler::addICECandidate): 12 * DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.h: 13 (MockWebRTCPeerConnectionHandler): 14 1 15 2012-09-03 Christophe Dumez <christophe.dumez@intel.com> 2 16 -
trunk/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.cpp
r127365 r127425 87 87 } 88 88 89 bool MockWebRTCPeerConnectionHandler::updateICE(const WebRTCConfiguration&, const WebMediaConstraints&) 90 { 91 m_client->didChangeICEState(WebRTCPeerConnectionHandlerClient::ICEStateGathering); 92 return true; 93 } 94 95 bool MockWebRTCPeerConnectionHandler::addICECandidate(const WebRTCICECandidateDescriptor& iceCandidate) 96 { 97 m_client->didGenerateICECandidate(iceCandidate); 98 return true; 99 } 100 89 101 bool MockWebRTCPeerConnectionHandler::addStream(const WebMediaStreamDescriptor& stream, const WebMediaConstraints&) 90 102 { -
trunk/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.h
r127365 r127425 45 45 virtual bool initialize(const WebKit::WebRTCConfiguration&, const WebKit::WebMediaConstraints&) OVERRIDE; 46 46 47 virtual bool updateICE(const WebKit::WebRTCConfiguration&, const WebKit::WebMediaConstraints&) OVERRIDE; 48 virtual bool addICECandidate(const WebKit::WebRTCICECandidateDescriptor&) OVERRIDE; 47 49 virtual bool addStream(const WebKit::WebMediaStreamDescriptor&, const WebKit::WebMediaConstraints&) OVERRIDE; 48 50 virtual void removeStream(const WebKit::WebMediaStreamDescriptor&) OVERRIDE;
Note: See TracChangeset
for help on using the changeset viewer.