haikuwebkit/LayoutTests/webrtc/remove-track.html

101 lines
3.3 KiB
HTML
Raw Permalink Normal View History

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Testing basic video exchange from offerer to receiver</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
</head>
<body>
Introduce a C++ chain of operations in RTCPeerConnection https://bugs.webkit.org/show_bug.cgi?id=216006 Reviewed by Eric Carlson. LayoutTests/imported/w3c: * web-platform-tests/webrtc/RTCPeerConnection-addIceCandidate-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-addIceCandidate-timing.https-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-iceConnectionState.https-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-iceGatheringState-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-onnegotiationneeded-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-operations.https-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-perfect-negotiation.https-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-setLocalDescription-answer-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-setLocalDescription-offer-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-setLocalDescription-parameterless.https-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-setRemoteDescription-offer-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-setRemoteDescription-rollback-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-track-stats.https-expected.txt: * web-platform-tests/webrtc/RTCRtpTransceiver.https-expected.txt: * web-platform-tests/webrtc/idlharness.https.window-expected.txt: Source/WebCore: Remove RTCPeerConnection JS built-ins and introduce a C++ version. This allows to make replaceTrack part of the chain of operation. Also update setLocalDescription to take no parameters. Covered by rebased tests. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Headers.cmake: * Modules/mediastream/PeerConnectionBackend.cpp: (WebCore::PeerConnectionBackend::createOfferSucceeded): (WebCore::PeerConnectionBackend::createAnswerSucceeded): (WebCore::PeerConnectionBackend::setLocalDescription): (WebCore::PeerConnectionBackend::setRemoteDescription): (WebCore::PeerConnectionBackend::transceiverFromSender): Deleted. * Modules/mediastream/PeerConnectionBackend.h: * Modules/mediastream/RTCIceCandidate.cpp: (WebCore::RTCIceCandidate::create): * Modules/mediastream/RTCIceCandidate.h: * Modules/mediastream/RTCIceCandidate.idl: * Modules/mediastream/RTCPeerConnection.cpp: (WebCore::RTCPeerConnection::create): (WebCore::RTCPeerConnection::removeTrack): (WebCore::RTCPeerConnection::createOffer): (WebCore::RTCPeerConnection::createAnswer): (WebCore::RTCPeerConnection::setLocalDescription): (WebCore::RTCPeerConnection::setRemoteDescription): (WebCore::RTCPeerConnection::addIceCandidate): (WebCore::RTCPeerConnection::getStats): (WebCore::RTCPeerConnection::doClose): (WebCore::RTCPeerConnection::scheduleNegotiationNeededEvent): (WebCore::RTCPeerConnection::chainOperation): (WebCore::RTCPeerConnection::initializeWith): Deleted. (WebCore::RTCPeerConnection::queuedCreateOffer): Deleted. (WebCore::RTCPeerConnection::queuedCreateAnswer): Deleted. (WebCore::RTCPeerConnection::queuedSetLocalDescription): Deleted. (WebCore::RTCPeerConnection::queuedSetRemoteDescription): Deleted. (WebCore::RTCPeerConnection::queuedAddIceCandidate): Deleted. * Modules/mediastream/RTCPeerConnection.h: * Modules/mediastream/RTCPeerConnection.idl: * Modules/mediastream/RTCPeerConnection.js: Removed. * Modules/mediastream/RTCPeerConnectionInternals.js: Removed. * Modules/mediastream/RTCRtpSender.cpp: (WebCore::RTCRtpSender::create): (WebCore::RTCRtpSender::RTCRtpSender): (WebCore::RTCRtpSender::replaceTrack): (WebCore::RTCRtpSender::isCreatedBy const): (WebCore::RTCRtpSender::dtmf): (WebCore::RTCRtpSender::currentTransceiverDirection const): * Modules/mediastream/RTCRtpSender.h: * Modules/mediastream/RTCRtpSender.idl: * Modules/mediastream/RTCRtpSenderBackend.h: * Modules/mediastream/RTCSessionDescription.cpp: (WebCore::RTCSessionDescription::create): * Modules/mediastream/RTCSessionDescription.h: * Modules/mediastream/RTCSessionDescription.idl: * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: (WebCore::LibWebRTCMediaEndpoint::doSetLocalDescription): (WebCore::LibWebRTCMediaEndpoint::doSetRemoteDescription): * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h: * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp: (WebCore::LibWebRTCPeerConnectionBackend::doSetLocalDescription): (WebCore::LibWebRTCPeerConnectionBackend::doSetRemoteDescription): (WebCore::LibWebRTCPeerConnectionBackend::addTrack): (WebCore::LibWebRTCPeerConnectionBackend::addTransceiverFromTrackOrKind): (WebCore::LibWebRTCPeerConnectionBackend::newRemoteTransceiver): * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h: * Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp: (WebCore::LibWebRTCRtpSenderBackend::replaceTrack): * Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.h: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: LayoutTests: * fast/mediastream/RTCIceCandidate-expected.txt: * fast/mediastream/RTCPeerConnection-addIceCandidate-expected.txt: * fast/mediastream/RTCPeerConnection-media-setup-single-dialog-expected.txt: * fast/mediastream/RTCPeerConnection-remotely-assigned-transceiver-mid-expected.txt: * webrtc/libwebrtc/release-while-creating-offer-expected.txt: * webrtc/remove-track-expected.txt: * webrtc/remove-track.html: Make sure we are in a stable state before going to removeTrack actual test. Also make sure to call setRemoteDescription for second test. Canonical link: https://commits.webkit.org/228873@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266468 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-02 16:19:52 +00:00
<video id="video" autoplay></video>
<script src ="routines.js"></script>
<script>
let firstConnection, secondConnection;
let stream;
let remoteAudioTrack, remoteVideoTrack;
promise_test(async (test) => {
if (window.testRunner)
testRunner.setUserMediaPermission(true);
stream = await navigator.mediaDevices.getUserMedia({ video: true, audio: true });
Introduce a C++ chain of operations in RTCPeerConnection https://bugs.webkit.org/show_bug.cgi?id=216006 Reviewed by Eric Carlson. LayoutTests/imported/w3c: * web-platform-tests/webrtc/RTCPeerConnection-addIceCandidate-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-addIceCandidate-timing.https-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-iceConnectionState.https-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-iceGatheringState-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-onnegotiationneeded-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-operations.https-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-perfect-negotiation.https-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-setLocalDescription-answer-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-setLocalDescription-offer-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-setLocalDescription-parameterless.https-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-setRemoteDescription-offer-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-setRemoteDescription-rollback-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-track-stats.https-expected.txt: * web-platform-tests/webrtc/RTCRtpTransceiver.https-expected.txt: * web-platform-tests/webrtc/idlharness.https.window-expected.txt: Source/WebCore: Remove RTCPeerConnection JS built-ins and introduce a C++ version. This allows to make replaceTrack part of the chain of operation. Also update setLocalDescription to take no parameters. Covered by rebased tests. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Headers.cmake: * Modules/mediastream/PeerConnectionBackend.cpp: (WebCore::PeerConnectionBackend::createOfferSucceeded): (WebCore::PeerConnectionBackend::createAnswerSucceeded): (WebCore::PeerConnectionBackend::setLocalDescription): (WebCore::PeerConnectionBackend::setRemoteDescription): (WebCore::PeerConnectionBackend::transceiverFromSender): Deleted. * Modules/mediastream/PeerConnectionBackend.h: * Modules/mediastream/RTCIceCandidate.cpp: (WebCore::RTCIceCandidate::create): * Modules/mediastream/RTCIceCandidate.h: * Modules/mediastream/RTCIceCandidate.idl: * Modules/mediastream/RTCPeerConnection.cpp: (WebCore::RTCPeerConnection::create): (WebCore::RTCPeerConnection::removeTrack): (WebCore::RTCPeerConnection::createOffer): (WebCore::RTCPeerConnection::createAnswer): (WebCore::RTCPeerConnection::setLocalDescription): (WebCore::RTCPeerConnection::setRemoteDescription): (WebCore::RTCPeerConnection::addIceCandidate): (WebCore::RTCPeerConnection::getStats): (WebCore::RTCPeerConnection::doClose): (WebCore::RTCPeerConnection::scheduleNegotiationNeededEvent): (WebCore::RTCPeerConnection::chainOperation): (WebCore::RTCPeerConnection::initializeWith): Deleted. (WebCore::RTCPeerConnection::queuedCreateOffer): Deleted. (WebCore::RTCPeerConnection::queuedCreateAnswer): Deleted. (WebCore::RTCPeerConnection::queuedSetLocalDescription): Deleted. (WebCore::RTCPeerConnection::queuedSetRemoteDescription): Deleted. (WebCore::RTCPeerConnection::queuedAddIceCandidate): Deleted. * Modules/mediastream/RTCPeerConnection.h: * Modules/mediastream/RTCPeerConnection.idl: * Modules/mediastream/RTCPeerConnection.js: Removed. * Modules/mediastream/RTCPeerConnectionInternals.js: Removed. * Modules/mediastream/RTCRtpSender.cpp: (WebCore::RTCRtpSender::create): (WebCore::RTCRtpSender::RTCRtpSender): (WebCore::RTCRtpSender::replaceTrack): (WebCore::RTCRtpSender::isCreatedBy const): (WebCore::RTCRtpSender::dtmf): (WebCore::RTCRtpSender::currentTransceiverDirection const): * Modules/mediastream/RTCRtpSender.h: * Modules/mediastream/RTCRtpSender.idl: * Modules/mediastream/RTCRtpSenderBackend.h: * Modules/mediastream/RTCSessionDescription.cpp: (WebCore::RTCSessionDescription::create): * Modules/mediastream/RTCSessionDescription.h: * Modules/mediastream/RTCSessionDescription.idl: * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: (WebCore::LibWebRTCMediaEndpoint::doSetLocalDescription): (WebCore::LibWebRTCMediaEndpoint::doSetRemoteDescription): * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h: * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp: (WebCore::LibWebRTCPeerConnectionBackend::doSetLocalDescription): (WebCore::LibWebRTCPeerConnectionBackend::doSetRemoteDescription): (WebCore::LibWebRTCPeerConnectionBackend::addTrack): (WebCore::LibWebRTCPeerConnectionBackend::addTransceiverFromTrackOrKind): (WebCore::LibWebRTCPeerConnectionBackend::newRemoteTransceiver): * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h: * Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp: (WebCore::LibWebRTCRtpSenderBackend::replaceTrack): * Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.h: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: LayoutTests: * fast/mediastream/RTCIceCandidate-expected.txt: * fast/mediastream/RTCPeerConnection-addIceCandidate-expected.txt: * fast/mediastream/RTCPeerConnection-media-setup-single-dialog-expected.txt: * fast/mediastream/RTCPeerConnection-remotely-assigned-transceiver-mid-expected.txt: * webrtc/libwebrtc/release-while-creating-offer-expected.txt: * webrtc/remove-track-expected.txt: * webrtc/remove-track.html: Make sure we are in a stable state before going to removeTrack actual test. Also make sure to call setRemoteDescription for second test. Canonical link: https://commits.webkit.org/228873@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266468 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-02 16:19:52 +00:00
const remoteStream = await new Promise((resolve, reject) => {
createConnections((connection) => {
firstConnection = connection;
firstConnection.addTrack(stream.getVideoTracks()[0], stream);
firstConnection.addTrack(stream.getAudioTracks()[0], stream);
}, (connection) => {
secondConnection = connection;
secondConnection.ontrack = (trackEvent) => {
if (!remoteVideoTrack) {
remoteVideoTrack = trackEvent.track;
return;
}
remoteAudioTrack = trackEvent.track;
Introduce a C++ chain of operations in RTCPeerConnection https://bugs.webkit.org/show_bug.cgi?id=216006 Reviewed by Eric Carlson. LayoutTests/imported/w3c: * web-platform-tests/webrtc/RTCPeerConnection-addIceCandidate-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-addIceCandidate-timing.https-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-iceConnectionState.https-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-iceGatheringState-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-onnegotiationneeded-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-operations.https-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-perfect-negotiation.https-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-setLocalDescription-answer-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-setLocalDescription-offer-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-setLocalDescription-parameterless.https-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-setRemoteDescription-offer-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-setRemoteDescription-rollback-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-track-stats.https-expected.txt: * web-platform-tests/webrtc/RTCRtpTransceiver.https-expected.txt: * web-platform-tests/webrtc/idlharness.https.window-expected.txt: Source/WebCore: Remove RTCPeerConnection JS built-ins and introduce a C++ version. This allows to make replaceTrack part of the chain of operation. Also update setLocalDescription to take no parameters. Covered by rebased tests. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Headers.cmake: * Modules/mediastream/PeerConnectionBackend.cpp: (WebCore::PeerConnectionBackend::createOfferSucceeded): (WebCore::PeerConnectionBackend::createAnswerSucceeded): (WebCore::PeerConnectionBackend::setLocalDescription): (WebCore::PeerConnectionBackend::setRemoteDescription): (WebCore::PeerConnectionBackend::transceiverFromSender): Deleted. * Modules/mediastream/PeerConnectionBackend.h: * Modules/mediastream/RTCIceCandidate.cpp: (WebCore::RTCIceCandidate::create): * Modules/mediastream/RTCIceCandidate.h: * Modules/mediastream/RTCIceCandidate.idl: * Modules/mediastream/RTCPeerConnection.cpp: (WebCore::RTCPeerConnection::create): (WebCore::RTCPeerConnection::removeTrack): (WebCore::RTCPeerConnection::createOffer): (WebCore::RTCPeerConnection::createAnswer): (WebCore::RTCPeerConnection::setLocalDescription): (WebCore::RTCPeerConnection::setRemoteDescription): (WebCore::RTCPeerConnection::addIceCandidate): (WebCore::RTCPeerConnection::getStats): (WebCore::RTCPeerConnection::doClose): (WebCore::RTCPeerConnection::scheduleNegotiationNeededEvent): (WebCore::RTCPeerConnection::chainOperation): (WebCore::RTCPeerConnection::initializeWith): Deleted. (WebCore::RTCPeerConnection::queuedCreateOffer): Deleted. (WebCore::RTCPeerConnection::queuedCreateAnswer): Deleted. (WebCore::RTCPeerConnection::queuedSetLocalDescription): Deleted. (WebCore::RTCPeerConnection::queuedSetRemoteDescription): Deleted. (WebCore::RTCPeerConnection::queuedAddIceCandidate): Deleted. * Modules/mediastream/RTCPeerConnection.h: * Modules/mediastream/RTCPeerConnection.idl: * Modules/mediastream/RTCPeerConnection.js: Removed. * Modules/mediastream/RTCPeerConnectionInternals.js: Removed. * Modules/mediastream/RTCRtpSender.cpp: (WebCore::RTCRtpSender::create): (WebCore::RTCRtpSender::RTCRtpSender): (WebCore::RTCRtpSender::replaceTrack): (WebCore::RTCRtpSender::isCreatedBy const): (WebCore::RTCRtpSender::dtmf): (WebCore::RTCRtpSender::currentTransceiverDirection const): * Modules/mediastream/RTCRtpSender.h: * Modules/mediastream/RTCRtpSender.idl: * Modules/mediastream/RTCRtpSenderBackend.h: * Modules/mediastream/RTCSessionDescription.cpp: (WebCore::RTCSessionDescription::create): * Modules/mediastream/RTCSessionDescription.h: * Modules/mediastream/RTCSessionDescription.idl: * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: (WebCore::LibWebRTCMediaEndpoint::doSetLocalDescription): (WebCore::LibWebRTCMediaEndpoint::doSetRemoteDescription): * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h: * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp: (WebCore::LibWebRTCPeerConnectionBackend::doSetLocalDescription): (WebCore::LibWebRTCPeerConnectionBackend::doSetRemoteDescription): (WebCore::LibWebRTCPeerConnectionBackend::addTrack): (WebCore::LibWebRTCPeerConnectionBackend::addTransceiverFromTrackOrKind): (WebCore::LibWebRTCPeerConnectionBackend::newRemoteTransceiver): * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h: * Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp: (WebCore::LibWebRTCRtpSenderBackend::replaceTrack): * Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.h: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: LayoutTests: * fast/mediastream/RTCIceCandidate-expected.txt: * fast/mediastream/RTCPeerConnection-addIceCandidate-expected.txt: * fast/mediastream/RTCPeerConnection-media-setup-single-dialog-expected.txt: * fast/mediastream/RTCPeerConnection-remotely-assigned-transceiver-mid-expected.txt: * webrtc/libwebrtc/release-while-creating-offer-expected.txt: * webrtc/remove-track-expected.txt: * webrtc/remove-track.html: Make sure we are in a stable state before going to removeTrack actual test. Also make sure to call setRemoteDescription for second test. Canonical link: https://commits.webkit.org/228873@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266468 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-02 16:19:52 +00:00
resolve(trackEvent.streams[0]);
};
});
setTimeout(() => reject("Test timed out"), 5000);
});
Introduce a C++ chain of operations in RTCPeerConnection https://bugs.webkit.org/show_bug.cgi?id=216006 Reviewed by Eric Carlson. LayoutTests/imported/w3c: * web-platform-tests/webrtc/RTCPeerConnection-addIceCandidate-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-addIceCandidate-timing.https-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-iceConnectionState.https-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-iceGatheringState-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-onnegotiationneeded-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-operations.https-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-perfect-negotiation.https-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-setLocalDescription-answer-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-setLocalDescription-offer-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-setLocalDescription-parameterless.https-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-setRemoteDescription-offer-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-setRemoteDescription-rollback-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-track-stats.https-expected.txt: * web-platform-tests/webrtc/RTCRtpTransceiver.https-expected.txt: * web-platform-tests/webrtc/idlharness.https.window-expected.txt: Source/WebCore: Remove RTCPeerConnection JS built-ins and introduce a C++ version. This allows to make replaceTrack part of the chain of operation. Also update setLocalDescription to take no parameters. Covered by rebased tests. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Headers.cmake: * Modules/mediastream/PeerConnectionBackend.cpp: (WebCore::PeerConnectionBackend::createOfferSucceeded): (WebCore::PeerConnectionBackend::createAnswerSucceeded): (WebCore::PeerConnectionBackend::setLocalDescription): (WebCore::PeerConnectionBackend::setRemoteDescription): (WebCore::PeerConnectionBackend::transceiverFromSender): Deleted. * Modules/mediastream/PeerConnectionBackend.h: * Modules/mediastream/RTCIceCandidate.cpp: (WebCore::RTCIceCandidate::create): * Modules/mediastream/RTCIceCandidate.h: * Modules/mediastream/RTCIceCandidate.idl: * Modules/mediastream/RTCPeerConnection.cpp: (WebCore::RTCPeerConnection::create): (WebCore::RTCPeerConnection::removeTrack): (WebCore::RTCPeerConnection::createOffer): (WebCore::RTCPeerConnection::createAnswer): (WebCore::RTCPeerConnection::setLocalDescription): (WebCore::RTCPeerConnection::setRemoteDescription): (WebCore::RTCPeerConnection::addIceCandidate): (WebCore::RTCPeerConnection::getStats): (WebCore::RTCPeerConnection::doClose): (WebCore::RTCPeerConnection::scheduleNegotiationNeededEvent): (WebCore::RTCPeerConnection::chainOperation): (WebCore::RTCPeerConnection::initializeWith): Deleted. (WebCore::RTCPeerConnection::queuedCreateOffer): Deleted. (WebCore::RTCPeerConnection::queuedCreateAnswer): Deleted. (WebCore::RTCPeerConnection::queuedSetLocalDescription): Deleted. (WebCore::RTCPeerConnection::queuedSetRemoteDescription): Deleted. (WebCore::RTCPeerConnection::queuedAddIceCandidate): Deleted. * Modules/mediastream/RTCPeerConnection.h: * Modules/mediastream/RTCPeerConnection.idl: * Modules/mediastream/RTCPeerConnection.js: Removed. * Modules/mediastream/RTCPeerConnectionInternals.js: Removed. * Modules/mediastream/RTCRtpSender.cpp: (WebCore::RTCRtpSender::create): (WebCore::RTCRtpSender::RTCRtpSender): (WebCore::RTCRtpSender::replaceTrack): (WebCore::RTCRtpSender::isCreatedBy const): (WebCore::RTCRtpSender::dtmf): (WebCore::RTCRtpSender::currentTransceiverDirection const): * Modules/mediastream/RTCRtpSender.h: * Modules/mediastream/RTCRtpSender.idl: * Modules/mediastream/RTCRtpSenderBackend.h: * Modules/mediastream/RTCSessionDescription.cpp: (WebCore::RTCSessionDescription::create): * Modules/mediastream/RTCSessionDescription.h: * Modules/mediastream/RTCSessionDescription.idl: * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: (WebCore::LibWebRTCMediaEndpoint::doSetLocalDescription): (WebCore::LibWebRTCMediaEndpoint::doSetRemoteDescription): * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h: * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp: (WebCore::LibWebRTCPeerConnectionBackend::doSetLocalDescription): (WebCore::LibWebRTCPeerConnectionBackend::doSetRemoteDescription): (WebCore::LibWebRTCPeerConnectionBackend::addTrack): (WebCore::LibWebRTCPeerConnectionBackend::addTransceiverFromTrackOrKind): (WebCore::LibWebRTCPeerConnectionBackend::newRemoteTransceiver): * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h: * Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp: (WebCore::LibWebRTCRtpSenderBackend::replaceTrack): * Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.h: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: LayoutTests: * fast/mediastream/RTCIceCandidate-expected.txt: * fast/mediastream/RTCPeerConnection-addIceCandidate-expected.txt: * fast/mediastream/RTCPeerConnection-media-setup-single-dialog-expected.txt: * fast/mediastream/RTCPeerConnection-remotely-assigned-transceiver-mid-expected.txt: * webrtc/libwebrtc/release-while-creating-offer-expected.txt: * webrtc/remove-track-expected.txt: * webrtc/remove-track.html: Make sure we are in a stable state before going to removeTrack actual test. Also make sure to call setRemoteDescription for second test. Canonical link: https://commits.webkit.org/228873@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266468 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-02 16:19:52 +00:00
video.srcObject = remoteStream;
await video.play();
}, "Setup audio video exchange");
async function renegotiate()
{
let d = await firstConnection.createOffer();
await firstConnection.setLocalDescription(d);
RealtimeOutgoing A/V sources should observe their sources only if having a sink https://bugs.webkit.org/show_bug.cgi?id=191490 Reviewed by Eric Carlson. Source/WebCore: Observe the source that generates media based on the sinks: - Do not observe at creation time - For first sink, start observing - When no more sink, stop observing Apply this principle for both outgoing audio and video sources. Add locks for the sinks to ensure thread-safety. Make sinks HashSet which is more robust. Do some refactoring to better isolate generic outgoing sources from Cocoa/GTK implementations. Covered by existing tests and updated webrtc/remove-track.html. * platform/mediastream/RealtimeOutgoingAudioSource.cpp: (WebCore::RealtimeOutgoingAudioSource::~RealtimeOutgoingAudioSource): (WebCore::RealtimeOutgoingAudioSource::stop): (WebCore::RealtimeOutgoingAudioSource::AddSink): (WebCore::RealtimeOutgoingAudioSource::RemoveSink): (WebCore::RealtimeOutgoingAudioSource::sendAudioFrames): * platform/mediastream/RealtimeOutgoingAudioSource.h: * platform/mediastream/RealtimeOutgoingVideoSource.cpp: (WebCore::RealtimeOutgoingVideoSource::RealtimeOutgoingVideoSource): (WebCore::RealtimeOutgoingVideoSource::~RealtimeOutgoingVideoSource): (WebCore::RealtimeOutgoingVideoSource::observeSource): (WebCore::RealtimeOutgoingVideoSource::setSource): (WebCore::RealtimeOutgoingVideoSource::stop): (WebCore::RealtimeOutgoingVideoSource::AddOrUpdateSink): (WebCore::RealtimeOutgoingVideoSource::RemoveSink): * platform/mediastream/RealtimeOutgoingVideoSource.h: (WebCore::RealtimeOutgoingVideoSource::isSilenced const): * platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.cpp: (WebCore::RealtimeOutgoingAudioSourceLibWebRTC::pullAudioData): * platform/mediastream/mac/RealtimeOutgoingAudioSourceCocoa.cpp: (WebCore::RealtimeOutgoingAudioSourceCocoa::RealtimeOutgoingAudioSourceCocoa): (WebCore::RealtimeOutgoingAudioSourceCocoa::audioSamplesAvailable): (WebCore::RealtimeOutgoingAudioSourceCocoa::pullAudioData): * platform/mediastream/mac/RealtimeOutgoingAudioSourceCocoa.h: * platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp: (WebCore::RealtimeOutgoingVideoSourceCocoa::sampleBufferUpdated): LayoutTests: * webrtc/remove-track-expected.txt: * webrtc/remove-track.html: Add tests and fixed some flakiness issues on existing tests in the file. Canonical link: https://commits.webkit.org/206313@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@238102 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-11-12 19:49:13 +00:00
await secondConnection.setRemoteDescription(d);
d = await secondConnection.createAnswer();
await secondConnection.setLocalDescription(d);
Introduce a C++ chain of operations in RTCPeerConnection https://bugs.webkit.org/show_bug.cgi?id=216006 Reviewed by Eric Carlson. LayoutTests/imported/w3c: * web-platform-tests/webrtc/RTCPeerConnection-addIceCandidate-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-addIceCandidate-timing.https-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-iceConnectionState.https-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-iceGatheringState-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-onnegotiationneeded-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-operations.https-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-perfect-negotiation.https-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-setLocalDescription-answer-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-setLocalDescription-offer-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-setLocalDescription-parameterless.https-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-setRemoteDescription-offer-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-setRemoteDescription-rollback-expected.txt: * web-platform-tests/webrtc/RTCPeerConnection-track-stats.https-expected.txt: * web-platform-tests/webrtc/RTCRtpTransceiver.https-expected.txt: * web-platform-tests/webrtc/idlharness.https.window-expected.txt: Source/WebCore: Remove RTCPeerConnection JS built-ins and introduce a C++ version. This allows to make replaceTrack part of the chain of operation. Also update setLocalDescription to take no parameters. Covered by rebased tests. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Headers.cmake: * Modules/mediastream/PeerConnectionBackend.cpp: (WebCore::PeerConnectionBackend::createOfferSucceeded): (WebCore::PeerConnectionBackend::createAnswerSucceeded): (WebCore::PeerConnectionBackend::setLocalDescription): (WebCore::PeerConnectionBackend::setRemoteDescription): (WebCore::PeerConnectionBackend::transceiverFromSender): Deleted. * Modules/mediastream/PeerConnectionBackend.h: * Modules/mediastream/RTCIceCandidate.cpp: (WebCore::RTCIceCandidate::create): * Modules/mediastream/RTCIceCandidate.h: * Modules/mediastream/RTCIceCandidate.idl: * Modules/mediastream/RTCPeerConnection.cpp: (WebCore::RTCPeerConnection::create): (WebCore::RTCPeerConnection::removeTrack): (WebCore::RTCPeerConnection::createOffer): (WebCore::RTCPeerConnection::createAnswer): (WebCore::RTCPeerConnection::setLocalDescription): (WebCore::RTCPeerConnection::setRemoteDescription): (WebCore::RTCPeerConnection::addIceCandidate): (WebCore::RTCPeerConnection::getStats): (WebCore::RTCPeerConnection::doClose): (WebCore::RTCPeerConnection::scheduleNegotiationNeededEvent): (WebCore::RTCPeerConnection::chainOperation): (WebCore::RTCPeerConnection::initializeWith): Deleted. (WebCore::RTCPeerConnection::queuedCreateOffer): Deleted. (WebCore::RTCPeerConnection::queuedCreateAnswer): Deleted. (WebCore::RTCPeerConnection::queuedSetLocalDescription): Deleted. (WebCore::RTCPeerConnection::queuedSetRemoteDescription): Deleted. (WebCore::RTCPeerConnection::queuedAddIceCandidate): Deleted. * Modules/mediastream/RTCPeerConnection.h: * Modules/mediastream/RTCPeerConnection.idl: * Modules/mediastream/RTCPeerConnection.js: Removed. * Modules/mediastream/RTCPeerConnectionInternals.js: Removed. * Modules/mediastream/RTCRtpSender.cpp: (WebCore::RTCRtpSender::create): (WebCore::RTCRtpSender::RTCRtpSender): (WebCore::RTCRtpSender::replaceTrack): (WebCore::RTCRtpSender::isCreatedBy const): (WebCore::RTCRtpSender::dtmf): (WebCore::RTCRtpSender::currentTransceiverDirection const): * Modules/mediastream/RTCRtpSender.h: * Modules/mediastream/RTCRtpSender.idl: * Modules/mediastream/RTCRtpSenderBackend.h: * Modules/mediastream/RTCSessionDescription.cpp: (WebCore::RTCSessionDescription::create): * Modules/mediastream/RTCSessionDescription.h: * Modules/mediastream/RTCSessionDescription.idl: * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: (WebCore::LibWebRTCMediaEndpoint::doSetLocalDescription): (WebCore::LibWebRTCMediaEndpoint::doSetRemoteDescription): * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h: * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp: (WebCore::LibWebRTCPeerConnectionBackend::doSetLocalDescription): (WebCore::LibWebRTCPeerConnectionBackend::doSetRemoteDescription): (WebCore::LibWebRTCPeerConnectionBackend::addTrack): (WebCore::LibWebRTCPeerConnectionBackend::addTransceiverFromTrackOrKind): (WebCore::LibWebRTCPeerConnectionBackend::newRemoteTransceiver): * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h: * Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp: (WebCore::LibWebRTCRtpSenderBackend::replaceTrack): * Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.h: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: LayoutTests: * fast/mediastream/RTCIceCandidate-expected.txt: * fast/mediastream/RTCPeerConnection-addIceCandidate-expected.txt: * fast/mediastream/RTCPeerConnection-media-setup-single-dialog-expected.txt: * fast/mediastream/RTCPeerConnection-remotely-assigned-transceiver-mid-expected.txt: * webrtc/libwebrtc/release-while-creating-offer-expected.txt: * webrtc/remove-track-expected.txt: * webrtc/remove-track.html: Make sure we are in a stable state before going to removeTrack actual test. Also make sure to call setRemoteDescription for second test. Canonical link: https://commits.webkit.org/228873@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266468 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-02 16:19:52 +00:00
await firstConnection.setRemoteDescription(d);
}
promise_test((test) => {
const promise = new Promise((resolve, reject) => {
remoteVideoTrack.onmute = resolve;
setTimeout(() => reject("Test timed out"), 5000);
});
RealtimeOutgoing A/V sources should observe their sources only if having a sink https://bugs.webkit.org/show_bug.cgi?id=191490 Reviewed by Eric Carlson. Source/WebCore: Observe the source that generates media based on the sinks: - Do not observe at creation time - For first sink, start observing - When no more sink, stop observing Apply this principle for both outgoing audio and video sources. Add locks for the sinks to ensure thread-safety. Make sinks HashSet which is more robust. Do some refactoring to better isolate generic outgoing sources from Cocoa/GTK implementations. Covered by existing tests and updated webrtc/remove-track.html. * platform/mediastream/RealtimeOutgoingAudioSource.cpp: (WebCore::RealtimeOutgoingAudioSource::~RealtimeOutgoingAudioSource): (WebCore::RealtimeOutgoingAudioSource::stop): (WebCore::RealtimeOutgoingAudioSource::AddSink): (WebCore::RealtimeOutgoingAudioSource::RemoveSink): (WebCore::RealtimeOutgoingAudioSource::sendAudioFrames): * platform/mediastream/RealtimeOutgoingAudioSource.h: * platform/mediastream/RealtimeOutgoingVideoSource.cpp: (WebCore::RealtimeOutgoingVideoSource::RealtimeOutgoingVideoSource): (WebCore::RealtimeOutgoingVideoSource::~RealtimeOutgoingVideoSource): (WebCore::RealtimeOutgoingVideoSource::observeSource): (WebCore::RealtimeOutgoingVideoSource::setSource): (WebCore::RealtimeOutgoingVideoSource::stop): (WebCore::RealtimeOutgoingVideoSource::AddOrUpdateSink): (WebCore::RealtimeOutgoingVideoSource::RemoveSink): * platform/mediastream/RealtimeOutgoingVideoSource.h: (WebCore::RealtimeOutgoingVideoSource::isSilenced const): * platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.cpp: (WebCore::RealtimeOutgoingAudioSourceLibWebRTC::pullAudioData): * platform/mediastream/mac/RealtimeOutgoingAudioSourceCocoa.cpp: (WebCore::RealtimeOutgoingAudioSourceCocoa::RealtimeOutgoingAudioSourceCocoa): (WebCore::RealtimeOutgoingAudioSourceCocoa::audioSamplesAvailable): (WebCore::RealtimeOutgoingAudioSourceCocoa::pullAudioData): * platform/mediastream/mac/RealtimeOutgoingAudioSourceCocoa.h: * platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp: (WebCore::RealtimeOutgoingVideoSourceCocoa::sampleBufferUpdated): LayoutTests: * webrtc/remove-track-expected.txt: * webrtc/remove-track.html: Add tests and fixed some flakiness issues on existing tests in the file. Canonical link: https://commits.webkit.org/206313@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@238102 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-11-12 19:49:13 +00:00
firstConnection.removeTrack(firstConnection.getSenders()[0]);
RealtimeOutgoing A/V sources should observe their sources only if having a sink https://bugs.webkit.org/show_bug.cgi?id=191490 Reviewed by Eric Carlson. Source/WebCore: Observe the source that generates media based on the sinks: - Do not observe at creation time - For first sink, start observing - When no more sink, stop observing Apply this principle for both outgoing audio and video sources. Add locks for the sinks to ensure thread-safety. Make sinks HashSet which is more robust. Do some refactoring to better isolate generic outgoing sources from Cocoa/GTK implementations. Covered by existing tests and updated webrtc/remove-track.html. * platform/mediastream/RealtimeOutgoingAudioSource.cpp: (WebCore::RealtimeOutgoingAudioSource::~RealtimeOutgoingAudioSource): (WebCore::RealtimeOutgoingAudioSource::stop): (WebCore::RealtimeOutgoingAudioSource::AddSink): (WebCore::RealtimeOutgoingAudioSource::RemoveSink): (WebCore::RealtimeOutgoingAudioSource::sendAudioFrames): * platform/mediastream/RealtimeOutgoingAudioSource.h: * platform/mediastream/RealtimeOutgoingVideoSource.cpp: (WebCore::RealtimeOutgoingVideoSource::RealtimeOutgoingVideoSource): (WebCore::RealtimeOutgoingVideoSource::~RealtimeOutgoingVideoSource): (WebCore::RealtimeOutgoingVideoSource::observeSource): (WebCore::RealtimeOutgoingVideoSource::setSource): (WebCore::RealtimeOutgoingVideoSource::stop): (WebCore::RealtimeOutgoingVideoSource::AddOrUpdateSink): (WebCore::RealtimeOutgoingVideoSource::RemoveSink): * platform/mediastream/RealtimeOutgoingVideoSource.h: (WebCore::RealtimeOutgoingVideoSource::isSilenced const): * platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.cpp: (WebCore::RealtimeOutgoingAudioSourceLibWebRTC::pullAudioData): * platform/mediastream/mac/RealtimeOutgoingAudioSourceCocoa.cpp: (WebCore::RealtimeOutgoingAudioSourceCocoa::RealtimeOutgoingAudioSourceCocoa): (WebCore::RealtimeOutgoingAudioSourceCocoa::audioSamplesAvailable): (WebCore::RealtimeOutgoingAudioSourceCocoa::pullAudioData): * platform/mediastream/mac/RealtimeOutgoingAudioSourceCocoa.h: * platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp: (WebCore::RealtimeOutgoingVideoSourceCocoa::sampleBufferUpdated): LayoutTests: * webrtc/remove-track-expected.txt: * webrtc/remove-track.html: Add tests and fixed some flakiness issues on existing tests in the file. Canonical link: https://commits.webkit.org/206313@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@238102 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-11-12 19:49:13 +00:00
const promise2 = renegotiate();
return Promise.all([promise, promise2]);
}, "Remove video track");
promise_test((test) => {
const promise = new Promise((resolve, reject) => {
remoteAudioTrack.onmute = resolve;
setTimeout(() => reject("Test timed out"), 5000);
});
RealtimeOutgoing A/V sources should observe their sources only if having a sink https://bugs.webkit.org/show_bug.cgi?id=191490 Reviewed by Eric Carlson. Source/WebCore: Observe the source that generates media based on the sinks: - Do not observe at creation time - For first sink, start observing - When no more sink, stop observing Apply this principle for both outgoing audio and video sources. Add locks for the sinks to ensure thread-safety. Make sinks HashSet which is more robust. Do some refactoring to better isolate generic outgoing sources from Cocoa/GTK implementations. Covered by existing tests and updated webrtc/remove-track.html. * platform/mediastream/RealtimeOutgoingAudioSource.cpp: (WebCore::RealtimeOutgoingAudioSource::~RealtimeOutgoingAudioSource): (WebCore::RealtimeOutgoingAudioSource::stop): (WebCore::RealtimeOutgoingAudioSource::AddSink): (WebCore::RealtimeOutgoingAudioSource::RemoveSink): (WebCore::RealtimeOutgoingAudioSource::sendAudioFrames): * platform/mediastream/RealtimeOutgoingAudioSource.h: * platform/mediastream/RealtimeOutgoingVideoSource.cpp: (WebCore::RealtimeOutgoingVideoSource::RealtimeOutgoingVideoSource): (WebCore::RealtimeOutgoingVideoSource::~RealtimeOutgoingVideoSource): (WebCore::RealtimeOutgoingVideoSource::observeSource): (WebCore::RealtimeOutgoingVideoSource::setSource): (WebCore::RealtimeOutgoingVideoSource::stop): (WebCore::RealtimeOutgoingVideoSource::AddOrUpdateSink): (WebCore::RealtimeOutgoingVideoSource::RemoveSink): * platform/mediastream/RealtimeOutgoingVideoSource.h: (WebCore::RealtimeOutgoingVideoSource::isSilenced const): * platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.cpp: (WebCore::RealtimeOutgoingAudioSourceLibWebRTC::pullAudioData): * platform/mediastream/mac/RealtimeOutgoingAudioSourceCocoa.cpp: (WebCore::RealtimeOutgoingAudioSourceCocoa::RealtimeOutgoingAudioSourceCocoa): (WebCore::RealtimeOutgoingAudioSourceCocoa::audioSamplesAvailable): (WebCore::RealtimeOutgoingAudioSourceCocoa::pullAudioData): * platform/mediastream/mac/RealtimeOutgoingAudioSourceCocoa.h: * platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp: (WebCore::RealtimeOutgoingVideoSourceCocoa::sampleBufferUpdated): LayoutTests: * webrtc/remove-track-expected.txt: * webrtc/remove-track.html: Add tests and fixed some flakiness issues on existing tests in the file. Canonical link: https://commits.webkit.org/206313@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@238102 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-11-12 19:49:13 +00:00
firstConnection.removeTrack(firstConnection.getSenders()[1]);
RealtimeOutgoing A/V sources should observe their sources only if having a sink https://bugs.webkit.org/show_bug.cgi?id=191490 Reviewed by Eric Carlson. Source/WebCore: Observe the source that generates media based on the sinks: - Do not observe at creation time - For first sink, start observing - When no more sink, stop observing Apply this principle for both outgoing audio and video sources. Add locks for the sinks to ensure thread-safety. Make sinks HashSet which is more robust. Do some refactoring to better isolate generic outgoing sources from Cocoa/GTK implementations. Covered by existing tests and updated webrtc/remove-track.html. * platform/mediastream/RealtimeOutgoingAudioSource.cpp: (WebCore::RealtimeOutgoingAudioSource::~RealtimeOutgoingAudioSource): (WebCore::RealtimeOutgoingAudioSource::stop): (WebCore::RealtimeOutgoingAudioSource::AddSink): (WebCore::RealtimeOutgoingAudioSource::RemoveSink): (WebCore::RealtimeOutgoingAudioSource::sendAudioFrames): * platform/mediastream/RealtimeOutgoingAudioSource.h: * platform/mediastream/RealtimeOutgoingVideoSource.cpp: (WebCore::RealtimeOutgoingVideoSource::RealtimeOutgoingVideoSource): (WebCore::RealtimeOutgoingVideoSource::~RealtimeOutgoingVideoSource): (WebCore::RealtimeOutgoingVideoSource::observeSource): (WebCore::RealtimeOutgoingVideoSource::setSource): (WebCore::RealtimeOutgoingVideoSource::stop): (WebCore::RealtimeOutgoingVideoSource::AddOrUpdateSink): (WebCore::RealtimeOutgoingVideoSource::RemoveSink): * platform/mediastream/RealtimeOutgoingVideoSource.h: (WebCore::RealtimeOutgoingVideoSource::isSilenced const): * platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.cpp: (WebCore::RealtimeOutgoingAudioSourceLibWebRTC::pullAudioData): * platform/mediastream/mac/RealtimeOutgoingAudioSourceCocoa.cpp: (WebCore::RealtimeOutgoingAudioSourceCocoa::RealtimeOutgoingAudioSourceCocoa): (WebCore::RealtimeOutgoingAudioSourceCocoa::audioSamplesAvailable): (WebCore::RealtimeOutgoingAudioSourceCocoa::pullAudioData): * platform/mediastream/mac/RealtimeOutgoingAudioSourceCocoa.h: * platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp: (WebCore::RealtimeOutgoingVideoSourceCocoa::sampleBufferUpdated): LayoutTests: * webrtc/remove-track-expected.txt: * webrtc/remove-track.html: Add tests and fixed some flakiness issues on existing tests in the file. Canonical link: https://commits.webkit.org/206313@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@238102 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-11-12 19:49:13 +00:00
const promise2 = renegotiate();
return Promise.all([promise, promise2]);
}, "Remove audio track");
RealtimeOutgoing A/V sources should observe their sources only if having a sink https://bugs.webkit.org/show_bug.cgi?id=191490 Reviewed by Eric Carlson. Source/WebCore: Observe the source that generates media based on the sinks: - Do not observe at creation time - For first sink, start observing - When no more sink, stop observing Apply this principle for both outgoing audio and video sources. Add locks for the sinks to ensure thread-safety. Make sinks HashSet which is more robust. Do some refactoring to better isolate generic outgoing sources from Cocoa/GTK implementations. Covered by existing tests and updated webrtc/remove-track.html. * platform/mediastream/RealtimeOutgoingAudioSource.cpp: (WebCore::RealtimeOutgoingAudioSource::~RealtimeOutgoingAudioSource): (WebCore::RealtimeOutgoingAudioSource::stop): (WebCore::RealtimeOutgoingAudioSource::AddSink): (WebCore::RealtimeOutgoingAudioSource::RemoveSink): (WebCore::RealtimeOutgoingAudioSource::sendAudioFrames): * platform/mediastream/RealtimeOutgoingAudioSource.h: * platform/mediastream/RealtimeOutgoingVideoSource.cpp: (WebCore::RealtimeOutgoingVideoSource::RealtimeOutgoingVideoSource): (WebCore::RealtimeOutgoingVideoSource::~RealtimeOutgoingVideoSource): (WebCore::RealtimeOutgoingVideoSource::observeSource): (WebCore::RealtimeOutgoingVideoSource::setSource): (WebCore::RealtimeOutgoingVideoSource::stop): (WebCore::RealtimeOutgoingVideoSource::AddOrUpdateSink): (WebCore::RealtimeOutgoingVideoSource::RemoveSink): * platform/mediastream/RealtimeOutgoingVideoSource.h: (WebCore::RealtimeOutgoingVideoSource::isSilenced const): * platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.cpp: (WebCore::RealtimeOutgoingAudioSourceLibWebRTC::pullAudioData): * platform/mediastream/mac/RealtimeOutgoingAudioSourceCocoa.cpp: (WebCore::RealtimeOutgoingAudioSourceCocoa::RealtimeOutgoingAudioSourceCocoa): (WebCore::RealtimeOutgoingAudioSourceCocoa::audioSamplesAvailable): (WebCore::RealtimeOutgoingAudioSourceCocoa::pullAudioData): * platform/mediastream/mac/RealtimeOutgoingAudioSourceCocoa.h: * platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp: (WebCore::RealtimeOutgoingVideoSourceCocoa::sampleBufferUpdated): LayoutTests: * webrtc/remove-track-expected.txt: * webrtc/remove-track.html: Add tests and fixed some flakiness issues on existing tests in the file. Canonical link: https://commits.webkit.org/206313@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@238102 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-11-12 19:49:13 +00:00
promise_test(async t => {
const stream = await navigator.mediaDevices.getUserMedia({audio: true});
const track = stream.getTracks()[0];
let pc = new RTCPeerConnection();
for (let i = 0; i <100; i++) {
let sender = pc.addTrack(track, stream);
pc.removeTrack(sender);
}
pc.close();
}, 'Add/remove audio tracks');
promise_test(async t => {
const stream = await navigator.mediaDevices.getUserMedia({video: true});
const track = stream.getTracks()[0];
let pc = new RTCPeerConnection();
for (let i = 0; i <100; i++) {
let sender = pc.addTrack(track, stream);
pc.removeTrack(sender);
}
pc.close();
}, 'Add/remove video tracks');
</script>
</body>
</html>