haikuwebkit/LayoutTests/webrtc/routines.js

300 lines
9.2 KiB
JavaScript
Raw Permalink Normal View History

[WebRTC] Add a LibWebRTC mock for testing https://bugs.webkit.org/show_bug.cgi?id=167429 Patch by Youenn Fablet <youennf@gmail.com> on 2017-01-26 Reviewed by Alex Christensen. Source/WebCore: Covered by updated tests although feature is behind a flag, off by default. MockLibWebRTCPeerConnection will allow us testing the code above the WebRTC implementation above LibWebRTC, without reyling on it and controlling the way that the peer connections will behave. Adding support for mock factory to create real peer connections in case where we want to do full testing through the local loopback. Tests: fast/mediastream/getUserMedia-webaudio.html webrtc/datachannel/basic.html webrtc/video.html * WebCore.xcodeproj/project.pbxproj: * testing/Internals.cpp: (WebCore::Internals::Internals): (WebCore::Internals::useMockRTCPeerConnectionFactory): * testing/Internals.h: * testing/Internals.idl: * testing/MockLibWebRTCPeerConnection.cpp: Added. (WebCore::useMockRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::MockLibWebRTCPeerConnectionForIceCandidates): (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::gotLocalDescription): (WebCore::MockLibWebRTCPeerConnectionForIceConnectionState::MockLibWebRTCPeerConnectionForIceConnectionState): (WebCore::MockLibWebRTCPeerConnectionForIceConnectionState::gotLocalDescription): (WebCore::MockLibWebRTCPeerConnectionFactory::MockLibWebRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionFactory::CreatePeerConnection): (WebCore::MockLibWebRTCPeerConnectionFactory::CreateLocalMediaStream): (WebCore::MockLibWebRTCPeerConnection::SetLocalDescription): (WebCore::MockLibWebRTCPeerConnection::SetRemoteDescription): (WebCore::MockLibWebRTCPeerConnection::CreateDataChannel): (WebCore::MockLibWebRTCPeerConnection::AddStream): (WebCore::MockLibWebRTCPeerConnection::RemoveStream): (WebCore::MockLibWebRTCPeerConnection::CreateOffer): (WebCore::MockLibWebRTCPeerConnection::CreateAnswer): * testing/MockLibWebRTCPeerConnection.h: Added. (WebCore::MockLibWebRTCPeerConnection::~MockLibWebRTCPeerConnection): (WebCore::MockLibWebRTCPeerConnection::MockLibWebRTCPeerConnection): (WebCore::MockLibWebRTCPeerConnection::local_streams): (WebCore::MockLibWebRTCPeerConnection::remote_streams): (WebCore::MockLibWebRTCPeerConnection::CreateDtmfSender): (WebCore::MockLibWebRTCPeerConnection::GetStats): (WebCore::MockLibWebRTCPeerConnection::local_description): (WebCore::MockLibWebRTCPeerConnection::remote_description): (WebCore::MockLibWebRTCPeerConnection::AddIceCandidate): (WebCore::MockLibWebRTCPeerConnection::RegisterUMAObserver): (WebCore::MockLibWebRTCPeerConnection::signaling_state): (WebCore::MockLibWebRTCPeerConnection::ice_connection_state): (WebCore::MockLibWebRTCPeerConnection::ice_gathering_state): (WebCore::MockLibWebRTCPeerConnection::StopRtcEventLog): (WebCore::MockLibWebRTCPeerConnection::Close): (WebCore::MockLibWebRTCPeerConnection::gotLocalDescription): (WebCore::MockLibWebRTCIceCandidate::MockLibWebRTCIceCandidate): (WebCore::MockLibWebRTCAudioTrack::MockLibWebRTCAudioTrack): (WebCore::MockLibWebRTCVideoTrack::MockLibWebRTCVideoTrack): (WebCore::MockLibWebRTCDataChannel::MockLibWebRTCDataChannel): (WebCore::MockLibWebRTCPeerConnectionFactory::create): LayoutTests: * TestExpectations: Marking webrtc new tests as skipped for the moment. * fast/mediastream/RTCPeerConnection-createAnswer.html: * fast/mediastream/RTCPeerConnection-icecandidate-event.html: * fast/mediastream/RTCPeerConnection-iceconnectionstatechange-event.html: * webrtc/datachannel/basic.html: Added. * webrtc/routines.js: Added. (createConnections): (closeConnections): (onCreateSessionDescriptionError): (gotDescription1): (gotDescription2): (iceCallback1): (iceCallback2): (onAddIceCandidateSuccess): (onAddIceCandidateError): * webrtc/video.html: Added. Canonical link: https://commits.webkit.org/184528@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-27 04:54:09 +00:00
// Test inspired from https://webrtc.github.io/samples/
var localConnection;
var remoteConnection;
Clean up RTCDataChannel https://bugs.webkit.org/show_bug.cgi?id=169732 LayoutTests/imported/w3c: Patch by Youenn Fablet <youenn@apple.com> on 2017-03-30 Reviewed by Chris Dumez. * web-platform-tests/webrtc/RTCDataChannelEvent-constructor-expected.txt: Source/JavaScriptCore: Patch by Youenn Fablet <youenn@apple.com> on 2017-03-30 Reviewed by Chris Dumez. * runtime/CommonIdentifiers.h: Adding RTCDataChannelEvent. Source/WebCore: Patch by Youenn Fablet <youenn@apple.com> and Jon Lee <jonlee@apple.com> on 2017-03-30 Reviewed by Chris Dumez. Test: webrtc/datachannel/datachannel-event.html webrtc/datachannel/bufferedAmountLowThreshold.html Making RTCDataChannel interface closer to the spec updating implementation accordingly. See https://w3c.github.io/webrtc-pc/#rtcdatachannel. In particular adding RTCDataChannelEvent constructor, and missing bufferedAmount related attributes. Doing some additional cleaning refactoring. Making bufferedAmountIsDecreasing take a bufferedAmount argument so that we get the actual value passed by libwebrtc without needing to get it from the libwebrtc network thread again. In the future, we should store the bufferedAmount value in RTCDataChannel and update its value on each libwebrtc OnBufferedAmountChange. Special treatment may be needed when the data channel is closed, in which case the bufferedAmount should just be updated to increase in the send method. Added some FIXMEs as RTCDataChannel is not aligned with the spec related to send and bufferedAmount. * Modules/mediastream/RTCDataChannel.cpp: (WebCore::RTCDataChannel::send): (WebCore::RTCDataChannel::close): (WebCore::RTCDataChannel::didChangeReadyState): (WebCore::RTCDataChannel::bufferedAmountIsDecreasing): * Modules/mediastream/RTCDataChannel.h: * Modules/mediastream/RTCDataChannel.idl: * Modules/mediastream/RTCDataChannelEvent.cpp: (WebCore::RTCDataChannelEvent::create): (WebCore::RTCDataChannelEvent::RTCDataChannelEvent): (WebCore::RTCDataChannelEvent::channel): * Modules/mediastream/RTCDataChannelEvent.h: * Modules/mediastream/RTCDataChannelEvent.idl: * Modules/mediastream/RTCPeerConnection.idl: * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp: (WebCore::LibWebRTCDataChannelHandler::OnStateChange): * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: (WebCore::LibWebRTCMediaEndpoint::addDataChannel): * WebCore.xcodeproj/project.pbxproj: * dom/EventNames.h: * platform/mediastream/RTCDataChannelHandler.h: * platform/mediastream/RTCDataChannelHandlerClient.h: * platform/mediastream/RTCDataChannelState.h: Added. * platform/mediastream/RTCPeerConnectionHandlerClient.h: * platform/mock/RTCDataChannelHandlerMock.cpp: (WebCore::RTCDataChannelHandlerMock::setClient): (WebCore::RTCDataChannelHandlerMock::close): * platform/mock/RTCNotifiersMock.cpp: (WebCore::IceConnectionNotifier::IceConnectionNotifier): (WebCore::SignalingStateNotifier::SignalingStateNotifier): (WebCore::DataChannelStateNotifier::DataChannelStateNotifier): * platform/mock/RTCNotifiersMock.h: LayoutTests: Patch by Youenn Fablet <youenn@apple.com> on 2017-03-30 Reviewed by Chris Dumez. * webrtc/datachannel/bufferedAmountLowThreshold-expected.txt: Added. * webrtc/datachannel/bufferedAmountLowThreshold.html: Added. Canonical link: https://commits.webkit.org/187223@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@214627 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-30 21:42:19 +00:00
function createConnections(setupLocalConnection, setupRemoteConnection, options = { }) {
[WebRTC] Add a LibWebRTC mock for testing https://bugs.webkit.org/show_bug.cgi?id=167429 Patch by Youenn Fablet <youennf@gmail.com> on 2017-01-26 Reviewed by Alex Christensen. Source/WebCore: Covered by updated tests although feature is behind a flag, off by default. MockLibWebRTCPeerConnection will allow us testing the code above the WebRTC implementation above LibWebRTC, without reyling on it and controlling the way that the peer connections will behave. Adding support for mock factory to create real peer connections in case where we want to do full testing through the local loopback. Tests: fast/mediastream/getUserMedia-webaudio.html webrtc/datachannel/basic.html webrtc/video.html * WebCore.xcodeproj/project.pbxproj: * testing/Internals.cpp: (WebCore::Internals::Internals): (WebCore::Internals::useMockRTCPeerConnectionFactory): * testing/Internals.h: * testing/Internals.idl: * testing/MockLibWebRTCPeerConnection.cpp: Added. (WebCore::useMockRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::MockLibWebRTCPeerConnectionForIceCandidates): (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::gotLocalDescription): (WebCore::MockLibWebRTCPeerConnectionForIceConnectionState::MockLibWebRTCPeerConnectionForIceConnectionState): (WebCore::MockLibWebRTCPeerConnectionForIceConnectionState::gotLocalDescription): (WebCore::MockLibWebRTCPeerConnectionFactory::MockLibWebRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionFactory::CreatePeerConnection): (WebCore::MockLibWebRTCPeerConnectionFactory::CreateLocalMediaStream): (WebCore::MockLibWebRTCPeerConnection::SetLocalDescription): (WebCore::MockLibWebRTCPeerConnection::SetRemoteDescription): (WebCore::MockLibWebRTCPeerConnection::CreateDataChannel): (WebCore::MockLibWebRTCPeerConnection::AddStream): (WebCore::MockLibWebRTCPeerConnection::RemoveStream): (WebCore::MockLibWebRTCPeerConnection::CreateOffer): (WebCore::MockLibWebRTCPeerConnection::CreateAnswer): * testing/MockLibWebRTCPeerConnection.h: Added. (WebCore::MockLibWebRTCPeerConnection::~MockLibWebRTCPeerConnection): (WebCore::MockLibWebRTCPeerConnection::MockLibWebRTCPeerConnection): (WebCore::MockLibWebRTCPeerConnection::local_streams): (WebCore::MockLibWebRTCPeerConnection::remote_streams): (WebCore::MockLibWebRTCPeerConnection::CreateDtmfSender): (WebCore::MockLibWebRTCPeerConnection::GetStats): (WebCore::MockLibWebRTCPeerConnection::local_description): (WebCore::MockLibWebRTCPeerConnection::remote_description): (WebCore::MockLibWebRTCPeerConnection::AddIceCandidate): (WebCore::MockLibWebRTCPeerConnection::RegisterUMAObserver): (WebCore::MockLibWebRTCPeerConnection::signaling_state): (WebCore::MockLibWebRTCPeerConnection::ice_connection_state): (WebCore::MockLibWebRTCPeerConnection::ice_gathering_state): (WebCore::MockLibWebRTCPeerConnection::StopRtcEventLog): (WebCore::MockLibWebRTCPeerConnection::Close): (WebCore::MockLibWebRTCPeerConnection::gotLocalDescription): (WebCore::MockLibWebRTCIceCandidate::MockLibWebRTCIceCandidate): (WebCore::MockLibWebRTCAudioTrack::MockLibWebRTCAudioTrack): (WebCore::MockLibWebRTCVideoTrack::MockLibWebRTCVideoTrack): (WebCore::MockLibWebRTCDataChannel::MockLibWebRTCDataChannel): (WebCore::MockLibWebRTCPeerConnectionFactory::create): LayoutTests: * TestExpectations: Marking webrtc new tests as skipped for the moment. * fast/mediastream/RTCPeerConnection-createAnswer.html: * fast/mediastream/RTCPeerConnection-icecandidate-event.html: * fast/mediastream/RTCPeerConnection-iceconnectionstatechange-event.html: * webrtc/datachannel/basic.html: Added. * webrtc/routines.js: Added. (createConnections): (closeConnections): (onCreateSessionDescriptionError): (gotDescription1): (gotDescription2): (iceCallback1): (iceCallback2): (onAddIceCandidateSuccess): (onAddIceCandidateError): * webrtc/video.html: Added. Canonical link: https://commits.webkit.org/184528@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-27 04:54:09 +00:00
localConnection = new RTCPeerConnection();
remoteConnection = new RTCPeerConnection();
Clean up RTCDataChannel https://bugs.webkit.org/show_bug.cgi?id=169732 LayoutTests/imported/w3c: Patch by Youenn Fablet <youenn@apple.com> on 2017-03-30 Reviewed by Chris Dumez. * web-platform-tests/webrtc/RTCDataChannelEvent-constructor-expected.txt: Source/JavaScriptCore: Patch by Youenn Fablet <youenn@apple.com> on 2017-03-30 Reviewed by Chris Dumez. * runtime/CommonIdentifiers.h: Adding RTCDataChannelEvent. Source/WebCore: Patch by Youenn Fablet <youenn@apple.com> and Jon Lee <jonlee@apple.com> on 2017-03-30 Reviewed by Chris Dumez. Test: webrtc/datachannel/datachannel-event.html webrtc/datachannel/bufferedAmountLowThreshold.html Making RTCDataChannel interface closer to the spec updating implementation accordingly. See https://w3c.github.io/webrtc-pc/#rtcdatachannel. In particular adding RTCDataChannelEvent constructor, and missing bufferedAmount related attributes. Doing some additional cleaning refactoring. Making bufferedAmountIsDecreasing take a bufferedAmount argument so that we get the actual value passed by libwebrtc without needing to get it from the libwebrtc network thread again. In the future, we should store the bufferedAmount value in RTCDataChannel and update its value on each libwebrtc OnBufferedAmountChange. Special treatment may be needed when the data channel is closed, in which case the bufferedAmount should just be updated to increase in the send method. Added some FIXMEs as RTCDataChannel is not aligned with the spec related to send and bufferedAmount. * Modules/mediastream/RTCDataChannel.cpp: (WebCore::RTCDataChannel::send): (WebCore::RTCDataChannel::close): (WebCore::RTCDataChannel::didChangeReadyState): (WebCore::RTCDataChannel::bufferedAmountIsDecreasing): * Modules/mediastream/RTCDataChannel.h: * Modules/mediastream/RTCDataChannel.idl: * Modules/mediastream/RTCDataChannelEvent.cpp: (WebCore::RTCDataChannelEvent::create): (WebCore::RTCDataChannelEvent::RTCDataChannelEvent): (WebCore::RTCDataChannelEvent::channel): * Modules/mediastream/RTCDataChannelEvent.h: * Modules/mediastream/RTCDataChannelEvent.idl: * Modules/mediastream/RTCPeerConnection.idl: * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp: (WebCore::LibWebRTCDataChannelHandler::OnStateChange): * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: (WebCore::LibWebRTCMediaEndpoint::addDataChannel): * WebCore.xcodeproj/project.pbxproj: * dom/EventNames.h: * platform/mediastream/RTCDataChannelHandler.h: * platform/mediastream/RTCDataChannelHandlerClient.h: * platform/mediastream/RTCDataChannelState.h: Added. * platform/mediastream/RTCPeerConnectionHandlerClient.h: * platform/mock/RTCDataChannelHandlerMock.cpp: (WebCore::RTCDataChannelHandlerMock::setClient): (WebCore::RTCDataChannelHandlerMock::close): * platform/mock/RTCNotifiersMock.cpp: (WebCore::IceConnectionNotifier::IceConnectionNotifier): (WebCore::SignalingStateNotifier::SignalingStateNotifier): (WebCore::DataChannelStateNotifier::DataChannelStateNotifier): * platform/mock/RTCNotifiersMock.h: LayoutTests: Patch by Youenn Fablet <youenn@apple.com> on 2017-03-30 Reviewed by Chris Dumez. * webrtc/datachannel/bufferedAmountLowThreshold-expected.txt: Added. * webrtc/datachannel/bufferedAmountLowThreshold.html: Added. Canonical link: https://commits.webkit.org/187223@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@214627 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-30 21:42:19 +00:00
remoteConnection.onicecandidate = (event) => { iceCallback2(event, options.filterOutICECandidate) };
[WebRTC] Add a LibWebRTC mock for testing https://bugs.webkit.org/show_bug.cgi?id=167429 Patch by Youenn Fablet <youennf@gmail.com> on 2017-01-26 Reviewed by Alex Christensen. Source/WebCore: Covered by updated tests although feature is behind a flag, off by default. MockLibWebRTCPeerConnection will allow us testing the code above the WebRTC implementation above LibWebRTC, without reyling on it and controlling the way that the peer connections will behave. Adding support for mock factory to create real peer connections in case where we want to do full testing through the local loopback. Tests: fast/mediastream/getUserMedia-webaudio.html webrtc/datachannel/basic.html webrtc/video.html * WebCore.xcodeproj/project.pbxproj: * testing/Internals.cpp: (WebCore::Internals::Internals): (WebCore::Internals::useMockRTCPeerConnectionFactory): * testing/Internals.h: * testing/Internals.idl: * testing/MockLibWebRTCPeerConnection.cpp: Added. (WebCore::useMockRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::MockLibWebRTCPeerConnectionForIceCandidates): (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::gotLocalDescription): (WebCore::MockLibWebRTCPeerConnectionForIceConnectionState::MockLibWebRTCPeerConnectionForIceConnectionState): (WebCore::MockLibWebRTCPeerConnectionForIceConnectionState::gotLocalDescription): (WebCore::MockLibWebRTCPeerConnectionFactory::MockLibWebRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionFactory::CreatePeerConnection): (WebCore::MockLibWebRTCPeerConnectionFactory::CreateLocalMediaStream): (WebCore::MockLibWebRTCPeerConnection::SetLocalDescription): (WebCore::MockLibWebRTCPeerConnection::SetRemoteDescription): (WebCore::MockLibWebRTCPeerConnection::CreateDataChannel): (WebCore::MockLibWebRTCPeerConnection::AddStream): (WebCore::MockLibWebRTCPeerConnection::RemoveStream): (WebCore::MockLibWebRTCPeerConnection::CreateOffer): (WebCore::MockLibWebRTCPeerConnection::CreateAnswer): * testing/MockLibWebRTCPeerConnection.h: Added. (WebCore::MockLibWebRTCPeerConnection::~MockLibWebRTCPeerConnection): (WebCore::MockLibWebRTCPeerConnection::MockLibWebRTCPeerConnection): (WebCore::MockLibWebRTCPeerConnection::local_streams): (WebCore::MockLibWebRTCPeerConnection::remote_streams): (WebCore::MockLibWebRTCPeerConnection::CreateDtmfSender): (WebCore::MockLibWebRTCPeerConnection::GetStats): (WebCore::MockLibWebRTCPeerConnection::local_description): (WebCore::MockLibWebRTCPeerConnection::remote_description): (WebCore::MockLibWebRTCPeerConnection::AddIceCandidate): (WebCore::MockLibWebRTCPeerConnection::RegisterUMAObserver): (WebCore::MockLibWebRTCPeerConnection::signaling_state): (WebCore::MockLibWebRTCPeerConnection::ice_connection_state): (WebCore::MockLibWebRTCPeerConnection::ice_gathering_state): (WebCore::MockLibWebRTCPeerConnection::StopRtcEventLog): (WebCore::MockLibWebRTCPeerConnection::Close): (WebCore::MockLibWebRTCPeerConnection::gotLocalDescription): (WebCore::MockLibWebRTCIceCandidate::MockLibWebRTCIceCandidate): (WebCore::MockLibWebRTCAudioTrack::MockLibWebRTCAudioTrack): (WebCore::MockLibWebRTCVideoTrack::MockLibWebRTCVideoTrack): (WebCore::MockLibWebRTCDataChannel::MockLibWebRTCDataChannel): (WebCore::MockLibWebRTCPeerConnectionFactory::create): LayoutTests: * TestExpectations: Marking webrtc new tests as skipped for the moment. * fast/mediastream/RTCPeerConnection-createAnswer.html: * fast/mediastream/RTCPeerConnection-icecandidate-event.html: * fast/mediastream/RTCPeerConnection-iceconnectionstatechange-event.html: * webrtc/datachannel/basic.html: Added. * webrtc/routines.js: Added. (createConnections): (closeConnections): (onCreateSessionDescriptionError): (gotDescription1): (gotDescription2): (iceCallback1): (iceCallback2): (onAddIceCandidateSuccess): (onAddIceCandidateError): * webrtc/video.html: Added. Canonical link: https://commits.webkit.org/184528@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-27 04:54:09 +00:00
localConnection.onicecandidate = (event) => { iceCallback1(event, options.filterOutICECandidate) };
Promise.resolve(setupLocalConnection(localConnection)).then(() => {
return Promise.resolve(setupRemoteConnection(remoteConnection));
}).then(() => {
localConnection.createOffer().then((desc) => gotDescription1(desc, options), onCreateSessionDescriptionError);
});
[WebRTC] Add a LibWebRTC mock for testing https://bugs.webkit.org/show_bug.cgi?id=167429 Patch by Youenn Fablet <youennf@gmail.com> on 2017-01-26 Reviewed by Alex Christensen. Source/WebCore: Covered by updated tests although feature is behind a flag, off by default. MockLibWebRTCPeerConnection will allow us testing the code above the WebRTC implementation above LibWebRTC, without reyling on it and controlling the way that the peer connections will behave. Adding support for mock factory to create real peer connections in case where we want to do full testing through the local loopback. Tests: fast/mediastream/getUserMedia-webaudio.html webrtc/datachannel/basic.html webrtc/video.html * WebCore.xcodeproj/project.pbxproj: * testing/Internals.cpp: (WebCore::Internals::Internals): (WebCore::Internals::useMockRTCPeerConnectionFactory): * testing/Internals.h: * testing/Internals.idl: * testing/MockLibWebRTCPeerConnection.cpp: Added. (WebCore::useMockRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::MockLibWebRTCPeerConnectionForIceCandidates): (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::gotLocalDescription): (WebCore::MockLibWebRTCPeerConnectionForIceConnectionState::MockLibWebRTCPeerConnectionForIceConnectionState): (WebCore::MockLibWebRTCPeerConnectionForIceConnectionState::gotLocalDescription): (WebCore::MockLibWebRTCPeerConnectionFactory::MockLibWebRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionFactory::CreatePeerConnection): (WebCore::MockLibWebRTCPeerConnectionFactory::CreateLocalMediaStream): (WebCore::MockLibWebRTCPeerConnection::SetLocalDescription): (WebCore::MockLibWebRTCPeerConnection::SetRemoteDescription): (WebCore::MockLibWebRTCPeerConnection::CreateDataChannel): (WebCore::MockLibWebRTCPeerConnection::AddStream): (WebCore::MockLibWebRTCPeerConnection::RemoveStream): (WebCore::MockLibWebRTCPeerConnection::CreateOffer): (WebCore::MockLibWebRTCPeerConnection::CreateAnswer): * testing/MockLibWebRTCPeerConnection.h: Added. (WebCore::MockLibWebRTCPeerConnection::~MockLibWebRTCPeerConnection): (WebCore::MockLibWebRTCPeerConnection::MockLibWebRTCPeerConnection): (WebCore::MockLibWebRTCPeerConnection::local_streams): (WebCore::MockLibWebRTCPeerConnection::remote_streams): (WebCore::MockLibWebRTCPeerConnection::CreateDtmfSender): (WebCore::MockLibWebRTCPeerConnection::GetStats): (WebCore::MockLibWebRTCPeerConnection::local_description): (WebCore::MockLibWebRTCPeerConnection::remote_description): (WebCore::MockLibWebRTCPeerConnection::AddIceCandidate): (WebCore::MockLibWebRTCPeerConnection::RegisterUMAObserver): (WebCore::MockLibWebRTCPeerConnection::signaling_state): (WebCore::MockLibWebRTCPeerConnection::ice_connection_state): (WebCore::MockLibWebRTCPeerConnection::ice_gathering_state): (WebCore::MockLibWebRTCPeerConnection::StopRtcEventLog): (WebCore::MockLibWebRTCPeerConnection::Close): (WebCore::MockLibWebRTCPeerConnection::gotLocalDescription): (WebCore::MockLibWebRTCIceCandidate::MockLibWebRTCIceCandidate): (WebCore::MockLibWebRTCAudioTrack::MockLibWebRTCAudioTrack): (WebCore::MockLibWebRTCVideoTrack::MockLibWebRTCVideoTrack): (WebCore::MockLibWebRTCDataChannel::MockLibWebRTCDataChannel): (WebCore::MockLibWebRTCPeerConnectionFactory::create): LayoutTests: * TestExpectations: Marking webrtc new tests as skipped for the moment. * fast/mediastream/RTCPeerConnection-createAnswer.html: * fast/mediastream/RTCPeerConnection-icecandidate-event.html: * fast/mediastream/RTCPeerConnection-iceconnectionstatechange-event.html: * webrtc/datachannel/basic.html: Added. * webrtc/routines.js: Added. (createConnections): (closeConnections): (onCreateSessionDescriptionError): (gotDescription1): (gotDescription2): (iceCallback1): (iceCallback2): (onAddIceCandidateSuccess): (onAddIceCandidateError): * webrtc/video.html: Added. Canonical link: https://commits.webkit.org/184528@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-27 04:54:09 +00:00
return [localConnection, remoteConnection]
}
function closeConnections()
{
localConnection.close();
remoteConnection.close();
}
function onCreateSessionDescriptionError(error)
{
assert_unreached();
}
Clean up RTCDataChannel https://bugs.webkit.org/show_bug.cgi?id=169732 LayoutTests/imported/w3c: Patch by Youenn Fablet <youenn@apple.com> on 2017-03-30 Reviewed by Chris Dumez. * web-platform-tests/webrtc/RTCDataChannelEvent-constructor-expected.txt: Source/JavaScriptCore: Patch by Youenn Fablet <youenn@apple.com> on 2017-03-30 Reviewed by Chris Dumez. * runtime/CommonIdentifiers.h: Adding RTCDataChannelEvent. Source/WebCore: Patch by Youenn Fablet <youenn@apple.com> and Jon Lee <jonlee@apple.com> on 2017-03-30 Reviewed by Chris Dumez. Test: webrtc/datachannel/datachannel-event.html webrtc/datachannel/bufferedAmountLowThreshold.html Making RTCDataChannel interface closer to the spec updating implementation accordingly. See https://w3c.github.io/webrtc-pc/#rtcdatachannel. In particular adding RTCDataChannelEvent constructor, and missing bufferedAmount related attributes. Doing some additional cleaning refactoring. Making bufferedAmountIsDecreasing take a bufferedAmount argument so that we get the actual value passed by libwebrtc without needing to get it from the libwebrtc network thread again. In the future, we should store the bufferedAmount value in RTCDataChannel and update its value on each libwebrtc OnBufferedAmountChange. Special treatment may be needed when the data channel is closed, in which case the bufferedAmount should just be updated to increase in the send method. Added some FIXMEs as RTCDataChannel is not aligned with the spec related to send and bufferedAmount. * Modules/mediastream/RTCDataChannel.cpp: (WebCore::RTCDataChannel::send): (WebCore::RTCDataChannel::close): (WebCore::RTCDataChannel::didChangeReadyState): (WebCore::RTCDataChannel::bufferedAmountIsDecreasing): * Modules/mediastream/RTCDataChannel.h: * Modules/mediastream/RTCDataChannel.idl: * Modules/mediastream/RTCDataChannelEvent.cpp: (WebCore::RTCDataChannelEvent::create): (WebCore::RTCDataChannelEvent::RTCDataChannelEvent): (WebCore::RTCDataChannelEvent::channel): * Modules/mediastream/RTCDataChannelEvent.h: * Modules/mediastream/RTCDataChannelEvent.idl: * Modules/mediastream/RTCPeerConnection.idl: * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp: (WebCore::LibWebRTCDataChannelHandler::OnStateChange): * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: (WebCore::LibWebRTCMediaEndpoint::addDataChannel): * WebCore.xcodeproj/project.pbxproj: * dom/EventNames.h: * platform/mediastream/RTCDataChannelHandler.h: * platform/mediastream/RTCDataChannelHandlerClient.h: * platform/mediastream/RTCDataChannelState.h: Added. * platform/mediastream/RTCPeerConnectionHandlerClient.h: * platform/mock/RTCDataChannelHandlerMock.cpp: (WebCore::RTCDataChannelHandlerMock::setClient): (WebCore::RTCDataChannelHandlerMock::close): * platform/mock/RTCNotifiersMock.cpp: (WebCore::IceConnectionNotifier::IceConnectionNotifier): (WebCore::SignalingStateNotifier::SignalingStateNotifier): (WebCore::DataChannelStateNotifier::DataChannelStateNotifier): * platform/mock/RTCNotifiersMock.h: LayoutTests: Patch by Youenn Fablet <youenn@apple.com> on 2017-03-30 Reviewed by Chris Dumez. * webrtc/datachannel/bufferedAmountLowThreshold-expected.txt: Added. * webrtc/datachannel/bufferedAmountLowThreshold.html: Added. Canonical link: https://commits.webkit.org/187223@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@214627 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-30 21:42:19 +00:00
function gotDescription1(desc, options)
[WebRTC] Add a LibWebRTC mock for testing https://bugs.webkit.org/show_bug.cgi?id=167429 Patch by Youenn Fablet <youennf@gmail.com> on 2017-01-26 Reviewed by Alex Christensen. Source/WebCore: Covered by updated tests although feature is behind a flag, off by default. MockLibWebRTCPeerConnection will allow us testing the code above the WebRTC implementation above LibWebRTC, without reyling on it and controlling the way that the peer connections will behave. Adding support for mock factory to create real peer connections in case where we want to do full testing through the local loopback. Tests: fast/mediastream/getUserMedia-webaudio.html webrtc/datachannel/basic.html webrtc/video.html * WebCore.xcodeproj/project.pbxproj: * testing/Internals.cpp: (WebCore::Internals::Internals): (WebCore::Internals::useMockRTCPeerConnectionFactory): * testing/Internals.h: * testing/Internals.idl: * testing/MockLibWebRTCPeerConnection.cpp: Added. (WebCore::useMockRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::MockLibWebRTCPeerConnectionForIceCandidates): (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::gotLocalDescription): (WebCore::MockLibWebRTCPeerConnectionForIceConnectionState::MockLibWebRTCPeerConnectionForIceConnectionState): (WebCore::MockLibWebRTCPeerConnectionForIceConnectionState::gotLocalDescription): (WebCore::MockLibWebRTCPeerConnectionFactory::MockLibWebRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionFactory::CreatePeerConnection): (WebCore::MockLibWebRTCPeerConnectionFactory::CreateLocalMediaStream): (WebCore::MockLibWebRTCPeerConnection::SetLocalDescription): (WebCore::MockLibWebRTCPeerConnection::SetRemoteDescription): (WebCore::MockLibWebRTCPeerConnection::CreateDataChannel): (WebCore::MockLibWebRTCPeerConnection::AddStream): (WebCore::MockLibWebRTCPeerConnection::RemoveStream): (WebCore::MockLibWebRTCPeerConnection::CreateOffer): (WebCore::MockLibWebRTCPeerConnection::CreateAnswer): * testing/MockLibWebRTCPeerConnection.h: Added. (WebCore::MockLibWebRTCPeerConnection::~MockLibWebRTCPeerConnection): (WebCore::MockLibWebRTCPeerConnection::MockLibWebRTCPeerConnection): (WebCore::MockLibWebRTCPeerConnection::local_streams): (WebCore::MockLibWebRTCPeerConnection::remote_streams): (WebCore::MockLibWebRTCPeerConnection::CreateDtmfSender): (WebCore::MockLibWebRTCPeerConnection::GetStats): (WebCore::MockLibWebRTCPeerConnection::local_description): (WebCore::MockLibWebRTCPeerConnection::remote_description): (WebCore::MockLibWebRTCPeerConnection::AddIceCandidate): (WebCore::MockLibWebRTCPeerConnection::RegisterUMAObserver): (WebCore::MockLibWebRTCPeerConnection::signaling_state): (WebCore::MockLibWebRTCPeerConnection::ice_connection_state): (WebCore::MockLibWebRTCPeerConnection::ice_gathering_state): (WebCore::MockLibWebRTCPeerConnection::StopRtcEventLog): (WebCore::MockLibWebRTCPeerConnection::Close): (WebCore::MockLibWebRTCPeerConnection::gotLocalDescription): (WebCore::MockLibWebRTCIceCandidate::MockLibWebRTCIceCandidate): (WebCore::MockLibWebRTCAudioTrack::MockLibWebRTCAudioTrack): (WebCore::MockLibWebRTCVideoTrack::MockLibWebRTCVideoTrack): (WebCore::MockLibWebRTCDataChannel::MockLibWebRTCDataChannel): (WebCore::MockLibWebRTCPeerConnectionFactory::create): LayoutTests: * TestExpectations: Marking webrtc new tests as skipped for the moment. * fast/mediastream/RTCPeerConnection-createAnswer.html: * fast/mediastream/RTCPeerConnection-icecandidate-event.html: * fast/mediastream/RTCPeerConnection-iceconnectionstatechange-event.html: * webrtc/datachannel/basic.html: Added. * webrtc/routines.js: Added. (createConnections): (closeConnections): (onCreateSessionDescriptionError): (gotDescription1): (gotDescription2): (iceCallback1): (iceCallback2): (onAddIceCandidateSuccess): (onAddIceCandidateError): * webrtc/video.html: Added. Canonical link: https://commits.webkit.org/184528@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-27 04:54:09 +00:00
{
if (options.observeOffer) {
const result = options.observeOffer(desc);
if (result)
desc = result;
}
Clean up RTCDataChannel https://bugs.webkit.org/show_bug.cgi?id=169732 LayoutTests/imported/w3c: Patch by Youenn Fablet <youenn@apple.com> on 2017-03-30 Reviewed by Chris Dumez. * web-platform-tests/webrtc/RTCDataChannelEvent-constructor-expected.txt: Source/JavaScriptCore: Patch by Youenn Fablet <youenn@apple.com> on 2017-03-30 Reviewed by Chris Dumez. * runtime/CommonIdentifiers.h: Adding RTCDataChannelEvent. Source/WebCore: Patch by Youenn Fablet <youenn@apple.com> and Jon Lee <jonlee@apple.com> on 2017-03-30 Reviewed by Chris Dumez. Test: webrtc/datachannel/datachannel-event.html webrtc/datachannel/bufferedAmountLowThreshold.html Making RTCDataChannel interface closer to the spec updating implementation accordingly. See https://w3c.github.io/webrtc-pc/#rtcdatachannel. In particular adding RTCDataChannelEvent constructor, and missing bufferedAmount related attributes. Doing some additional cleaning refactoring. Making bufferedAmountIsDecreasing take a bufferedAmount argument so that we get the actual value passed by libwebrtc without needing to get it from the libwebrtc network thread again. In the future, we should store the bufferedAmount value in RTCDataChannel and update its value on each libwebrtc OnBufferedAmountChange. Special treatment may be needed when the data channel is closed, in which case the bufferedAmount should just be updated to increase in the send method. Added some FIXMEs as RTCDataChannel is not aligned with the spec related to send and bufferedAmount. * Modules/mediastream/RTCDataChannel.cpp: (WebCore::RTCDataChannel::send): (WebCore::RTCDataChannel::close): (WebCore::RTCDataChannel::didChangeReadyState): (WebCore::RTCDataChannel::bufferedAmountIsDecreasing): * Modules/mediastream/RTCDataChannel.h: * Modules/mediastream/RTCDataChannel.idl: * Modules/mediastream/RTCDataChannelEvent.cpp: (WebCore::RTCDataChannelEvent::create): (WebCore::RTCDataChannelEvent::RTCDataChannelEvent): (WebCore::RTCDataChannelEvent::channel): * Modules/mediastream/RTCDataChannelEvent.h: * Modules/mediastream/RTCDataChannelEvent.idl: * Modules/mediastream/RTCPeerConnection.idl: * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp: (WebCore::LibWebRTCDataChannelHandler::OnStateChange): * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: (WebCore::LibWebRTCMediaEndpoint::addDataChannel): * WebCore.xcodeproj/project.pbxproj: * dom/EventNames.h: * platform/mediastream/RTCDataChannelHandler.h: * platform/mediastream/RTCDataChannelHandlerClient.h: * platform/mediastream/RTCDataChannelState.h: Added. * platform/mediastream/RTCPeerConnectionHandlerClient.h: * platform/mock/RTCDataChannelHandlerMock.cpp: (WebCore::RTCDataChannelHandlerMock::setClient): (WebCore::RTCDataChannelHandlerMock::close): * platform/mock/RTCNotifiersMock.cpp: (WebCore::IceConnectionNotifier::IceConnectionNotifier): (WebCore::SignalingStateNotifier::SignalingStateNotifier): (WebCore::DataChannelStateNotifier::DataChannelStateNotifier): * platform/mock/RTCNotifiersMock.h: LayoutTests: Patch by Youenn Fablet <youenn@apple.com> on 2017-03-30 Reviewed by Chris Dumez. * webrtc/datachannel/bufferedAmountLowThreshold-expected.txt: Added. * webrtc/datachannel/bufferedAmountLowThreshold.html: Added. Canonical link: https://commits.webkit.org/187223@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@214627 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-30 21:42:19 +00:00
[WebRTC] Add a LibWebRTC mock for testing https://bugs.webkit.org/show_bug.cgi?id=167429 Patch by Youenn Fablet <youennf@gmail.com> on 2017-01-26 Reviewed by Alex Christensen. Source/WebCore: Covered by updated tests although feature is behind a flag, off by default. MockLibWebRTCPeerConnection will allow us testing the code above the WebRTC implementation above LibWebRTC, without reyling on it and controlling the way that the peer connections will behave. Adding support for mock factory to create real peer connections in case where we want to do full testing through the local loopback. Tests: fast/mediastream/getUserMedia-webaudio.html webrtc/datachannel/basic.html webrtc/video.html * WebCore.xcodeproj/project.pbxproj: * testing/Internals.cpp: (WebCore::Internals::Internals): (WebCore::Internals::useMockRTCPeerConnectionFactory): * testing/Internals.h: * testing/Internals.idl: * testing/MockLibWebRTCPeerConnection.cpp: Added. (WebCore::useMockRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::MockLibWebRTCPeerConnectionForIceCandidates): (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::gotLocalDescription): (WebCore::MockLibWebRTCPeerConnectionForIceConnectionState::MockLibWebRTCPeerConnectionForIceConnectionState): (WebCore::MockLibWebRTCPeerConnectionForIceConnectionState::gotLocalDescription): (WebCore::MockLibWebRTCPeerConnectionFactory::MockLibWebRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionFactory::CreatePeerConnection): (WebCore::MockLibWebRTCPeerConnectionFactory::CreateLocalMediaStream): (WebCore::MockLibWebRTCPeerConnection::SetLocalDescription): (WebCore::MockLibWebRTCPeerConnection::SetRemoteDescription): (WebCore::MockLibWebRTCPeerConnection::CreateDataChannel): (WebCore::MockLibWebRTCPeerConnection::AddStream): (WebCore::MockLibWebRTCPeerConnection::RemoveStream): (WebCore::MockLibWebRTCPeerConnection::CreateOffer): (WebCore::MockLibWebRTCPeerConnection::CreateAnswer): * testing/MockLibWebRTCPeerConnection.h: Added. (WebCore::MockLibWebRTCPeerConnection::~MockLibWebRTCPeerConnection): (WebCore::MockLibWebRTCPeerConnection::MockLibWebRTCPeerConnection): (WebCore::MockLibWebRTCPeerConnection::local_streams): (WebCore::MockLibWebRTCPeerConnection::remote_streams): (WebCore::MockLibWebRTCPeerConnection::CreateDtmfSender): (WebCore::MockLibWebRTCPeerConnection::GetStats): (WebCore::MockLibWebRTCPeerConnection::local_description): (WebCore::MockLibWebRTCPeerConnection::remote_description): (WebCore::MockLibWebRTCPeerConnection::AddIceCandidate): (WebCore::MockLibWebRTCPeerConnection::RegisterUMAObserver): (WebCore::MockLibWebRTCPeerConnection::signaling_state): (WebCore::MockLibWebRTCPeerConnection::ice_connection_state): (WebCore::MockLibWebRTCPeerConnection::ice_gathering_state): (WebCore::MockLibWebRTCPeerConnection::StopRtcEventLog): (WebCore::MockLibWebRTCPeerConnection::Close): (WebCore::MockLibWebRTCPeerConnection::gotLocalDescription): (WebCore::MockLibWebRTCIceCandidate::MockLibWebRTCIceCandidate): (WebCore::MockLibWebRTCAudioTrack::MockLibWebRTCAudioTrack): (WebCore::MockLibWebRTCVideoTrack::MockLibWebRTCVideoTrack): (WebCore::MockLibWebRTCDataChannel::MockLibWebRTCDataChannel): (WebCore::MockLibWebRTCPeerConnectionFactory::create): LayoutTests: * TestExpectations: Marking webrtc new tests as skipped for the moment. * fast/mediastream/RTCPeerConnection-createAnswer.html: * fast/mediastream/RTCPeerConnection-icecandidate-event.html: * fast/mediastream/RTCPeerConnection-iceconnectionstatechange-event.html: * webrtc/datachannel/basic.html: Added. * webrtc/routines.js: Added. (createConnections): (closeConnections): (onCreateSessionDescriptionError): (gotDescription1): (gotDescription2): (iceCallback1): (iceCallback2): (onAddIceCandidateSuccess): (onAddIceCandidateError): * webrtc/video.html: Added. Canonical link: https://commits.webkit.org/184528@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-27 04:54:09 +00:00
localConnection.setLocalDescription(desc);
remoteConnection.setRemoteDescription(desc).then(() => {
remoteConnection.createAnswer().then((desc) => gotDescription2(desc, options), onCreateSessionDescriptionError);
});
[WebRTC] Add a LibWebRTC mock for testing https://bugs.webkit.org/show_bug.cgi?id=167429 Patch by Youenn Fablet <youennf@gmail.com> on 2017-01-26 Reviewed by Alex Christensen. Source/WebCore: Covered by updated tests although feature is behind a flag, off by default. MockLibWebRTCPeerConnection will allow us testing the code above the WebRTC implementation above LibWebRTC, without reyling on it and controlling the way that the peer connections will behave. Adding support for mock factory to create real peer connections in case where we want to do full testing through the local loopback. Tests: fast/mediastream/getUserMedia-webaudio.html webrtc/datachannel/basic.html webrtc/video.html * WebCore.xcodeproj/project.pbxproj: * testing/Internals.cpp: (WebCore::Internals::Internals): (WebCore::Internals::useMockRTCPeerConnectionFactory): * testing/Internals.h: * testing/Internals.idl: * testing/MockLibWebRTCPeerConnection.cpp: Added. (WebCore::useMockRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::MockLibWebRTCPeerConnectionForIceCandidates): (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::gotLocalDescription): (WebCore::MockLibWebRTCPeerConnectionForIceConnectionState::MockLibWebRTCPeerConnectionForIceConnectionState): (WebCore::MockLibWebRTCPeerConnectionForIceConnectionState::gotLocalDescription): (WebCore::MockLibWebRTCPeerConnectionFactory::MockLibWebRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionFactory::CreatePeerConnection): (WebCore::MockLibWebRTCPeerConnectionFactory::CreateLocalMediaStream): (WebCore::MockLibWebRTCPeerConnection::SetLocalDescription): (WebCore::MockLibWebRTCPeerConnection::SetRemoteDescription): (WebCore::MockLibWebRTCPeerConnection::CreateDataChannel): (WebCore::MockLibWebRTCPeerConnection::AddStream): (WebCore::MockLibWebRTCPeerConnection::RemoveStream): (WebCore::MockLibWebRTCPeerConnection::CreateOffer): (WebCore::MockLibWebRTCPeerConnection::CreateAnswer): * testing/MockLibWebRTCPeerConnection.h: Added. (WebCore::MockLibWebRTCPeerConnection::~MockLibWebRTCPeerConnection): (WebCore::MockLibWebRTCPeerConnection::MockLibWebRTCPeerConnection): (WebCore::MockLibWebRTCPeerConnection::local_streams): (WebCore::MockLibWebRTCPeerConnection::remote_streams): (WebCore::MockLibWebRTCPeerConnection::CreateDtmfSender): (WebCore::MockLibWebRTCPeerConnection::GetStats): (WebCore::MockLibWebRTCPeerConnection::local_description): (WebCore::MockLibWebRTCPeerConnection::remote_description): (WebCore::MockLibWebRTCPeerConnection::AddIceCandidate): (WebCore::MockLibWebRTCPeerConnection::RegisterUMAObserver): (WebCore::MockLibWebRTCPeerConnection::signaling_state): (WebCore::MockLibWebRTCPeerConnection::ice_connection_state): (WebCore::MockLibWebRTCPeerConnection::ice_gathering_state): (WebCore::MockLibWebRTCPeerConnection::StopRtcEventLog): (WebCore::MockLibWebRTCPeerConnection::Close): (WebCore::MockLibWebRTCPeerConnection::gotLocalDescription): (WebCore::MockLibWebRTCIceCandidate::MockLibWebRTCIceCandidate): (WebCore::MockLibWebRTCAudioTrack::MockLibWebRTCAudioTrack): (WebCore::MockLibWebRTCVideoTrack::MockLibWebRTCVideoTrack): (WebCore::MockLibWebRTCDataChannel::MockLibWebRTCDataChannel): (WebCore::MockLibWebRTCPeerConnectionFactory::create): LayoutTests: * TestExpectations: Marking webrtc new tests as skipped for the moment. * fast/mediastream/RTCPeerConnection-createAnswer.html: * fast/mediastream/RTCPeerConnection-icecandidate-event.html: * fast/mediastream/RTCPeerConnection-iceconnectionstatechange-event.html: * webrtc/datachannel/basic.html: Added. * webrtc/routines.js: Added. (createConnections): (closeConnections): (onCreateSessionDescriptionError): (gotDescription1): (gotDescription2): (iceCallback1): (iceCallback2): (onAddIceCandidateSuccess): (onAddIceCandidateError): * webrtc/video.html: Added. Canonical link: https://commits.webkit.org/184528@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-27 04:54:09 +00:00
}
Clean up RTCDataChannel https://bugs.webkit.org/show_bug.cgi?id=169732 LayoutTests/imported/w3c: Patch by Youenn Fablet <youenn@apple.com> on 2017-03-30 Reviewed by Chris Dumez. * web-platform-tests/webrtc/RTCDataChannelEvent-constructor-expected.txt: Source/JavaScriptCore: Patch by Youenn Fablet <youenn@apple.com> on 2017-03-30 Reviewed by Chris Dumez. * runtime/CommonIdentifiers.h: Adding RTCDataChannelEvent. Source/WebCore: Patch by Youenn Fablet <youenn@apple.com> and Jon Lee <jonlee@apple.com> on 2017-03-30 Reviewed by Chris Dumez. Test: webrtc/datachannel/datachannel-event.html webrtc/datachannel/bufferedAmountLowThreshold.html Making RTCDataChannel interface closer to the spec updating implementation accordingly. See https://w3c.github.io/webrtc-pc/#rtcdatachannel. In particular adding RTCDataChannelEvent constructor, and missing bufferedAmount related attributes. Doing some additional cleaning refactoring. Making bufferedAmountIsDecreasing take a bufferedAmount argument so that we get the actual value passed by libwebrtc without needing to get it from the libwebrtc network thread again. In the future, we should store the bufferedAmount value in RTCDataChannel and update its value on each libwebrtc OnBufferedAmountChange. Special treatment may be needed when the data channel is closed, in which case the bufferedAmount should just be updated to increase in the send method. Added some FIXMEs as RTCDataChannel is not aligned with the spec related to send and bufferedAmount. * Modules/mediastream/RTCDataChannel.cpp: (WebCore::RTCDataChannel::send): (WebCore::RTCDataChannel::close): (WebCore::RTCDataChannel::didChangeReadyState): (WebCore::RTCDataChannel::bufferedAmountIsDecreasing): * Modules/mediastream/RTCDataChannel.h: * Modules/mediastream/RTCDataChannel.idl: * Modules/mediastream/RTCDataChannelEvent.cpp: (WebCore::RTCDataChannelEvent::create): (WebCore::RTCDataChannelEvent::RTCDataChannelEvent): (WebCore::RTCDataChannelEvent::channel): * Modules/mediastream/RTCDataChannelEvent.h: * Modules/mediastream/RTCDataChannelEvent.idl: * Modules/mediastream/RTCPeerConnection.idl: * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp: (WebCore::LibWebRTCDataChannelHandler::OnStateChange): * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: (WebCore::LibWebRTCMediaEndpoint::addDataChannel): * WebCore.xcodeproj/project.pbxproj: * dom/EventNames.h: * platform/mediastream/RTCDataChannelHandler.h: * platform/mediastream/RTCDataChannelHandlerClient.h: * platform/mediastream/RTCDataChannelState.h: Added. * platform/mediastream/RTCPeerConnectionHandlerClient.h: * platform/mock/RTCDataChannelHandlerMock.cpp: (WebCore::RTCDataChannelHandlerMock::setClient): (WebCore::RTCDataChannelHandlerMock::close): * platform/mock/RTCNotifiersMock.cpp: (WebCore::IceConnectionNotifier::IceConnectionNotifier): (WebCore::SignalingStateNotifier::SignalingStateNotifier): (WebCore::DataChannelStateNotifier::DataChannelStateNotifier): * platform/mock/RTCNotifiersMock.h: LayoutTests: Patch by Youenn Fablet <youenn@apple.com> on 2017-03-30 Reviewed by Chris Dumez. * webrtc/datachannel/bufferedAmountLowThreshold-expected.txt: Added. * webrtc/datachannel/bufferedAmountLowThreshold.html: Added. Canonical link: https://commits.webkit.org/187223@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@214627 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-30 21:42:19 +00:00
function gotDescription2(desc, options)
[WebRTC] Add a LibWebRTC mock for testing https://bugs.webkit.org/show_bug.cgi?id=167429 Patch by Youenn Fablet <youennf@gmail.com> on 2017-01-26 Reviewed by Alex Christensen. Source/WebCore: Covered by updated tests although feature is behind a flag, off by default. MockLibWebRTCPeerConnection will allow us testing the code above the WebRTC implementation above LibWebRTC, without reyling on it and controlling the way that the peer connections will behave. Adding support for mock factory to create real peer connections in case where we want to do full testing through the local loopback. Tests: fast/mediastream/getUserMedia-webaudio.html webrtc/datachannel/basic.html webrtc/video.html * WebCore.xcodeproj/project.pbxproj: * testing/Internals.cpp: (WebCore::Internals::Internals): (WebCore::Internals::useMockRTCPeerConnectionFactory): * testing/Internals.h: * testing/Internals.idl: * testing/MockLibWebRTCPeerConnection.cpp: Added. (WebCore::useMockRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::MockLibWebRTCPeerConnectionForIceCandidates): (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::gotLocalDescription): (WebCore::MockLibWebRTCPeerConnectionForIceConnectionState::MockLibWebRTCPeerConnectionForIceConnectionState): (WebCore::MockLibWebRTCPeerConnectionForIceConnectionState::gotLocalDescription): (WebCore::MockLibWebRTCPeerConnectionFactory::MockLibWebRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionFactory::CreatePeerConnection): (WebCore::MockLibWebRTCPeerConnectionFactory::CreateLocalMediaStream): (WebCore::MockLibWebRTCPeerConnection::SetLocalDescription): (WebCore::MockLibWebRTCPeerConnection::SetRemoteDescription): (WebCore::MockLibWebRTCPeerConnection::CreateDataChannel): (WebCore::MockLibWebRTCPeerConnection::AddStream): (WebCore::MockLibWebRTCPeerConnection::RemoveStream): (WebCore::MockLibWebRTCPeerConnection::CreateOffer): (WebCore::MockLibWebRTCPeerConnection::CreateAnswer): * testing/MockLibWebRTCPeerConnection.h: Added. (WebCore::MockLibWebRTCPeerConnection::~MockLibWebRTCPeerConnection): (WebCore::MockLibWebRTCPeerConnection::MockLibWebRTCPeerConnection): (WebCore::MockLibWebRTCPeerConnection::local_streams): (WebCore::MockLibWebRTCPeerConnection::remote_streams): (WebCore::MockLibWebRTCPeerConnection::CreateDtmfSender): (WebCore::MockLibWebRTCPeerConnection::GetStats): (WebCore::MockLibWebRTCPeerConnection::local_description): (WebCore::MockLibWebRTCPeerConnection::remote_description): (WebCore::MockLibWebRTCPeerConnection::AddIceCandidate): (WebCore::MockLibWebRTCPeerConnection::RegisterUMAObserver): (WebCore::MockLibWebRTCPeerConnection::signaling_state): (WebCore::MockLibWebRTCPeerConnection::ice_connection_state): (WebCore::MockLibWebRTCPeerConnection::ice_gathering_state): (WebCore::MockLibWebRTCPeerConnection::StopRtcEventLog): (WebCore::MockLibWebRTCPeerConnection::Close): (WebCore::MockLibWebRTCPeerConnection::gotLocalDescription): (WebCore::MockLibWebRTCIceCandidate::MockLibWebRTCIceCandidate): (WebCore::MockLibWebRTCAudioTrack::MockLibWebRTCAudioTrack): (WebCore::MockLibWebRTCVideoTrack::MockLibWebRTCVideoTrack): (WebCore::MockLibWebRTCDataChannel::MockLibWebRTCDataChannel): (WebCore::MockLibWebRTCPeerConnectionFactory::create): LayoutTests: * TestExpectations: Marking webrtc new tests as skipped for the moment. * fast/mediastream/RTCPeerConnection-createAnswer.html: * fast/mediastream/RTCPeerConnection-icecandidate-event.html: * fast/mediastream/RTCPeerConnection-iceconnectionstatechange-event.html: * webrtc/datachannel/basic.html: Added. * webrtc/routines.js: Added. (createConnections): (closeConnections): (onCreateSessionDescriptionError): (gotDescription1): (gotDescription2): (iceCallback1): (iceCallback2): (onAddIceCandidateSuccess): (onAddIceCandidateError): * webrtc/video.html: Added. Canonical link: https://commits.webkit.org/184528@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-27 04:54:09 +00:00
{
Clean up RTCDataChannel https://bugs.webkit.org/show_bug.cgi?id=169732 LayoutTests/imported/w3c: Patch by Youenn Fablet <youenn@apple.com> on 2017-03-30 Reviewed by Chris Dumez. * web-platform-tests/webrtc/RTCDataChannelEvent-constructor-expected.txt: Source/JavaScriptCore: Patch by Youenn Fablet <youenn@apple.com> on 2017-03-30 Reviewed by Chris Dumez. * runtime/CommonIdentifiers.h: Adding RTCDataChannelEvent. Source/WebCore: Patch by Youenn Fablet <youenn@apple.com> and Jon Lee <jonlee@apple.com> on 2017-03-30 Reviewed by Chris Dumez. Test: webrtc/datachannel/datachannel-event.html webrtc/datachannel/bufferedAmountLowThreshold.html Making RTCDataChannel interface closer to the spec updating implementation accordingly. See https://w3c.github.io/webrtc-pc/#rtcdatachannel. In particular adding RTCDataChannelEvent constructor, and missing bufferedAmount related attributes. Doing some additional cleaning refactoring. Making bufferedAmountIsDecreasing take a bufferedAmount argument so that we get the actual value passed by libwebrtc without needing to get it from the libwebrtc network thread again. In the future, we should store the bufferedAmount value in RTCDataChannel and update its value on each libwebrtc OnBufferedAmountChange. Special treatment may be needed when the data channel is closed, in which case the bufferedAmount should just be updated to increase in the send method. Added some FIXMEs as RTCDataChannel is not aligned with the spec related to send and bufferedAmount. * Modules/mediastream/RTCDataChannel.cpp: (WebCore::RTCDataChannel::send): (WebCore::RTCDataChannel::close): (WebCore::RTCDataChannel::didChangeReadyState): (WebCore::RTCDataChannel::bufferedAmountIsDecreasing): * Modules/mediastream/RTCDataChannel.h: * Modules/mediastream/RTCDataChannel.idl: * Modules/mediastream/RTCDataChannelEvent.cpp: (WebCore::RTCDataChannelEvent::create): (WebCore::RTCDataChannelEvent::RTCDataChannelEvent): (WebCore::RTCDataChannelEvent::channel): * Modules/mediastream/RTCDataChannelEvent.h: * Modules/mediastream/RTCDataChannelEvent.idl: * Modules/mediastream/RTCPeerConnection.idl: * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp: (WebCore::LibWebRTCDataChannelHandler::OnStateChange): * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: (WebCore::LibWebRTCMediaEndpoint::addDataChannel): * WebCore.xcodeproj/project.pbxproj: * dom/EventNames.h: * platform/mediastream/RTCDataChannelHandler.h: * platform/mediastream/RTCDataChannelHandlerClient.h: * platform/mediastream/RTCDataChannelState.h: Added. * platform/mediastream/RTCPeerConnectionHandlerClient.h: * platform/mock/RTCDataChannelHandlerMock.cpp: (WebCore::RTCDataChannelHandlerMock::setClient): (WebCore::RTCDataChannelHandlerMock::close): * platform/mock/RTCNotifiersMock.cpp: (WebCore::IceConnectionNotifier::IceConnectionNotifier): (WebCore::SignalingStateNotifier::SignalingStateNotifier): (WebCore::DataChannelStateNotifier::DataChannelStateNotifier): * platform/mock/RTCNotifiersMock.h: LayoutTests: Patch by Youenn Fablet <youenn@apple.com> on 2017-03-30 Reviewed by Chris Dumez. * webrtc/datachannel/bufferedAmountLowThreshold-expected.txt: Added. * webrtc/datachannel/bufferedAmountLowThreshold.html: Added. Canonical link: https://commits.webkit.org/187223@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@214627 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-30 21:42:19 +00:00
if (options.observeAnswer)
options.observeAnswer(desc);
[WebRTC] Add a LibWebRTC mock for testing https://bugs.webkit.org/show_bug.cgi?id=167429 Patch by Youenn Fablet <youennf@gmail.com> on 2017-01-26 Reviewed by Alex Christensen. Source/WebCore: Covered by updated tests although feature is behind a flag, off by default. MockLibWebRTCPeerConnection will allow us testing the code above the WebRTC implementation above LibWebRTC, without reyling on it and controlling the way that the peer connections will behave. Adding support for mock factory to create real peer connections in case where we want to do full testing through the local loopback. Tests: fast/mediastream/getUserMedia-webaudio.html webrtc/datachannel/basic.html webrtc/video.html * WebCore.xcodeproj/project.pbxproj: * testing/Internals.cpp: (WebCore::Internals::Internals): (WebCore::Internals::useMockRTCPeerConnectionFactory): * testing/Internals.h: * testing/Internals.idl: * testing/MockLibWebRTCPeerConnection.cpp: Added. (WebCore::useMockRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::MockLibWebRTCPeerConnectionForIceCandidates): (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::gotLocalDescription): (WebCore::MockLibWebRTCPeerConnectionForIceConnectionState::MockLibWebRTCPeerConnectionForIceConnectionState): (WebCore::MockLibWebRTCPeerConnectionForIceConnectionState::gotLocalDescription): (WebCore::MockLibWebRTCPeerConnectionFactory::MockLibWebRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionFactory::CreatePeerConnection): (WebCore::MockLibWebRTCPeerConnectionFactory::CreateLocalMediaStream): (WebCore::MockLibWebRTCPeerConnection::SetLocalDescription): (WebCore::MockLibWebRTCPeerConnection::SetRemoteDescription): (WebCore::MockLibWebRTCPeerConnection::CreateDataChannel): (WebCore::MockLibWebRTCPeerConnection::AddStream): (WebCore::MockLibWebRTCPeerConnection::RemoveStream): (WebCore::MockLibWebRTCPeerConnection::CreateOffer): (WebCore::MockLibWebRTCPeerConnection::CreateAnswer): * testing/MockLibWebRTCPeerConnection.h: Added. (WebCore::MockLibWebRTCPeerConnection::~MockLibWebRTCPeerConnection): (WebCore::MockLibWebRTCPeerConnection::MockLibWebRTCPeerConnection): (WebCore::MockLibWebRTCPeerConnection::local_streams): (WebCore::MockLibWebRTCPeerConnection::remote_streams): (WebCore::MockLibWebRTCPeerConnection::CreateDtmfSender): (WebCore::MockLibWebRTCPeerConnection::GetStats): (WebCore::MockLibWebRTCPeerConnection::local_description): (WebCore::MockLibWebRTCPeerConnection::remote_description): (WebCore::MockLibWebRTCPeerConnection::AddIceCandidate): (WebCore::MockLibWebRTCPeerConnection::RegisterUMAObserver): (WebCore::MockLibWebRTCPeerConnection::signaling_state): (WebCore::MockLibWebRTCPeerConnection::ice_connection_state): (WebCore::MockLibWebRTCPeerConnection::ice_gathering_state): (WebCore::MockLibWebRTCPeerConnection::StopRtcEventLog): (WebCore::MockLibWebRTCPeerConnection::Close): (WebCore::MockLibWebRTCPeerConnection::gotLocalDescription): (WebCore::MockLibWebRTCIceCandidate::MockLibWebRTCIceCandidate): (WebCore::MockLibWebRTCAudioTrack::MockLibWebRTCAudioTrack): (WebCore::MockLibWebRTCVideoTrack::MockLibWebRTCVideoTrack): (WebCore::MockLibWebRTCDataChannel::MockLibWebRTCDataChannel): (WebCore::MockLibWebRTCPeerConnectionFactory::create): LayoutTests: * TestExpectations: Marking webrtc new tests as skipped for the moment. * fast/mediastream/RTCPeerConnection-createAnswer.html: * fast/mediastream/RTCPeerConnection-icecandidate-event.html: * fast/mediastream/RTCPeerConnection-iceconnectionstatechange-event.html: * webrtc/datachannel/basic.html: Added. * webrtc/routines.js: Added. (createConnections): (closeConnections): (onCreateSessionDescriptionError): (gotDescription1): (gotDescription2): (iceCallback1): (iceCallback2): (onAddIceCandidateSuccess): (onAddIceCandidateError): * webrtc/video.html: Added. Canonical link: https://commits.webkit.org/184528@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-27 04:54:09 +00:00
remoteConnection.setLocalDescription(desc);
localConnection.setRemoteDescription(desc);
}
[WebRTC] Add support for libwebrtc TCP incoming connections https://bugs.webkit.org/show_bug.cgi?id=168748 Patch by Youenn Fablet <youenn@apple.com> on 2017-02-27 Reviewed by Alex Christensen. Source/WebKit2: Covered by added layout tests. When a libwebrtc server socket is signalling a new connnection through SignalNewConnection, we do: - Wrap the incoming socket into a LibWebRTCSocketClient - Store it into a pending socket map with an identifier - Send a message to the web process of a new connection with the server socket identifier and new connection socket identifier. The Web process then creates a WebRTCSocket wrapper around it by sendinig a WrapNewTCPConnection message. It then propagates the SignalNewConnection to libwebrtc code path. * NetworkProcess/webrtc/LibWebRTCSocketClient.cpp: (WebKit::LibWebRTCSocketClient::LibWebRTCSocketClient): (WebKit::LibWebRTCSocketClient::signalReadPacket): (WebKit::LibWebRTCSocketClient::signalSentPacket): (WebKit::LibWebRTCSocketClient::signalNewConnection): (WebKit::LibWebRTCSocketClient::signalAddressReady): (WebKit::LibWebRTCSocketClient::signalConnect): (WebKit::LibWebRTCSocketClient::signalClose): * NetworkProcess/webrtc/LibWebRTCSocketClient.h: * NetworkProcess/webrtc/NetworkRTCProvider.cpp: (WebKit::NetworkRTCProvider::wrapNewTCPConnection): (WebKit::NetworkRTCProvider::newConnection): * NetworkProcess/webrtc/NetworkRTCProvider.h: * NetworkProcess/webrtc/NetworkRTCProvider.messages.in: * WebProcess/Network/webrtc/LibWebRTCSocket.cpp: (WebKit::LibWebRTCSocket::signalNewConnection): * WebProcess/Network/webrtc/LibWebRTCSocket.h: * WebProcess/Network/webrtc/LibWebRTCSocketFactory.cpp: (WebKit::LibWebRTCSocketFactory::createNewConnectionSocket): * WebProcess/Network/webrtc/LibWebRTCSocketFactory.h: * WebProcess/Network/webrtc/WebRTCSocket.cpp: (WebKit::WebRTCSocket::signalNewConnection): * WebProcess/Network/webrtc/WebRTCSocket.h: * WebProcess/Network/webrtc/WebRTCSocket.messages.in: LayoutTests: * webrtc/datachannel/basic-expected.txt: Added. * webrtc/datachannel/basic.html: * webrtc/routines.js: (createConnections): (iceCallback1): (iceCallback2): Canonical link: https://commits.webkit.org/185936@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213104 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-28 01:10:39 +00:00
function iceCallback1(event, filterOutICECandidate)
[WebRTC] Add a LibWebRTC mock for testing https://bugs.webkit.org/show_bug.cgi?id=167429 Patch by Youenn Fablet <youennf@gmail.com> on 2017-01-26 Reviewed by Alex Christensen. Source/WebCore: Covered by updated tests although feature is behind a flag, off by default. MockLibWebRTCPeerConnection will allow us testing the code above the WebRTC implementation above LibWebRTC, without reyling on it and controlling the way that the peer connections will behave. Adding support for mock factory to create real peer connections in case where we want to do full testing through the local loopback. Tests: fast/mediastream/getUserMedia-webaudio.html webrtc/datachannel/basic.html webrtc/video.html * WebCore.xcodeproj/project.pbxproj: * testing/Internals.cpp: (WebCore::Internals::Internals): (WebCore::Internals::useMockRTCPeerConnectionFactory): * testing/Internals.h: * testing/Internals.idl: * testing/MockLibWebRTCPeerConnection.cpp: Added. (WebCore::useMockRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::MockLibWebRTCPeerConnectionForIceCandidates): (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::gotLocalDescription): (WebCore::MockLibWebRTCPeerConnectionForIceConnectionState::MockLibWebRTCPeerConnectionForIceConnectionState): (WebCore::MockLibWebRTCPeerConnectionForIceConnectionState::gotLocalDescription): (WebCore::MockLibWebRTCPeerConnectionFactory::MockLibWebRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionFactory::CreatePeerConnection): (WebCore::MockLibWebRTCPeerConnectionFactory::CreateLocalMediaStream): (WebCore::MockLibWebRTCPeerConnection::SetLocalDescription): (WebCore::MockLibWebRTCPeerConnection::SetRemoteDescription): (WebCore::MockLibWebRTCPeerConnection::CreateDataChannel): (WebCore::MockLibWebRTCPeerConnection::AddStream): (WebCore::MockLibWebRTCPeerConnection::RemoveStream): (WebCore::MockLibWebRTCPeerConnection::CreateOffer): (WebCore::MockLibWebRTCPeerConnection::CreateAnswer): * testing/MockLibWebRTCPeerConnection.h: Added. (WebCore::MockLibWebRTCPeerConnection::~MockLibWebRTCPeerConnection): (WebCore::MockLibWebRTCPeerConnection::MockLibWebRTCPeerConnection): (WebCore::MockLibWebRTCPeerConnection::local_streams): (WebCore::MockLibWebRTCPeerConnection::remote_streams): (WebCore::MockLibWebRTCPeerConnection::CreateDtmfSender): (WebCore::MockLibWebRTCPeerConnection::GetStats): (WebCore::MockLibWebRTCPeerConnection::local_description): (WebCore::MockLibWebRTCPeerConnection::remote_description): (WebCore::MockLibWebRTCPeerConnection::AddIceCandidate): (WebCore::MockLibWebRTCPeerConnection::RegisterUMAObserver): (WebCore::MockLibWebRTCPeerConnection::signaling_state): (WebCore::MockLibWebRTCPeerConnection::ice_connection_state): (WebCore::MockLibWebRTCPeerConnection::ice_gathering_state): (WebCore::MockLibWebRTCPeerConnection::StopRtcEventLog): (WebCore::MockLibWebRTCPeerConnection::Close): (WebCore::MockLibWebRTCPeerConnection::gotLocalDescription): (WebCore::MockLibWebRTCIceCandidate::MockLibWebRTCIceCandidate): (WebCore::MockLibWebRTCAudioTrack::MockLibWebRTCAudioTrack): (WebCore::MockLibWebRTCVideoTrack::MockLibWebRTCVideoTrack): (WebCore::MockLibWebRTCDataChannel::MockLibWebRTCDataChannel): (WebCore::MockLibWebRTCPeerConnectionFactory::create): LayoutTests: * TestExpectations: Marking webrtc new tests as skipped for the moment. * fast/mediastream/RTCPeerConnection-createAnswer.html: * fast/mediastream/RTCPeerConnection-icecandidate-event.html: * fast/mediastream/RTCPeerConnection-iceconnectionstatechange-event.html: * webrtc/datachannel/basic.html: Added. * webrtc/routines.js: Added. (createConnections): (closeConnections): (onCreateSessionDescriptionError): (gotDescription1): (gotDescription2): (iceCallback1): (iceCallback2): (onAddIceCandidateSuccess): (onAddIceCandidateError): * webrtc/video.html: Added. Canonical link: https://commits.webkit.org/184528@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-27 04:54:09 +00:00
{
[WebRTC] Add support for libwebrtc TCP incoming connections https://bugs.webkit.org/show_bug.cgi?id=168748 Patch by Youenn Fablet <youenn@apple.com> on 2017-02-27 Reviewed by Alex Christensen. Source/WebKit2: Covered by added layout tests. When a libwebrtc server socket is signalling a new connnection through SignalNewConnection, we do: - Wrap the incoming socket into a LibWebRTCSocketClient - Store it into a pending socket map with an identifier - Send a message to the web process of a new connection with the server socket identifier and new connection socket identifier. The Web process then creates a WebRTCSocket wrapper around it by sendinig a WrapNewTCPConnection message. It then propagates the SignalNewConnection to libwebrtc code path. * NetworkProcess/webrtc/LibWebRTCSocketClient.cpp: (WebKit::LibWebRTCSocketClient::LibWebRTCSocketClient): (WebKit::LibWebRTCSocketClient::signalReadPacket): (WebKit::LibWebRTCSocketClient::signalSentPacket): (WebKit::LibWebRTCSocketClient::signalNewConnection): (WebKit::LibWebRTCSocketClient::signalAddressReady): (WebKit::LibWebRTCSocketClient::signalConnect): (WebKit::LibWebRTCSocketClient::signalClose): * NetworkProcess/webrtc/LibWebRTCSocketClient.h: * NetworkProcess/webrtc/NetworkRTCProvider.cpp: (WebKit::NetworkRTCProvider::wrapNewTCPConnection): (WebKit::NetworkRTCProvider::newConnection): * NetworkProcess/webrtc/NetworkRTCProvider.h: * NetworkProcess/webrtc/NetworkRTCProvider.messages.in: * WebProcess/Network/webrtc/LibWebRTCSocket.cpp: (WebKit::LibWebRTCSocket::signalNewConnection): * WebProcess/Network/webrtc/LibWebRTCSocket.h: * WebProcess/Network/webrtc/LibWebRTCSocketFactory.cpp: (WebKit::LibWebRTCSocketFactory::createNewConnectionSocket): * WebProcess/Network/webrtc/LibWebRTCSocketFactory.h: * WebProcess/Network/webrtc/WebRTCSocket.cpp: (WebKit::WebRTCSocket::signalNewConnection): * WebProcess/Network/webrtc/WebRTCSocket.h: * WebProcess/Network/webrtc/WebRTCSocket.messages.in: LayoutTests: * webrtc/datachannel/basic-expected.txt: Added. * webrtc/datachannel/basic.html: * webrtc/routines.js: (createConnections): (iceCallback1): (iceCallback2): Canonical link: https://commits.webkit.org/185936@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213104 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-28 01:10:39 +00:00
if (filterOutICECandidate && filterOutICECandidate(event.candidate))
return;
remoteConnection.addIceCandidate(event.candidate).then(onAddIceCandidateSuccess, onAddIceCandidateError);
[WebRTC] Add a LibWebRTC mock for testing https://bugs.webkit.org/show_bug.cgi?id=167429 Patch by Youenn Fablet <youennf@gmail.com> on 2017-01-26 Reviewed by Alex Christensen. Source/WebCore: Covered by updated tests although feature is behind a flag, off by default. MockLibWebRTCPeerConnection will allow us testing the code above the WebRTC implementation above LibWebRTC, without reyling on it and controlling the way that the peer connections will behave. Adding support for mock factory to create real peer connections in case where we want to do full testing through the local loopback. Tests: fast/mediastream/getUserMedia-webaudio.html webrtc/datachannel/basic.html webrtc/video.html * WebCore.xcodeproj/project.pbxproj: * testing/Internals.cpp: (WebCore::Internals::Internals): (WebCore::Internals::useMockRTCPeerConnectionFactory): * testing/Internals.h: * testing/Internals.idl: * testing/MockLibWebRTCPeerConnection.cpp: Added. (WebCore::useMockRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::MockLibWebRTCPeerConnectionForIceCandidates): (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::gotLocalDescription): (WebCore::MockLibWebRTCPeerConnectionForIceConnectionState::MockLibWebRTCPeerConnectionForIceConnectionState): (WebCore::MockLibWebRTCPeerConnectionForIceConnectionState::gotLocalDescription): (WebCore::MockLibWebRTCPeerConnectionFactory::MockLibWebRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionFactory::CreatePeerConnection): (WebCore::MockLibWebRTCPeerConnectionFactory::CreateLocalMediaStream): (WebCore::MockLibWebRTCPeerConnection::SetLocalDescription): (WebCore::MockLibWebRTCPeerConnection::SetRemoteDescription): (WebCore::MockLibWebRTCPeerConnection::CreateDataChannel): (WebCore::MockLibWebRTCPeerConnection::AddStream): (WebCore::MockLibWebRTCPeerConnection::RemoveStream): (WebCore::MockLibWebRTCPeerConnection::CreateOffer): (WebCore::MockLibWebRTCPeerConnection::CreateAnswer): * testing/MockLibWebRTCPeerConnection.h: Added. (WebCore::MockLibWebRTCPeerConnection::~MockLibWebRTCPeerConnection): (WebCore::MockLibWebRTCPeerConnection::MockLibWebRTCPeerConnection): (WebCore::MockLibWebRTCPeerConnection::local_streams): (WebCore::MockLibWebRTCPeerConnection::remote_streams): (WebCore::MockLibWebRTCPeerConnection::CreateDtmfSender): (WebCore::MockLibWebRTCPeerConnection::GetStats): (WebCore::MockLibWebRTCPeerConnection::local_description): (WebCore::MockLibWebRTCPeerConnection::remote_description): (WebCore::MockLibWebRTCPeerConnection::AddIceCandidate): (WebCore::MockLibWebRTCPeerConnection::RegisterUMAObserver): (WebCore::MockLibWebRTCPeerConnection::signaling_state): (WebCore::MockLibWebRTCPeerConnection::ice_connection_state): (WebCore::MockLibWebRTCPeerConnection::ice_gathering_state): (WebCore::MockLibWebRTCPeerConnection::StopRtcEventLog): (WebCore::MockLibWebRTCPeerConnection::Close): (WebCore::MockLibWebRTCPeerConnection::gotLocalDescription): (WebCore::MockLibWebRTCIceCandidate::MockLibWebRTCIceCandidate): (WebCore::MockLibWebRTCAudioTrack::MockLibWebRTCAudioTrack): (WebCore::MockLibWebRTCVideoTrack::MockLibWebRTCVideoTrack): (WebCore::MockLibWebRTCDataChannel::MockLibWebRTCDataChannel): (WebCore::MockLibWebRTCPeerConnectionFactory::create): LayoutTests: * TestExpectations: Marking webrtc new tests as skipped for the moment. * fast/mediastream/RTCPeerConnection-createAnswer.html: * fast/mediastream/RTCPeerConnection-icecandidate-event.html: * fast/mediastream/RTCPeerConnection-iceconnectionstatechange-event.html: * webrtc/datachannel/basic.html: Added. * webrtc/routines.js: Added. (createConnections): (closeConnections): (onCreateSessionDescriptionError): (gotDescription1): (gotDescription2): (iceCallback1): (iceCallback2): (onAddIceCandidateSuccess): (onAddIceCandidateError): * webrtc/video.html: Added. Canonical link: https://commits.webkit.org/184528@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-27 04:54:09 +00:00
}
[WebRTC] Add support for libwebrtc TCP incoming connections https://bugs.webkit.org/show_bug.cgi?id=168748 Patch by Youenn Fablet <youenn@apple.com> on 2017-02-27 Reviewed by Alex Christensen. Source/WebKit2: Covered by added layout tests. When a libwebrtc server socket is signalling a new connnection through SignalNewConnection, we do: - Wrap the incoming socket into a LibWebRTCSocketClient - Store it into a pending socket map with an identifier - Send a message to the web process of a new connection with the server socket identifier and new connection socket identifier. The Web process then creates a WebRTCSocket wrapper around it by sendinig a WrapNewTCPConnection message. It then propagates the SignalNewConnection to libwebrtc code path. * NetworkProcess/webrtc/LibWebRTCSocketClient.cpp: (WebKit::LibWebRTCSocketClient::LibWebRTCSocketClient): (WebKit::LibWebRTCSocketClient::signalReadPacket): (WebKit::LibWebRTCSocketClient::signalSentPacket): (WebKit::LibWebRTCSocketClient::signalNewConnection): (WebKit::LibWebRTCSocketClient::signalAddressReady): (WebKit::LibWebRTCSocketClient::signalConnect): (WebKit::LibWebRTCSocketClient::signalClose): * NetworkProcess/webrtc/LibWebRTCSocketClient.h: * NetworkProcess/webrtc/NetworkRTCProvider.cpp: (WebKit::NetworkRTCProvider::wrapNewTCPConnection): (WebKit::NetworkRTCProvider::newConnection): * NetworkProcess/webrtc/NetworkRTCProvider.h: * NetworkProcess/webrtc/NetworkRTCProvider.messages.in: * WebProcess/Network/webrtc/LibWebRTCSocket.cpp: (WebKit::LibWebRTCSocket::signalNewConnection): * WebProcess/Network/webrtc/LibWebRTCSocket.h: * WebProcess/Network/webrtc/LibWebRTCSocketFactory.cpp: (WebKit::LibWebRTCSocketFactory::createNewConnectionSocket): * WebProcess/Network/webrtc/LibWebRTCSocketFactory.h: * WebProcess/Network/webrtc/WebRTCSocket.cpp: (WebKit::WebRTCSocket::signalNewConnection): * WebProcess/Network/webrtc/WebRTCSocket.h: * WebProcess/Network/webrtc/WebRTCSocket.messages.in: LayoutTests: * webrtc/datachannel/basic-expected.txt: Added. * webrtc/datachannel/basic.html: * webrtc/routines.js: (createConnections): (iceCallback1): (iceCallback2): Canonical link: https://commits.webkit.org/185936@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213104 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-28 01:10:39 +00:00
function iceCallback2(event, filterOutICECandidate)
[WebRTC] Add a LibWebRTC mock for testing https://bugs.webkit.org/show_bug.cgi?id=167429 Patch by Youenn Fablet <youennf@gmail.com> on 2017-01-26 Reviewed by Alex Christensen. Source/WebCore: Covered by updated tests although feature is behind a flag, off by default. MockLibWebRTCPeerConnection will allow us testing the code above the WebRTC implementation above LibWebRTC, without reyling on it and controlling the way that the peer connections will behave. Adding support for mock factory to create real peer connections in case where we want to do full testing through the local loopback. Tests: fast/mediastream/getUserMedia-webaudio.html webrtc/datachannel/basic.html webrtc/video.html * WebCore.xcodeproj/project.pbxproj: * testing/Internals.cpp: (WebCore::Internals::Internals): (WebCore::Internals::useMockRTCPeerConnectionFactory): * testing/Internals.h: * testing/Internals.idl: * testing/MockLibWebRTCPeerConnection.cpp: Added. (WebCore::useMockRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::MockLibWebRTCPeerConnectionForIceCandidates): (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::gotLocalDescription): (WebCore::MockLibWebRTCPeerConnectionForIceConnectionState::MockLibWebRTCPeerConnectionForIceConnectionState): (WebCore::MockLibWebRTCPeerConnectionForIceConnectionState::gotLocalDescription): (WebCore::MockLibWebRTCPeerConnectionFactory::MockLibWebRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionFactory::CreatePeerConnection): (WebCore::MockLibWebRTCPeerConnectionFactory::CreateLocalMediaStream): (WebCore::MockLibWebRTCPeerConnection::SetLocalDescription): (WebCore::MockLibWebRTCPeerConnection::SetRemoteDescription): (WebCore::MockLibWebRTCPeerConnection::CreateDataChannel): (WebCore::MockLibWebRTCPeerConnection::AddStream): (WebCore::MockLibWebRTCPeerConnection::RemoveStream): (WebCore::MockLibWebRTCPeerConnection::CreateOffer): (WebCore::MockLibWebRTCPeerConnection::CreateAnswer): * testing/MockLibWebRTCPeerConnection.h: Added. (WebCore::MockLibWebRTCPeerConnection::~MockLibWebRTCPeerConnection): (WebCore::MockLibWebRTCPeerConnection::MockLibWebRTCPeerConnection): (WebCore::MockLibWebRTCPeerConnection::local_streams): (WebCore::MockLibWebRTCPeerConnection::remote_streams): (WebCore::MockLibWebRTCPeerConnection::CreateDtmfSender): (WebCore::MockLibWebRTCPeerConnection::GetStats): (WebCore::MockLibWebRTCPeerConnection::local_description): (WebCore::MockLibWebRTCPeerConnection::remote_description): (WebCore::MockLibWebRTCPeerConnection::AddIceCandidate): (WebCore::MockLibWebRTCPeerConnection::RegisterUMAObserver): (WebCore::MockLibWebRTCPeerConnection::signaling_state): (WebCore::MockLibWebRTCPeerConnection::ice_connection_state): (WebCore::MockLibWebRTCPeerConnection::ice_gathering_state): (WebCore::MockLibWebRTCPeerConnection::StopRtcEventLog): (WebCore::MockLibWebRTCPeerConnection::Close): (WebCore::MockLibWebRTCPeerConnection::gotLocalDescription): (WebCore::MockLibWebRTCIceCandidate::MockLibWebRTCIceCandidate): (WebCore::MockLibWebRTCAudioTrack::MockLibWebRTCAudioTrack): (WebCore::MockLibWebRTCVideoTrack::MockLibWebRTCVideoTrack): (WebCore::MockLibWebRTCDataChannel::MockLibWebRTCDataChannel): (WebCore::MockLibWebRTCPeerConnectionFactory::create): LayoutTests: * TestExpectations: Marking webrtc new tests as skipped for the moment. * fast/mediastream/RTCPeerConnection-createAnswer.html: * fast/mediastream/RTCPeerConnection-icecandidate-event.html: * fast/mediastream/RTCPeerConnection-iceconnectionstatechange-event.html: * webrtc/datachannel/basic.html: Added. * webrtc/routines.js: Added. (createConnections): (closeConnections): (onCreateSessionDescriptionError): (gotDescription1): (gotDescription2): (iceCallback1): (iceCallback2): (onAddIceCandidateSuccess): (onAddIceCandidateError): * webrtc/video.html: Added. Canonical link: https://commits.webkit.org/184528@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-27 04:54:09 +00:00
{
[WebRTC] Add support for libwebrtc TCP incoming connections https://bugs.webkit.org/show_bug.cgi?id=168748 Patch by Youenn Fablet <youenn@apple.com> on 2017-02-27 Reviewed by Alex Christensen. Source/WebKit2: Covered by added layout tests. When a libwebrtc server socket is signalling a new connnection through SignalNewConnection, we do: - Wrap the incoming socket into a LibWebRTCSocketClient - Store it into a pending socket map with an identifier - Send a message to the web process of a new connection with the server socket identifier and new connection socket identifier. The Web process then creates a WebRTCSocket wrapper around it by sendinig a WrapNewTCPConnection message. It then propagates the SignalNewConnection to libwebrtc code path. * NetworkProcess/webrtc/LibWebRTCSocketClient.cpp: (WebKit::LibWebRTCSocketClient::LibWebRTCSocketClient): (WebKit::LibWebRTCSocketClient::signalReadPacket): (WebKit::LibWebRTCSocketClient::signalSentPacket): (WebKit::LibWebRTCSocketClient::signalNewConnection): (WebKit::LibWebRTCSocketClient::signalAddressReady): (WebKit::LibWebRTCSocketClient::signalConnect): (WebKit::LibWebRTCSocketClient::signalClose): * NetworkProcess/webrtc/LibWebRTCSocketClient.h: * NetworkProcess/webrtc/NetworkRTCProvider.cpp: (WebKit::NetworkRTCProvider::wrapNewTCPConnection): (WebKit::NetworkRTCProvider::newConnection): * NetworkProcess/webrtc/NetworkRTCProvider.h: * NetworkProcess/webrtc/NetworkRTCProvider.messages.in: * WebProcess/Network/webrtc/LibWebRTCSocket.cpp: (WebKit::LibWebRTCSocket::signalNewConnection): * WebProcess/Network/webrtc/LibWebRTCSocket.h: * WebProcess/Network/webrtc/LibWebRTCSocketFactory.cpp: (WebKit::LibWebRTCSocketFactory::createNewConnectionSocket): * WebProcess/Network/webrtc/LibWebRTCSocketFactory.h: * WebProcess/Network/webrtc/WebRTCSocket.cpp: (WebKit::WebRTCSocket::signalNewConnection): * WebProcess/Network/webrtc/WebRTCSocket.h: * WebProcess/Network/webrtc/WebRTCSocket.messages.in: LayoutTests: * webrtc/datachannel/basic-expected.txt: Added. * webrtc/datachannel/basic.html: * webrtc/routines.js: (createConnections): (iceCallback1): (iceCallback2): Canonical link: https://commits.webkit.org/185936@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213104 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-28 01:10:39 +00:00
if (filterOutICECandidate && filterOutICECandidate(event.candidate))
return;
localConnection.addIceCandidate(event.candidate).then(onAddIceCandidateSuccess, onAddIceCandidateError);
[WebRTC] Add a LibWebRTC mock for testing https://bugs.webkit.org/show_bug.cgi?id=167429 Patch by Youenn Fablet <youennf@gmail.com> on 2017-01-26 Reviewed by Alex Christensen. Source/WebCore: Covered by updated tests although feature is behind a flag, off by default. MockLibWebRTCPeerConnection will allow us testing the code above the WebRTC implementation above LibWebRTC, without reyling on it and controlling the way that the peer connections will behave. Adding support for mock factory to create real peer connections in case where we want to do full testing through the local loopback. Tests: fast/mediastream/getUserMedia-webaudio.html webrtc/datachannel/basic.html webrtc/video.html * WebCore.xcodeproj/project.pbxproj: * testing/Internals.cpp: (WebCore::Internals::Internals): (WebCore::Internals::useMockRTCPeerConnectionFactory): * testing/Internals.h: * testing/Internals.idl: * testing/MockLibWebRTCPeerConnection.cpp: Added. (WebCore::useMockRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::MockLibWebRTCPeerConnectionForIceCandidates): (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::gotLocalDescription): (WebCore::MockLibWebRTCPeerConnectionForIceConnectionState::MockLibWebRTCPeerConnectionForIceConnectionState): (WebCore::MockLibWebRTCPeerConnectionForIceConnectionState::gotLocalDescription): (WebCore::MockLibWebRTCPeerConnectionFactory::MockLibWebRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionFactory::CreatePeerConnection): (WebCore::MockLibWebRTCPeerConnectionFactory::CreateLocalMediaStream): (WebCore::MockLibWebRTCPeerConnection::SetLocalDescription): (WebCore::MockLibWebRTCPeerConnection::SetRemoteDescription): (WebCore::MockLibWebRTCPeerConnection::CreateDataChannel): (WebCore::MockLibWebRTCPeerConnection::AddStream): (WebCore::MockLibWebRTCPeerConnection::RemoveStream): (WebCore::MockLibWebRTCPeerConnection::CreateOffer): (WebCore::MockLibWebRTCPeerConnection::CreateAnswer): * testing/MockLibWebRTCPeerConnection.h: Added. (WebCore::MockLibWebRTCPeerConnection::~MockLibWebRTCPeerConnection): (WebCore::MockLibWebRTCPeerConnection::MockLibWebRTCPeerConnection): (WebCore::MockLibWebRTCPeerConnection::local_streams): (WebCore::MockLibWebRTCPeerConnection::remote_streams): (WebCore::MockLibWebRTCPeerConnection::CreateDtmfSender): (WebCore::MockLibWebRTCPeerConnection::GetStats): (WebCore::MockLibWebRTCPeerConnection::local_description): (WebCore::MockLibWebRTCPeerConnection::remote_description): (WebCore::MockLibWebRTCPeerConnection::AddIceCandidate): (WebCore::MockLibWebRTCPeerConnection::RegisterUMAObserver): (WebCore::MockLibWebRTCPeerConnection::signaling_state): (WebCore::MockLibWebRTCPeerConnection::ice_connection_state): (WebCore::MockLibWebRTCPeerConnection::ice_gathering_state): (WebCore::MockLibWebRTCPeerConnection::StopRtcEventLog): (WebCore::MockLibWebRTCPeerConnection::Close): (WebCore::MockLibWebRTCPeerConnection::gotLocalDescription): (WebCore::MockLibWebRTCIceCandidate::MockLibWebRTCIceCandidate): (WebCore::MockLibWebRTCAudioTrack::MockLibWebRTCAudioTrack): (WebCore::MockLibWebRTCVideoTrack::MockLibWebRTCVideoTrack): (WebCore::MockLibWebRTCDataChannel::MockLibWebRTCDataChannel): (WebCore::MockLibWebRTCPeerConnectionFactory::create): LayoutTests: * TestExpectations: Marking webrtc new tests as skipped for the moment. * fast/mediastream/RTCPeerConnection-createAnswer.html: * fast/mediastream/RTCPeerConnection-icecandidate-event.html: * fast/mediastream/RTCPeerConnection-iceconnectionstatechange-event.html: * webrtc/datachannel/basic.html: Added. * webrtc/routines.js: Added. (createConnections): (closeConnections): (onCreateSessionDescriptionError): (gotDescription1): (gotDescription2): (iceCallback1): (iceCallback2): (onAddIceCandidateSuccess): (onAddIceCandidateError): * webrtc/video.html: Added. Canonical link: https://commits.webkit.org/184528@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-27 04:54:09 +00:00
}
function onAddIceCandidateSuccess()
{
}
function onAddIceCandidateError(error)
{
console.log("addIceCandidate error: " + error)
[WebRTC] Add a LibWebRTC mock for testing https://bugs.webkit.org/show_bug.cgi?id=167429 Patch by Youenn Fablet <youennf@gmail.com> on 2017-01-26 Reviewed by Alex Christensen. Source/WebCore: Covered by updated tests although feature is behind a flag, off by default. MockLibWebRTCPeerConnection will allow us testing the code above the WebRTC implementation above LibWebRTC, without reyling on it and controlling the way that the peer connections will behave. Adding support for mock factory to create real peer connections in case where we want to do full testing through the local loopback. Tests: fast/mediastream/getUserMedia-webaudio.html webrtc/datachannel/basic.html webrtc/video.html * WebCore.xcodeproj/project.pbxproj: * testing/Internals.cpp: (WebCore::Internals::Internals): (WebCore::Internals::useMockRTCPeerConnectionFactory): * testing/Internals.h: * testing/Internals.idl: * testing/MockLibWebRTCPeerConnection.cpp: Added. (WebCore::useMockRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::MockLibWebRTCPeerConnectionForIceCandidates): (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::gotLocalDescription): (WebCore::MockLibWebRTCPeerConnectionForIceConnectionState::MockLibWebRTCPeerConnectionForIceConnectionState): (WebCore::MockLibWebRTCPeerConnectionForIceConnectionState::gotLocalDescription): (WebCore::MockLibWebRTCPeerConnectionFactory::MockLibWebRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionFactory::CreatePeerConnection): (WebCore::MockLibWebRTCPeerConnectionFactory::CreateLocalMediaStream): (WebCore::MockLibWebRTCPeerConnection::SetLocalDescription): (WebCore::MockLibWebRTCPeerConnection::SetRemoteDescription): (WebCore::MockLibWebRTCPeerConnection::CreateDataChannel): (WebCore::MockLibWebRTCPeerConnection::AddStream): (WebCore::MockLibWebRTCPeerConnection::RemoveStream): (WebCore::MockLibWebRTCPeerConnection::CreateOffer): (WebCore::MockLibWebRTCPeerConnection::CreateAnswer): * testing/MockLibWebRTCPeerConnection.h: Added. (WebCore::MockLibWebRTCPeerConnection::~MockLibWebRTCPeerConnection): (WebCore::MockLibWebRTCPeerConnection::MockLibWebRTCPeerConnection): (WebCore::MockLibWebRTCPeerConnection::local_streams): (WebCore::MockLibWebRTCPeerConnection::remote_streams): (WebCore::MockLibWebRTCPeerConnection::CreateDtmfSender): (WebCore::MockLibWebRTCPeerConnection::GetStats): (WebCore::MockLibWebRTCPeerConnection::local_description): (WebCore::MockLibWebRTCPeerConnection::remote_description): (WebCore::MockLibWebRTCPeerConnection::AddIceCandidate): (WebCore::MockLibWebRTCPeerConnection::RegisterUMAObserver): (WebCore::MockLibWebRTCPeerConnection::signaling_state): (WebCore::MockLibWebRTCPeerConnection::ice_connection_state): (WebCore::MockLibWebRTCPeerConnection::ice_gathering_state): (WebCore::MockLibWebRTCPeerConnection::StopRtcEventLog): (WebCore::MockLibWebRTCPeerConnection::Close): (WebCore::MockLibWebRTCPeerConnection::gotLocalDescription): (WebCore::MockLibWebRTCIceCandidate::MockLibWebRTCIceCandidate): (WebCore::MockLibWebRTCAudioTrack::MockLibWebRTCAudioTrack): (WebCore::MockLibWebRTCVideoTrack::MockLibWebRTCVideoTrack): (WebCore::MockLibWebRTCDataChannel::MockLibWebRTCDataChannel): (WebCore::MockLibWebRTCPeerConnectionFactory::create): LayoutTests: * TestExpectations: Marking webrtc new tests as skipped for the moment. * fast/mediastream/RTCPeerConnection-createAnswer.html: * fast/mediastream/RTCPeerConnection-icecandidate-event.html: * fast/mediastream/RTCPeerConnection-iceconnectionstatechange-event.html: * webrtc/datachannel/basic.html: Added. * webrtc/routines.js: Added. (createConnections): (closeConnections): (onCreateSessionDescriptionError): (gotDescription1): (gotDescription2): (iceCallback1): (iceCallback2): (onAddIceCandidateSuccess): (onAddIceCandidateError): * webrtc/video.html: Added. Canonical link: https://commits.webkit.org/184528@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-27 04:54:09 +00:00
assert_unreached();
}
async function renegotiate(pc1, pc2)
{
let d = await pc1.createOffer();
await pc1.setLocalDescription(d);
await pc2.setRemoteDescription(d);
d = await pc2.createAnswer();
await pc1.setRemoteDescription(d);
await pc2.setLocalDescription(d);
}
[iOS] Unset active media capture source when stopped capturing https://bugs.webkit.org/show_bug.cgi?id=171815 <rdar://problem/32117885> Patch by Youenn Fablet <youenn@apple.com> on 2017-05-11 Reviewed by Eric Carlson. Source/WebCore: Test: platform/ios/mediastream/getUserMedia-single-capture.html Introducing SingleSourceFactory template class to be used by capture factories for iOS. This class ensures that only one source is active at a time. Update all capture sources accordingly. Ensure sources are no longer considered as active sources when being destroyed. Add support for mock sources and introducing m_isProducingData for them as well. Update WebRTC outgoing source classes to handle the case of replaced track and resetting the enabled/mute state according the new source. Update the way we handle timestamps for audio data. We now consider that we read/write as a flow. This allows smooth audio track replacing. * platform/mediastream/RealtimeMediaSource.h: * platform/mediastream/mac/AVAudioCaptureSource.mm: (WebCore::AVAudioCaptureSource::~AVAudioCaptureSource): (WebCore::AVAudioCaptureSourceFactory::setActiveSource): Deleted. * platform/mediastream/mac/AVVideoCaptureSource.mm: (WebCore::AVVideoCaptureSource::~AVVideoCaptureSource): (WebCore::AVVideoCaptureSourceFactory::setActiveSource): Deleted. * platform/mediastream/mac/CoreAudioCaptureSource.cpp: (WebCore::CoreAudioCaptureSource::~CoreAudioCaptureSource): (WebCore::CoreAudioCaptureSource::stopProducingData): (WebCore::CoreAudioCaptureSourceFactory::setActiveSource): Deleted. * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp: (WebCore::RealtimeOutgoingAudioSource::setSource): (WebCore::RealtimeOutgoingAudioSource::audioSamplesAvailable): (WebCore::RealtimeOutgoingAudioSource::pullAudioData): * platform/mediastream/mac/RealtimeOutgoingAudioSource.h: * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp: (WebCore::RealtimeOutgoingVideoSource::setSource): (WebCore::RealtimeOutgoingVideoSource::sourceMutedChanged): (WebCore::RealtimeOutgoingVideoSource::sourceEnabledChanged): * platform/mock/MockRealtimeAudioSource.cpp: (WebCore::mockAudioCaptureSourceFactory): (WebCore::MockRealtimeAudioSource::factory): (WebCore::MockRealtimeAudioSource::~MockRealtimeAudioSource): (WebCore::MockRealtimeAudioSource::startProducingData): (WebCore::MockRealtimeAudioSource::stopProducingData): * platform/mock/MockRealtimeAudioSource.h: * platform/mock/MockRealtimeVideoSource.cpp: (WebCore::mockVideoCaptureSourceFactory): (WebCore::MockRealtimeVideoSource::factory): (WebCore::MockRealtimeVideoSource::~MockRealtimeVideoSource): (WebCore::MockRealtimeVideoSource::startProducingData): (WebCore::MockRealtimeVideoSource::stopProducingData): * platform/mock/MockRealtimeVideoSource.h: (WebCore::MockRealtimeVideoSource::~MockRealtimeVideoSource): Deleted. LayoutTests: Improving the existing tests for better reliability and debugability. Updating tests to use less webkitAudioContext. * platform/ios/mediastream/getUserMedia-single-capture-expected.txt: Added. * platform/ios/mediastream/getUserMedia-single-capture.html: Added. * webrtc/audio-peer-connection-webaudio.html: * webrtc/audio-replace-track-expected.txt: * webrtc/audio-replace-track.html: * webrtc/peer-connection-audio-mute.html: * webrtc/peer-connection-audio-mute2.html: * webrtc/peer-connection-remote-audio-mute.html: * webrtc/peer-connection-remote-audio-mute2.html: * webrtc/routines.js: * webrtc/video-replace-track-expected.txt: * webrtc/video-replace-track.html: Canonical link: https://commits.webkit.org/188932@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216712 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-12 00:52:45 +00:00
function analyseAudio(stream, duration, context)
{
return new Promise((resolve, reject) => {
var sourceNode = context.createMediaStreamSource(stream);
[iOS] Unset active media capture source when stopped capturing https://bugs.webkit.org/show_bug.cgi?id=171815 <rdar://problem/32117885> Patch by Youenn Fablet <youenn@apple.com> on 2017-05-11 Reviewed by Eric Carlson. Source/WebCore: Test: platform/ios/mediastream/getUserMedia-single-capture.html Introducing SingleSourceFactory template class to be used by capture factories for iOS. This class ensures that only one source is active at a time. Update all capture sources accordingly. Ensure sources are no longer considered as active sources when being destroyed. Add support for mock sources and introducing m_isProducingData for them as well. Update WebRTC outgoing source classes to handle the case of replaced track and resetting the enabled/mute state according the new source. Update the way we handle timestamps for audio data. We now consider that we read/write as a flow. This allows smooth audio track replacing. * platform/mediastream/RealtimeMediaSource.h: * platform/mediastream/mac/AVAudioCaptureSource.mm: (WebCore::AVAudioCaptureSource::~AVAudioCaptureSource): (WebCore::AVAudioCaptureSourceFactory::setActiveSource): Deleted. * platform/mediastream/mac/AVVideoCaptureSource.mm: (WebCore::AVVideoCaptureSource::~AVVideoCaptureSource): (WebCore::AVVideoCaptureSourceFactory::setActiveSource): Deleted. * platform/mediastream/mac/CoreAudioCaptureSource.cpp: (WebCore::CoreAudioCaptureSource::~CoreAudioCaptureSource): (WebCore::CoreAudioCaptureSource::stopProducingData): (WebCore::CoreAudioCaptureSourceFactory::setActiveSource): Deleted. * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp: (WebCore::RealtimeOutgoingAudioSource::setSource): (WebCore::RealtimeOutgoingAudioSource::audioSamplesAvailable): (WebCore::RealtimeOutgoingAudioSource::pullAudioData): * platform/mediastream/mac/RealtimeOutgoingAudioSource.h: * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp: (WebCore::RealtimeOutgoingVideoSource::setSource): (WebCore::RealtimeOutgoingVideoSource::sourceMutedChanged): (WebCore::RealtimeOutgoingVideoSource::sourceEnabledChanged): * platform/mock/MockRealtimeAudioSource.cpp: (WebCore::mockAudioCaptureSourceFactory): (WebCore::MockRealtimeAudioSource::factory): (WebCore::MockRealtimeAudioSource::~MockRealtimeAudioSource): (WebCore::MockRealtimeAudioSource::startProducingData): (WebCore::MockRealtimeAudioSource::stopProducingData): * platform/mock/MockRealtimeAudioSource.h: * platform/mock/MockRealtimeVideoSource.cpp: (WebCore::mockVideoCaptureSourceFactory): (WebCore::MockRealtimeVideoSource::factory): (WebCore::MockRealtimeVideoSource::~MockRealtimeVideoSource): (WebCore::MockRealtimeVideoSource::startProducingData): (WebCore::MockRealtimeVideoSource::stopProducingData): * platform/mock/MockRealtimeVideoSource.h: (WebCore::MockRealtimeVideoSource::~MockRealtimeVideoSource): Deleted. LayoutTests: Improving the existing tests for better reliability and debugability. Updating tests to use less webkitAudioContext. * platform/ios/mediastream/getUserMedia-single-capture-expected.txt: Added. * platform/ios/mediastream/getUserMedia-single-capture.html: Added. * webrtc/audio-peer-connection-webaudio.html: * webrtc/audio-replace-track-expected.txt: * webrtc/audio-replace-track.html: * webrtc/peer-connection-audio-mute.html: * webrtc/peer-connection-audio-mute2.html: * webrtc/peer-connection-remote-audio-mute.html: * webrtc/peer-connection-remote-audio-mute2.html: * webrtc/routines.js: * webrtc/video-replace-track-expected.txt: * webrtc/video-replace-track.html: Canonical link: https://commits.webkit.org/188932@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216712 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-12 00:52:45 +00:00
var analyser = context.createAnalyser();
var gain = context.createGain();
getUserMedia echoCancellation constraint has no affect https://bugs.webkit.org/show_bug.cgi?id=179411 Reviewed by Eric Carlson. LayoutTests/imported/w3c: * web-platform-tests/mediacapture-streams/MediaDevices-getSupportedConstraints.https-expected.txt: Source/WebCore: Update implementation to properly report echoCancellation is supported and can take true or false. Update CoreAudioCaptureSource to initialize its state in constructor from the audio unit. This allows getUserMedia constraints to kick in after construction and update the source parameters. Audio unit parameters will then be set when the source will be asked to produce data. To enable testing, the mock audio is now adding a high frequency hum when echo cancellation is off. Covered by updated test. * Modules/mediastream/MediaStreamTrack.cpp: (WebCore::capabilityStringVector): (WebCore::capabilityBooleanVector): * platform/mediastream/RealtimeMediaSourceCenter.cpp: (WebCore::RealtimeMediaSourceCenter::RealtimeMediaSourceCenter): * platform/mediastream/gstreamer/MockGStreamerAudioCaptureSource.cpp: * platform/mediastream/mac/CoreAudioCaptureSource.cpp: (WebCore::CoreAudioCaptureSource::initializeToStartProducingData): * platform/mediastream/mac/MockAudioSharedUnit.mm: (WebCore::MockAudioSharedUnit::reconfigure): * platform/mock/MockRealtimeAudioSource.cpp: (WebCore::MockRealtimeAudioSource::MockRealtimeAudioSource): LayoutTests: * fast/mediastream/MediaDevices-getSupportedConstraints-expected.txt: * fast/mediastream/MediaDevices-getSupportedConstraints.html: * fast/mediastream/MediaStreamTrack-getCapabilities-expected.txt: * fast/mediastream/apply-constraints-audio-expected.txt: * fast/mediastream/apply-constraints-audio.html: * fast/mediastream/getUserMedia-webaudio-expected.txt: * fast/mediastream/getUserMedia-webaudio.html: * webrtc/routines.js: Canonical link: https://commits.webkit.org/217665@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@252681 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-11-20 04:10:24 +00:00
var results = { heardHum: false, heardBip: false, heardBop: false, heardNoise: false };
analyser.fftSize = 2048;
analyser.smoothingTimeConstant = 0;
analyser.minDecibels = -100;
analyser.maxDecibels = 0;
gain.gain.value = 0;
sourceNode.connect(analyser);
analyser.connect(gain);
gain.connect(context.destination);
function analyse() {
var freqDomain = new Uint8Array(analyser.frequencyBinCount);
analyser.getByteFrequencyData(freqDomain);
var hasFrequency = expectedFrequency => {
var bin = Math.floor(expectedFrequency * analyser.fftSize / context.sampleRate);
Values returned by FFTFrame::doFFT() are twice as large as they should be https://bugs.webkit.org/show_bug.cgi?id=216781 Reviewed by Darin Adler. Source/WebCore: To provide the best possible execution speeds, the vDSP library's functions don't always adhere strictly to textbook formulas for Fourier transforms, and must be scaled accordingly [1]. In the case of a Real forward Transform like in FFTFrame::doFFT(): RFimp = RFmath * 2 so we need to divide the output by 2 to get the correct value. We were failing to do this scaling and this was causing AnalyserNode tests to fail. [1] See https://developer.apple.com/library/archive/documentation/Performance/Conceptual/vDSP_Programming_Guide/UsingFourierTransforms/UsingFourierTransforms.html#//apple_ref/doc/uid/TP40005147-CH3-SW5 No new tests, rebaselined existing tests. * Modules/webaudio/PeriodicWave.cpp: (WebCore::PeriodicWave::createBandLimitedTables): Update normalization factor now that FFTFrame::doInverseFFT() has been fixed. The new normalization factor matches the value used by blink at: - https://github.com/chromium/chromium/blob/master/third_party/blink/renderer/modules/webaudio/periodic_wave.cc * platform/audio/FFTFrame.cpp: (WebCore::FFTFrame::multiply): We were applying a 0.5 scaling factor to the output of vDSP_zvmul(). However, the documentation for vDSP_zvmul() does not indicate that its output is twice as large as expected. Odds are that this was done because we used to have a bug in FFTFrame::doFFT() that was returning values twice as large as expected. SInce this function relies on VectorMath, there is no need for its implementation to be platform-specific. * platform/audio/FFTFrameStub.cpp: * platform/audio/gstreamer/FFTFrameGStreamer.cpp: (WebCore::FFTFrame::doFFT): (WebCore::FFTFrame::doInverseFFT): Drop 2 factor in the GStreamer implementation that was added to try and be consistent with the incorrect Mac implementation. * platform/audio/mac/FFTFrameMac.cpp: (WebCore::FFTFrame::doFFT): Fix issue where the values returned by doFFT() were twice as large as expected due to the odd behavior of vDSP_fft_zrip(). (WebCore::FFTFrame::doInverseFFT): Drop 2 factor in doInverseFFT that was added because the output of doFFT() was twice as large as expected and we wanted x == InverseFFT(FFT(x)). LayoutTests: * webaudio/Analyser/realtimeanalyser-downmix-expected.txt: * webaudio/Analyser/realtimeanalyser-freq-data-expected.txt: * webaudio/Analyser/realtimeanalyser-freq-data-smoothing-expected.txt: * webaudio/Analyser/realtimeanalyser-multiple-calls-expected.txt: Rebaseline tests that are passing now that the bug has been fixed. * webaudio/realtimeanalyser-fft-scaling-expected.txt: Removed. * webaudio/realtimeanalyser-fft-scaling.html: Removed. Drop outdated test. This test was imported into WPT and now resides at: - imported/w3c/web-platform-tests/webaudio/the-audio-api/the-analysernode-interface/realtimeanalyser-fft-scaling.html Canonical link: https://commits.webkit.org/229597@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267383 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-21 23:27:50 +00:00
return bin < freqDomain.length && freqDomain[bin] >= 100;
};
if (!results.heardHum)
results.heardHum = hasFrequency(150);
if (!results.heardBip)
results.heardBip = hasFrequency(1500);
if (!results.heardBop)
results.heardBop = hasFrequency(500);
getUserMedia echoCancellation constraint has no affect https://bugs.webkit.org/show_bug.cgi?id=179411 Reviewed by Eric Carlson. LayoutTests/imported/w3c: * web-platform-tests/mediacapture-streams/MediaDevices-getSupportedConstraints.https-expected.txt: Source/WebCore: Update implementation to properly report echoCancellation is supported and can take true or false. Update CoreAudioCaptureSource to initialize its state in constructor from the audio unit. This allows getUserMedia constraints to kick in after construction and update the source parameters. Audio unit parameters will then be set when the source will be asked to produce data. To enable testing, the mock audio is now adding a high frequency hum when echo cancellation is off. Covered by updated test. * Modules/mediastream/MediaStreamTrack.cpp: (WebCore::capabilityStringVector): (WebCore::capabilityBooleanVector): * platform/mediastream/RealtimeMediaSourceCenter.cpp: (WebCore::RealtimeMediaSourceCenter::RealtimeMediaSourceCenter): * platform/mediastream/gstreamer/MockGStreamerAudioCaptureSource.cpp: * platform/mediastream/mac/CoreAudioCaptureSource.cpp: (WebCore::CoreAudioCaptureSource::initializeToStartProducingData): * platform/mediastream/mac/MockAudioSharedUnit.mm: (WebCore::MockAudioSharedUnit::reconfigure): * platform/mock/MockRealtimeAudioSource.cpp: (WebCore::MockRealtimeAudioSource::MockRealtimeAudioSource): LayoutTests: * fast/mediastream/MediaDevices-getSupportedConstraints-expected.txt: * fast/mediastream/MediaDevices-getSupportedConstraints.html: * fast/mediastream/MediaStreamTrack-getCapabilities-expected.txt: * fast/mediastream/apply-constraints-audio-expected.txt: * fast/mediastream/apply-constraints-audio.html: * fast/mediastream/getUserMedia-webaudio-expected.txt: * fast/mediastream/getUserMedia-webaudio.html: * webrtc/routines.js: Canonical link: https://commits.webkit.org/217665@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@252681 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-11-20 04:10:24 +00:00
if (!results.heardNoise)
results.heardNoise = hasFrequency(3000);
if (results.heardHum && results.heardBip && results.heardBop && results.heardNoise)
done();
};
function done() {
clearTimeout(timeout);
clearInterval(interval);
resolve(results);
}
var timeout = setTimeout(done, 3 * duration);
var interval = setInterval(analyse, duration / 30);
analyse();
});
}
function waitFor(duration)
{
return new Promise((resolve) => setTimeout(resolve, duration));
}
RealtimeOutgoingVideoSource should not rotate muted frames https://bugs.webkit.org/show_bug.cgi?id=172659 Patch by Youenn Fablet <youenn@apple.com> on 2017-05-30 Reviewed by Eric Carlson. Source/WebCore: Test: webrtc/video-rotation.html When sending black frames, it is unnecessary to rotate frames. Instead, it is better to create frame with the expected width and height. Making sure libwebrtc rotated images are not null, as only YUV rotation is supported. Adding internals API to test part of that code path. Full coverage should be added when mock source is producing YUV images. * Modules/mediastream/PeerConnectionBackend.h: (WebCore::PeerConnectionBackend::applyRotationForOutgoingVideoSources): * Modules/mediastream/RTCPeerConnection.h: * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp: (WebCore::LibWebRTCPeerConnectionBackend::applyRotationForOutgoingVideoSources): * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h: * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp: (WebCore::RealtimeOutgoingVideoSource::sendBlackFrames): (WebCore::RealtimeOutgoingVideoSource::sendFrame): * platform/mediastream/mac/RealtimeOutgoingVideoSource.h: * testing/Internals.cpp: (WebCore::Internals::Internals): (WebCore::Internals::applyRotationForOutgoingVideoSources): (WebCore::Internals::setCameraMediaStreamTrackOrientation): * testing/Internals.h: * testing/Internals.idl: LayoutTests: * webrtc/routines.js: * webrtc/video-rotation-expected.txt: Added. * webrtc/video-rotation.html: Added. Canonical link: https://commits.webkit.org/189612@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@217562 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-30 18:29:13 +00:00
function waitForVideoSize(video, width, height, count)
{
if (video.videoWidth === width && video.videoHeight === height)
return Promise.resolve("video has expected size");
if (count === undefined)
count = 0;
if (++count > 20)
[WebRTC] Prevent capturing at unconventional resolutions when using the SW encoder on Mac https://bugs.webkit.org/show_bug.cgi?id=172602 <rdar://problem/32407693> Patch by Youenn Fablet <youenn@apple.com> on 2017-06-22 Reviewed by Eric Carlson. Source/ThirdParty/libwebrtc: Adding a parameter to disable hardware encoder. * Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/encoder.h: * Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/encoder.mm: (webrtc::H264VideoToolboxEncoder::CreateCompressionSession): Source/WebCore: Test: platform/mac/webrtc/captureCanvas-webrtc-software-encoder.html Add internal API to switch on/off hardware H264 encoder. Add checks for standard size. If using a software encoder and frame size is not standard, the session is destroyed and no frame is sent at all. Added tests based on captureStream. Fixed the case of capturing a canvas which size is changing. * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp: (WebCore::CanvasCaptureMediaStreamTrack::Source::canvasResized): * platform/mediastream/libwebrtc/H264VideoToolBoxEncoder.h: * platform/mediastream/libwebrtc/H264VideoToolBoxEncoder.mm: (WebCore::H264VideoToolboxEncoder::setHardwareEncoderForWebRTCAllowed): (WebCore::H264VideoToolboxEncoder::hardwareEncoderForWebRTCAllowed): (WebCore::isUsingSoftwareEncoder): (WebCore::H264VideoToolboxEncoder::CreateCompressionSession): (isStandardFrameSize): Added. (isUsingSoftwareEncoder): Added. * testing/Internals.cpp: (WebCore::Internals::setH264HardwareEncoderAllowed): * testing/Internals.h: * testing/Internals.idl: LayoutTests: * platform/mac-wk1/TestExpectations: Mark captureCanvas as flaky due to AVDCreateGPUAccelerator: Error loading GPU renderer" appearing on some bots. * platform/mac/webrtc/captureCanvas-webrtc-software-encoder-expected.txt: Copied from LayoutTests/webrtc/captureCanvas-webrtc-expected.txt. * platform/mac/webrtc/captureCanvas-webrtc-software-encoder.html: Added. * webrtc/captureCanvas-webrtc-expected.txt: * webrtc/captureCanvas-webrtc.html: Canonical link: https://commits.webkit.org/190583@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@218699 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-06-22 15:29:14 +00:00
return Promise.reject("waitForVideoSize timed out, expected " + width + "x"+ height + " but got " + video.videoWidth + "x" + video.videoHeight);
RealtimeOutgoingVideoSource should not rotate muted frames https://bugs.webkit.org/show_bug.cgi?id=172659 Patch by Youenn Fablet <youenn@apple.com> on 2017-05-30 Reviewed by Eric Carlson. Source/WebCore: Test: webrtc/video-rotation.html When sending black frames, it is unnecessary to rotate frames. Instead, it is better to create frame with the expected width and height. Making sure libwebrtc rotated images are not null, as only YUV rotation is supported. Adding internals API to test part of that code path. Full coverage should be added when mock source is producing YUV images. * Modules/mediastream/PeerConnectionBackend.h: (WebCore::PeerConnectionBackend::applyRotationForOutgoingVideoSources): * Modules/mediastream/RTCPeerConnection.h: * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp: (WebCore::LibWebRTCPeerConnectionBackend::applyRotationForOutgoingVideoSources): * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h: * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp: (WebCore::RealtimeOutgoingVideoSource::sendBlackFrames): (WebCore::RealtimeOutgoingVideoSource::sendFrame): * platform/mediastream/mac/RealtimeOutgoingVideoSource.h: * testing/Internals.cpp: (WebCore::Internals::Internals): (WebCore::Internals::applyRotationForOutgoingVideoSources): (WebCore::Internals::setCameraMediaStreamTrackOrientation): * testing/Internals.h: * testing/Internals.idl: LayoutTests: * webrtc/routines.js: * webrtc/video-rotation-expected.txt: Added. * webrtc/video-rotation.html: Added. Canonical link: https://commits.webkit.org/189612@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@217562 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-30 18:29:13 +00:00
Remove use of mock webrtc backend factory at injected bundle reset time https://bugs.webkit.org/show_bug.cgi?id=173817 Patch by Youenn Fablet <youenn@apple.com> on 2017-06-25 Reviewed by Darin Adler. Source/WebCore: * testing/Internals.cpp: (WebCore::Internals::resetToConsistentState): Resetting the peer connection backend. * testing/MockLibWebRTCPeerConnection.cpp: Doing some clean-up (WebCore::useRealRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionFactory::MockLibWebRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionFactory::CreatePeerConnection): (WebCore::MockLibWebRTCPeerConnectionFactory::CreateVideoTrack): (WebCore::MockLibWebRTCPeerConnectionFactory::CreateAudioTrack): * testing/MockLibWebRTCPeerConnection.h: LayoutTests: Making some tests less flaky. * TestExpectations: * fast/mediastream/RTCPeerConnection-media-setup-two-dialogs-expected.txt: * platform/mac/webrtc/captureCanvas-webrtc-software-encoder.html: * webrtc/audio-peer-connection-webaudio.html: * webrtc/captureCanvas-webrtc.html: * webrtc/datachannel/bufferedAmountLowThreshold-default-expected.txt: Added. * webrtc/datachannel/bufferedAmountLowThreshold-default.html: Added. * webrtc/datachannel/bufferedAmountLowThreshold-expected.txt: * webrtc/datachannel/bufferedAmountLowThreshold.html: * webrtc/routines.js: * webrtc/video-replace-muted-track.html: * webrtc/video-unmute.html: Canonical link: https://commits.webkit.org/190676@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@218795 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-06-25 18:06:06 +00:00
return waitFor(100).then(() => {
RealtimeOutgoingVideoSource should not rotate muted frames https://bugs.webkit.org/show_bug.cgi?id=172659 Patch by Youenn Fablet <youenn@apple.com> on 2017-05-30 Reviewed by Eric Carlson. Source/WebCore: Test: webrtc/video-rotation.html When sending black frames, it is unnecessary to rotate frames. Instead, it is better to create frame with the expected width and height. Making sure libwebrtc rotated images are not null, as only YUV rotation is supported. Adding internals API to test part of that code path. Full coverage should be added when mock source is producing YUV images. * Modules/mediastream/PeerConnectionBackend.h: (WebCore::PeerConnectionBackend::applyRotationForOutgoingVideoSources): * Modules/mediastream/RTCPeerConnection.h: * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp: (WebCore::LibWebRTCPeerConnectionBackend::applyRotationForOutgoingVideoSources): * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h: * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp: (WebCore::RealtimeOutgoingVideoSource::sendBlackFrames): (WebCore::RealtimeOutgoingVideoSource::sendFrame): * platform/mediastream/mac/RealtimeOutgoingVideoSource.h: * testing/Internals.cpp: (WebCore::Internals::Internals): (WebCore::Internals::applyRotationForOutgoingVideoSources): (WebCore::Internals::setCameraMediaStreamTrackOrientation): * testing/Internals.h: * testing/Internals.idl: LayoutTests: * webrtc/routines.js: * webrtc/video-rotation-expected.txt: Added. * webrtc/video-rotation.html: Added. Canonical link: https://commits.webkit.org/189612@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@217562 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-30 18:29:13 +00:00
return waitForVideoSize(video, width, height, count);
});
}
PeerConnection should respect tracks that are muted at the time they are added https://bugs.webkit.org/show_bug.cgi?id=172771 Patch by Youenn Fablet <youenn@apple.com> on 2017-05-31 Reviewed by Eric Carlson. Source/WebCore: Tests: webrtc/peer-connection-audio-unmute.html webrtc/video-unmute.html Making sure that muted/enabled state of sources are correctly handled at creation time of the outgoing webrtc sources. This should trigger silent audio and black frames. * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp: (WebCore::RealtimeOutgoingAudioSource::RealtimeOutgoingAudioSource): (WebCore::RealtimeOutgoingAudioSource::setSource): (WebCore::RealtimeOutgoingAudioSource::initializeConverter): * platform/mediastream/mac/RealtimeOutgoingAudioSource.h: * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp: (WebCore::RealtimeOutgoingVideoSource::RealtimeOutgoingVideoSource): (WebCore::RealtimeOutgoingVideoSource::setSource): (WebCore::RealtimeOutgoingVideoSource::sourceMutedChanged): (WebCore::RealtimeOutgoingVideoSource::sourceEnabledChanged): (WebCore::RealtimeOutgoingVideoSource::initializeFromSource): (WebCore::RealtimeOutgoingVideoSource::AddOrUpdateSink): (WebCore::RealtimeOutgoingVideoSource::RemoveSink): (WebCore::RealtimeOutgoingVideoSource::sendBlackFramesIfNeeded): (WebCore::RealtimeOutgoingVideoSource::setSizeFromSource): Deleted. (WebCore::RealtimeOutgoingVideoSource::sendBlackFrames): Deleted. * platform/mediastream/mac/RealtimeOutgoingVideoSource.h: LayoutTests: * webrtc/audio-replace-track.html: * webrtc/peer-connection-audio-unmute-expected.txt: Added. * webrtc/peer-connection-audio-unmute.html: Added. * webrtc/routines.js: * webrtc/video-unmute-expected.txt: Added. * webrtc/video-unmute.html: Added. Canonical link: https://commits.webkit.org/189671@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@217624 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-31 20:51:12 +00:00
async function doHumAnalysis(stream, expected)
{
Turn off the legacy prefixed WebAudio API https://bugs.webkit.org/show_bug.cgi?id=216886 Reviewed by Sam Weinig. LayoutTests/imported/w3c: * web-platform-tests/webaudio/historical-expected.txt: Rebaseline test that is now passing. Source/WebCore: Turn off the legacy prefixed WebAudio API, now that the modern unprefixed API has been enabled in r267488. No new tests, rebaselined existing tests. * Modules/webaudio/AudioBufferSourceNode.idl: Make sure legacy constants get unexposed if the PrefixedWebAudio setting is disabled. * bindings/scripts/CodeGeneratorJS.pm: (GenerateImplementation): (GetRuntimeEnabledStaticProperties): * bindings/scripts/test/JS/JSTestConditionalIncludes.cpp: (WebCore::JSTestConditionalIncludesConstructor::initializeProperties): (WebCore::JSTestConditionalIncludesPrototype::finishCreation): * bindings/scripts/test/JS/JSTestEnabledBySetting.cpp: (WebCore::JSTestEnabledBySettingConstructor::prototypeForStructure): (WebCore::JSTestEnabledBySettingConstructor::initializeProperties): (WebCore::JSTestEnabledBySettingPrototype::finishCreation): * bindings/scripts/test/TestEnabledBySetting.idl: Add support for using [EnabledBySetting=X] on constants. Source/WebKit: Turn off the legacy prefixed WebAudio API, now that the modern unprefixed API has been enabled in r267488. * Shared/WebPreferencesInternal.yaml: Source/WebKitLegacy/mac: Turn off the legacy prefixed WebAudio API, now that the modern unprefixed API has been enabled in r267488. * WebView/WebView.mm: (-[WebView _preferencesChanged:]): LayoutTests: Port existing layout tests from the prefixed WebAudio API to the new unprefixed version. * fast/history/page-cache-closed-audiocontext.html: * fast/history/page-cache-running-audiocontext.html: * fast/history/page-cache-suspended-audiocontext.html: * fast/mediastream/getUserMedia-webaudio.html: * fast/mediastream/media-devices-enumerate-devices.html: * fast/mediastream/mediastreamtrack-audio-clone.html: * fast/mediastream/mock-media-source-webaudio.html: * http/tests/security/webaudio-render-remote-audio-allowed-crossorigin.html: * http/tests/security/webaudio-render-remote-audio-blocked-no-crossorigin.html: * http/wpt/mediarecorder/MediaRecorder-onremovetrack.html: * http/wpt/webaudio/resources/audiocontext-stopped-iframe.html: * platform/ios/webaudio/realtimeanalyser-fft-sizing-expected.txt: * resources/testharnessreport.js: * webaudio/analyser-exception.html: * webaudio/audiobuffer-crash-expected.txt: * webaudio/audiobuffer-crash.html: * webaudio/audiobuffer-expected.txt: * webaudio/audiobuffer-neuter.html: * webaudio/audiobuffer.html: * webaudio/audiobuffersource-channels-expected.txt: * webaudio/audiobuffersource-channels.html: * webaudio/audiobuffersource-ended.html: * webaudio/audiobuffersource-multi-channels.html: * webaudio/audiobuffersource-negative-playbackrate-interpolated-loop.html: * webaudio/audiobuffersource-negative-playbackrate-interpolated.html: * webaudio/audiobuffersource-negative-playbackrate-loop.html: * webaudio/audiobuffersource-negative-playbackrate.html: * webaudio/audiobuffersource-not-gced-until-ended.html: * webaudio/audiobuffersource-playbackState-expected.txt: Removed. * webaudio/audiobuffersource-playbackState.html: Removed. * webaudio/audiobuffersource-playbackrate.html: * webaudio/audiobuffersource-start.html: * webaudio/audiobuffersource.html: * webaudio/audiobuffersourcenode-legacy-api-expected.txt: * webaudio/audiobuffersourcenode-legacy-api.html: * webaudio/audiochannelmerger-basic.html: * webaudio/audiochannelmerger-stereo.html: * webaudio/audiochannelsplitter.html: * webaudio/audiocontext-promise-throwing-expected.txt: * webaudio/audiocontext-promise-throwing.html: * webaudio/audiocontext-promise.html: * webaudio/audiocontext-restriction-audiobuffersourcenode-start.html: * webaudio/audiocontext-restriction.html: * webaudio/audiocontext-state-interrupted.html: * webaudio/audiocontext-state.html: * webaudio/audionode-connect-order.html: * webaudio/audionode.html: * webaudio/audioparam-connect-audioratesignal.html: * webaudio/audioparam-summingjunction.html: * webaudio/audioprocessingevent.html: * webaudio/automatic-pull-node.html: * webaudio/convolution-mono-mono.html: * webaudio/convolver-channels.html: * webaudio/convolver-setBuffer-different-samplerate.html: * webaudio/convolver-setBuffer-null.html: * webaudio/createMediaStreamSource-null-expected.txt: * webaudio/createMediaStreamSource-null.html: * webaudio/decode-audio-data-basic-expected.txt: * webaudio/decode-audio-data-basic.html: * webaudio/decode-audio-data-too-short.html: * webaudio/delaynode-max-default-delay.html: * webaudio/delaynode-max-nondefault-delay.html: * webaudio/delaynode-maxdelay.html: * webaudio/delaynode-maxdelaylimit.html: * webaudio/delaynode-scheduling.html: * webaudio/delaynode.html: * webaudio/distance-exponential.html: * webaudio/distance-inverse.html: * webaudio/distance-linear.html: * webaudio/dynamicscompressor-basic.html: * webaudio/finished-audio-buffer-source-nodes-should-be-collectable.html: * webaudio/gain-basic.html: * webaudio/gain.html: * webaudio/mediaelementaudiosourcenode-expected.txt: * webaudio/mediaelementaudiosourcenode-gc.html: * webaudio/mediaelementaudiosourcenode.html: * webaudio/mixing.html: * webaudio/offlineaudiocontext-gc.html: * webaudio/offlineaudiocontext-restriction.html: * webaudio/oscillatornode-legacy-api-expected.txt: * webaudio/oscillatornode-legacy-api.html: * webaudio/page-canstartmedia.html: * webaudio/panner-equalpower-stereo.html: * webaudio/panner-equalpower.html: * webaudio/prefixed-pannernode-basic-expected.txt: Removed. * webaudio/prefixed-pannernode-basic.html: Removed. * webaudio/realtimeanalyser-fft-sizing-expected.txt: * webaudio/realtimeanalyser-fft-sizing.html: * webaudio/resources/audio-codec-test.js: (runDecodingTest): * webaudio/resources/audiobuffersource-ended-detached-frame-iframe.html: * webaudio/resources/audioparam-testing-legacy.js: (createAudioGraphAndTest): * webaudio/resources/compatibility.js: Removed. * webaudio/resources/javascriptaudionode-testing.js: (runJSNodeTest): * webaudio/resources/oscillator-testing-legacy.js: (generateExponentialOscillatorSweep): * webaudio/sample-accurate-scheduling.html: * webaudio/silence-after-playback.html: * webaudio/silent-audio-interrupted-in-background.html: * webaudio/stereo2mono-down-mixing.html: * webaudio/test-basic.html: * webaudio/up-mixing-mono-51.html: * webaudio/up-mixing-mono-stereo.html: * webaudio/up-mixing-stereo-51.html: * webaudio/waveshaper.html: * webaudio/web-audio-is-playing.html: * webaudio/webaudio-gc.html: * webaudio/webkitofflineaudiocontext-startRendering-crash-expected.txt: * webaudio/webkitofflineaudiocontext-startRendering-crash.html: * webrtc/audio-peer-connection-g722.html: * webrtc/audio-peer-connection-webaudio.html: * webrtc/clone-audio-track.html: * webrtc/getUserMedia-webaudio-autoplay.html: * webrtc/peer-connection-audio-mute.html: * webrtc/peer-connection-audio-mute2.html: * webrtc/peer-connection-createMediaStreamDestination.html: * webrtc/peer-connection-remote-audio-mute.html: * webrtc/peer-connection-remote-audio-mute2.html: * webrtc/routines.js: Canonical link: https://commits.webkit.org/229688@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267504 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-23 22:48:05 +00:00
var context = new AudioContext();
Remove use of mock webrtc backend factory at injected bundle reset time https://bugs.webkit.org/show_bug.cgi?id=173817 Patch by Youenn Fablet <youenn@apple.com> on 2017-06-25 Reviewed by Darin Adler. Source/WebCore: * testing/Internals.cpp: (WebCore::Internals::resetToConsistentState): Resetting the peer connection backend. * testing/MockLibWebRTCPeerConnection.cpp: Doing some clean-up (WebCore::useRealRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionFactory::MockLibWebRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionFactory::CreatePeerConnection): (WebCore::MockLibWebRTCPeerConnectionFactory::CreateVideoTrack): (WebCore::MockLibWebRTCPeerConnectionFactory::CreateAudioTrack): * testing/MockLibWebRTCPeerConnection.h: LayoutTests: Making some tests less flaky. * TestExpectations: * fast/mediastream/RTCPeerConnection-media-setup-two-dialogs-expected.txt: * platform/mac/webrtc/captureCanvas-webrtc-software-encoder.html: * webrtc/audio-peer-connection-webaudio.html: * webrtc/captureCanvas-webrtc.html: * webrtc/datachannel/bufferedAmountLowThreshold-default-expected.txt: Added. * webrtc/datachannel/bufferedAmountLowThreshold-default.html: Added. * webrtc/datachannel/bufferedAmountLowThreshold-expected.txt: * webrtc/datachannel/bufferedAmountLowThreshold.html: * webrtc/routines.js: * webrtc/video-replace-muted-track.html: * webrtc/video-unmute.html: Canonical link: https://commits.webkit.org/190676@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@218795 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-06-25 18:06:06 +00:00
for (var cptr = 0; cptr < 20; cptr++) {
PeerConnection should respect tracks that are muted at the time they are added https://bugs.webkit.org/show_bug.cgi?id=172771 Patch by Youenn Fablet <youenn@apple.com> on 2017-05-31 Reviewed by Eric Carlson. Source/WebCore: Tests: webrtc/peer-connection-audio-unmute.html webrtc/video-unmute.html Making sure that muted/enabled state of sources are correctly handled at creation time of the outgoing webrtc sources. This should trigger silent audio and black frames. * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp: (WebCore::RealtimeOutgoingAudioSource::RealtimeOutgoingAudioSource): (WebCore::RealtimeOutgoingAudioSource::setSource): (WebCore::RealtimeOutgoingAudioSource::initializeConverter): * platform/mediastream/mac/RealtimeOutgoingAudioSource.h: * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp: (WebCore::RealtimeOutgoingVideoSource::RealtimeOutgoingVideoSource): (WebCore::RealtimeOutgoingVideoSource::setSource): (WebCore::RealtimeOutgoingVideoSource::sourceMutedChanged): (WebCore::RealtimeOutgoingVideoSource::sourceEnabledChanged): (WebCore::RealtimeOutgoingVideoSource::initializeFromSource): (WebCore::RealtimeOutgoingVideoSource::AddOrUpdateSink): (WebCore::RealtimeOutgoingVideoSource::RemoveSink): (WebCore::RealtimeOutgoingVideoSource::sendBlackFramesIfNeeded): (WebCore::RealtimeOutgoingVideoSource::setSizeFromSource): Deleted. (WebCore::RealtimeOutgoingVideoSource::sendBlackFrames): Deleted. * platform/mediastream/mac/RealtimeOutgoingVideoSource.h: LayoutTests: * webrtc/audio-replace-track.html: * webrtc/peer-connection-audio-unmute-expected.txt: Added. * webrtc/peer-connection-audio-unmute.html: Added. * webrtc/routines.js: * webrtc/video-unmute-expected.txt: Added. * webrtc/video-unmute.html: Added. Canonical link: https://commits.webkit.org/189671@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@217624 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-31 20:51:12 +00:00
var results = await analyseAudio(stream, 200, context);
if (results.heardHum === expected)
return true;
Remove use of mock webrtc backend factory at injected bundle reset time https://bugs.webkit.org/show_bug.cgi?id=173817 Patch by Youenn Fablet <youenn@apple.com> on 2017-06-25 Reviewed by Darin Adler. Source/WebCore: * testing/Internals.cpp: (WebCore::Internals::resetToConsistentState): Resetting the peer connection backend. * testing/MockLibWebRTCPeerConnection.cpp: Doing some clean-up (WebCore::useRealRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionFactory::MockLibWebRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionFactory::CreatePeerConnection): (WebCore::MockLibWebRTCPeerConnectionFactory::CreateVideoTrack): (WebCore::MockLibWebRTCPeerConnectionFactory::CreateAudioTrack): * testing/MockLibWebRTCPeerConnection.h: LayoutTests: Making some tests less flaky. * TestExpectations: * fast/mediastream/RTCPeerConnection-media-setup-two-dialogs-expected.txt: * platform/mac/webrtc/captureCanvas-webrtc-software-encoder.html: * webrtc/audio-peer-connection-webaudio.html: * webrtc/captureCanvas-webrtc.html: * webrtc/datachannel/bufferedAmountLowThreshold-default-expected.txt: Added. * webrtc/datachannel/bufferedAmountLowThreshold-default.html: Added. * webrtc/datachannel/bufferedAmountLowThreshold-expected.txt: * webrtc/datachannel/bufferedAmountLowThreshold.html: * webrtc/routines.js: * webrtc/video-replace-muted-track.html: * webrtc/video-unmute.html: Canonical link: https://commits.webkit.org/190676@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@218795 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-06-25 18:06:06 +00:00
await waitFor(50);
PeerConnection should respect tracks that are muted at the time they are added https://bugs.webkit.org/show_bug.cgi?id=172771 Patch by Youenn Fablet <youenn@apple.com> on 2017-05-31 Reviewed by Eric Carlson. Source/WebCore: Tests: webrtc/peer-connection-audio-unmute.html webrtc/video-unmute.html Making sure that muted/enabled state of sources are correctly handled at creation time of the outgoing webrtc sources. This should trigger silent audio and black frames. * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp: (WebCore::RealtimeOutgoingAudioSource::RealtimeOutgoingAudioSource): (WebCore::RealtimeOutgoingAudioSource::setSource): (WebCore::RealtimeOutgoingAudioSource::initializeConverter): * platform/mediastream/mac/RealtimeOutgoingAudioSource.h: * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp: (WebCore::RealtimeOutgoingVideoSource::RealtimeOutgoingVideoSource): (WebCore::RealtimeOutgoingVideoSource::setSource): (WebCore::RealtimeOutgoingVideoSource::sourceMutedChanged): (WebCore::RealtimeOutgoingVideoSource::sourceEnabledChanged): (WebCore::RealtimeOutgoingVideoSource::initializeFromSource): (WebCore::RealtimeOutgoingVideoSource::AddOrUpdateSink): (WebCore::RealtimeOutgoingVideoSource::RemoveSink): (WebCore::RealtimeOutgoingVideoSource::sendBlackFramesIfNeeded): (WebCore::RealtimeOutgoingVideoSource::setSizeFromSource): Deleted. (WebCore::RealtimeOutgoingVideoSource::sendBlackFrames): Deleted. * platform/mediastream/mac/RealtimeOutgoingVideoSource.h: LayoutTests: * webrtc/audio-replace-track.html: * webrtc/peer-connection-audio-unmute-expected.txt: Added. * webrtc/peer-connection-audio-unmute.html: Added. * webrtc/routines.js: * webrtc/video-unmute-expected.txt: Added. * webrtc/video-unmute.html: Added. Canonical link: https://commits.webkit.org/189671@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@217624 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-31 20:51:12 +00:00
}
await context.close();
return false;
}
function isVideoBlack(canvas, video, startX, startY, grabbedWidth, grabbedHeight)
{
canvas.width = video.videoWidth;
canvas.height = video.videoHeight;
if (!grabbedHeight) {
Enable VCP for iOS and reenable it for MacOS https://bugs.webkit.org/show_bug.cgi?id=189635 <rdar://problem/43621029> Reviewed by Eric Carlson. Source/ThirdParty/libwebrtc: Make sure VCP API is used to set encoding session parameters. * Source/webrtc/sdk/WebKit/VideoProcessingSoftLink.h: * Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/RTCVideoEncoderH264.mm: (-[RTCVideoEncoderH264 resetCompressionSessionWithPixelFormat:]): * Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/helpers.cc: * Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/helpers.h: Source/WebCore: Covered by exsiting and modified tests. Instead of using libwebrtc YUV frames for black frames, use CVPixelBuffer to make it efficient. Add internal API to know whether VCP is enabled so as to make capture-webrtc test pass on all platforms. * platform/mediastream/RealtimeOutgoingVideoSource.cpp: (WebCore::RealtimeOutgoingVideoSource::sendBlackFramesIfNeeded): * platform/mediastream/RealtimeOutgoingVideoSource.h: * platform/mediastream/gstreamer/RealtimeOutgoingVideoSourceLibWebRTC.h: * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.h: * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm: (WebCore::createBlackPixelBuffer): (WebCore::RealtimeIncomingVideoSourceCocoa::pixelBufferFromVideoFrame): * platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp: (WebCore::RealtimeOutgoingVideoSourceCocoa::createBlackFrame): * platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.h: * testing/Internals.cpp: (WebCore::Internals::supportsVCPEncoder): * testing/Internals.h: * testing/Internals.idl: LayoutTests: * platform/mac/webrtc/captureCanvas-webrtc-software-encoder.html: For platforms suppporting VCP, arbitrary size should be supported. * webrtc/routines.js: Canonical link: https://commits.webkit.org/204629@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236070 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-09-17 17:15:56 +00:00
startX = 10;
startY = 10;
grabbedWidth = canvas.width - 20;
grabbedHeight = canvas.height - 20;
}
canvas.getContext('2d').drawImage(video, 0, 0, canvas.width, canvas.height);
imageData = canvas.getContext('2d').getImageData(startX, startY, grabbedWidth, grabbedHeight);
data = imageData.data;
for (var cptr = 0; cptr < grabbedWidth * grabbedHeight; ++cptr) {
// Approximatively black pixels.
if (data[4 * cptr] > 30 || data[4 * cptr + 1] > 30 || data[4 * cptr + 2] > 30)
return false;
}
return true;
}
async function checkVideoBlack(expected, canvas, video, errorMessage, counter)
{
if (isVideoBlack(canvas, video) === expected)
return Promise.resolve();
Enable VCP for iOS and reenable it for MacOS https://bugs.webkit.org/show_bug.cgi?id=189635 <rdar://problem/43621029> Reviewed by Eric Carlson. Source/ThirdParty/libwebrtc: Make sure VCP API is used to set encoding session parameters. * Source/webrtc/sdk/WebKit/VideoProcessingSoftLink.h: * Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/RTCVideoEncoderH264.mm: (-[RTCVideoEncoderH264 resetCompressionSessionWithPixelFormat:]): * Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/helpers.cc: * Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/helpers.h: Source/WebCore: Covered by exsiting and modified tests. Instead of using libwebrtc YUV frames for black frames, use CVPixelBuffer to make it efficient. Add internal API to know whether VCP is enabled so as to make capture-webrtc test pass on all platforms. * platform/mediastream/RealtimeOutgoingVideoSource.cpp: (WebCore::RealtimeOutgoingVideoSource::sendBlackFramesIfNeeded): * platform/mediastream/RealtimeOutgoingVideoSource.h: * platform/mediastream/gstreamer/RealtimeOutgoingVideoSourceLibWebRTC.h: * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.h: * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm: (WebCore::createBlackPixelBuffer): (WebCore::RealtimeIncomingVideoSourceCocoa::pixelBufferFromVideoFrame): * platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp: (WebCore::RealtimeOutgoingVideoSourceCocoa::createBlackFrame): * platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.h: * testing/Internals.cpp: (WebCore::Internals::supportsVCPEncoder): * testing/Internals.h: * testing/Internals.idl: LayoutTests: * platform/mac/webrtc/captureCanvas-webrtc-software-encoder.html: For platforms suppporting VCP, arbitrary size should be supported. * webrtc/routines.js: Canonical link: https://commits.webkit.org/204629@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236070 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-09-17 17:15:56 +00:00
if (counter === undefined)
counter = 0;
if (counter > 400) {
if (!errorMessage)
errorMessage = "checkVideoBlack timed out expecting " + expected;
return Promise.reject(errorMessage);
}
await waitFor(50);
return checkVideoBlack(expected, canvas, video, errorMessage, ++counter);
}
Add VP8 support to WebRTC https://bugs.webkit.org/show_bug.cgi?id=189976 Reviewed by Eric Carlson. LayoutTests/imported/w3c: * web-platform-tests/webrtc/RTCPeerConnection-addIceCandidate-expected.txt: Source/ThirdParty/libwebrtc: Add support for conditional VP8 support for both encoding and decoding. This boolean is used by WebCore based on the new VP8 runtime flag. Enable yasm compilation as a dependency of libvpx. Compilation is done without using SSE4/AVX2 optimizations. * Configurations/libvpx.xcconfig: Added. * Configurations/libwebrtc.iOS.exp: * Configurations/libwebrtc.iOSsim.exp: * Configurations/libwebrtc.mac.exp: * Configurations/libwebrtc.xcconfig: * Configurations/libwebrtcpcrtc.xcconfig: * Source/third_party/libvpx/run_yasm_webkit.py: Added. * Source/third_party/libvpx/source/config/mac/x64/vpx_config.asm: * Source/third_party/libvpx/source/config/mac/x64/vpx_config.h: * Source/third_party/libvpx/source/config/mac/x64/vpx_dsp_rtcd.h: * Source/webrtc/sdk/WebKit/WebKitUtilities.h: * Source/webrtc/sdk/WebKit/WebKitUtilities.mm: (webrtc::createWebKitEncoderFactory): (webrtc::createWebKitDecoderFactory): * Source/webrtc/sdk/objc/Framework/Headers/WebRTC/RTCVideoCodecFactory.h: * libwebrtc.xcodeproj/project.pbxproj: Source/WebCore: Add a runtime flag to control activation of VP8 codec. Bind this runtime flag to the video codec factories. Test: webrtc/video-mute-vp8.html * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp: (WebCore::createLibWebRTCPeerConnectionBackend): * page/RuntimeEnabledFeatures.h: (WebCore::RuntimeEnabledFeatures::webRTCVP8CodecEnabled const): (WebCore::RuntimeEnabledFeatures::setWebRTCVP8CodecEnabled): * platform/mediastream/libwebrtc/LibWebRTCProvider.h: * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp: (WebCore::LibWebRTCProviderCocoa::createDecoderFactory): (WebCore::LibWebRTCProviderCocoa::createEncoderFactory): * testing/Internals.cpp: (WebCore::Internals::resetToConsistentState): Enable VP8 codec for tests. Source/WebKit: * Shared/WebPreferences.yaml: LayoutTests: * webrtc/audio-peer-connection-g722.html: * webrtc/routines.js: * webrtc/video-mute-vp8-expected.txt: Added. * webrtc/video-mute-vp8.html: Added. Canonical link: https://commits.webkit.org/205219@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236821 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-10-04 01:53:27 +00:00
function setCodec(sdp, codec)
{
return sdp.split('\r\n').filter(line => {
return line.indexOf('a=fmtp') === -1 && line.indexOf('a=rtcp-fb') === -1 && (line.indexOf('a=rtpmap') === -1 || line.indexOf(codec) !== -1);
}).join('\r\n');
}
async function getTypedStats(connection, type)
{
const report = await connection.getStats();
var stats;
report.forEach((statItem) => {
if (statItem.type === type)
stats = statItem;
});
return stats;
}
Safari doesn't apply frameRate limit when request stream from Camera https://bugs.webkit.org/show_bug.cgi?id=210186 <rdar://problem/61452794> Reviewed by Eric Carlson. Source/WebCore: Add support to RealtimeVideoSource to decimate the video samples based on the observed frame rate of its capture source. This allows supporting two tracks using the same capture device, one track being low frame rate and the other one high frame rate. Clean-up refactoring to make RealtimeVideoSource directly inherit from RealtimeVideoCaptureSource. Migrate size and format of frame adaptation from RealtimeVideoCaptureSource to RealtimeVideoSource. Fix mock capture source to update its frame rate when asked by applyConstraints. Tests: fast/mediastream/mediastreamtrack-video-frameRate-clone-decreasing.html fast/mediastream/mediastreamtrack-video-frameRate-clone-increasing.html fast/mediastream/mediastreamtrack-video-frameRate-decreasing.html fast/mediastream/mediastreamtrack-video-frameRate-increasing.html * platform/mediastream/RealtimeVideoCaptureSource.cpp: (WebCore::RealtimeVideoCaptureSource::dispatchMediaSampleToObservers): (WebCore::RealtimeVideoCaptureSource::clientUpdatedSizeAndFrameRate): * platform/mediastream/RealtimeVideoCaptureSource.h: (WebCore::RealtimeVideoCaptureSource::observedFrameRate const): * platform/mediastream/RealtimeVideoSource.cpp: (WebCore::RealtimeVideoSource::RealtimeVideoSource): (WebCore::m_source): (WebCore::RealtimeVideoSource::adaptVideoSample): (WebCore::RealtimeVideoSource::videoSampleAvailable): * platform/mediastream/RealtimeVideoSource.h: * platform/mock/MockRealtimeVideoSource.cpp: (WebCore::MockRealtimeVideoSource::setFrameRateWithPreset): * testing/Internals.cpp: (WebCore::Internals::observeMediaStreamTrack): LayoutTests: * fast/mediastream/mediastreamtrack-video-frameRate-clone-decreasing-expected.txt: Added. * fast/mediastream/mediastreamtrack-video-frameRate-clone-decreasing.html: Added. * fast/mediastream/mediastreamtrack-video-frameRate-clone-increasing-expected.txt: Added. * fast/mediastream/mediastreamtrack-video-frameRate-clone-increasing.html: Added. * fast/mediastream/mediastreamtrack-video-framerate-decreasing-expected.txt: added. * fast/mediastream/mediastreamtrack-video-framerate-decreasing.html: added. * fast/mediastream/mediastreamtrack-video-framerate-increasing-expected.txt: added. * fast/mediastream/mediastreamtrack-video-framerate-increasing.html: added. * webrtc/routines.js: Canonical link: https://commits.webkit.org/223624@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@260364 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-04-20 14:37:47 +00:00
function getReceivedTrackStats(connection)
{
return connection.getStats().then((report) => {
var stats;
report.forEach((statItem) => {
if (statItem.type === "track") {
stats = statItem;
}
});
return stats;
});
}
async function computeFrameRate(stream, video)
{
if (window.internals) {
internals.observeMediaStreamTrack(stream.getVideoTracks()[0]);
await new Promise(resolve => setTimeout(resolve, 1000));
return internals.trackVideoSampleCount;
}
let connection;
video.srcObject = await new Promise((resolve, reject) => {
createConnections((firstConnection) => {
firstConnection.addTrack(stream.getVideoTracks()[0], stream);
}, (secondConnection) => {
connection = secondConnection;
secondConnection.ontrack = (trackEvent) => {
resolve(trackEvent.streams[0]);
};
});
setTimeout(() => reject("Test timed out"), 5000);
});
await video.play();
const stats1 = await getReceivedTrackStats(connection);
await new Promise(resolve => setTimeout(resolve, 1000));
const stats2 = await getReceivedTrackStats(connection);
return (stats2.framesReceived - stats1.framesReceived) * 1000 / (stats2.timestamp - stats1.timestamp);
}
function setH264BaselineCodec(sdp)
{
const lines = sdp.split('\r\n');
const h264Lines = lines.filter(line => line.indexOf("a=fmtp") === 0 && line.indexOf("42e01f") !== -1);
const baselineNumber = h264Lines[0].substring(6).split(' ')[0];
return lines.filter(line => {
return (line.indexOf('a=fmtp') === -1 && line.indexOf('a=rtcp-fb') === -1 && line.indexOf('a=rtpmap') === -1) || line.indexOf(baselineNumber) !== -1;
}).join('\r\n');
}
function setH264HighCodec(sdp)
{
const lines = sdp.split('\r\n');
const h264Lines = lines.filter(line => line.indexOf("a=fmtp") === 0 && line.indexOf("640c1f") !== -1);
const baselineNumber = h264Lines[0].substring(6).split(' ')[0];
return lines.filter(line => {
return (line.indexOf('a=fmtp') === -1 && line.indexOf('a=rtcp-fb') === -1 && line.indexOf('a=rtpmap') === -1) || line.indexOf(baselineNumber) !== -1;
}).join('\r\n');
}