Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GstWebRTC backports from upstream #1387

Draft
wants to merge 15 commits into
base: wpe-2.38
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ PASS rollback of a local offer to negotiated stable state should enable applying
PASS rollback a local offer with audio direction change to negotiated stable state and then add video receiver
PASS two transceivers with same mids
PASS onremovetrack fires during remote rollback
FAIL rollback of a remote offer with stream changes assert_equals: expected 2 but got 1
PASS rollback of a remote offer with stream changes
PASS removeTrack() with a sender being rolled back does not crash or throw
PASS Implicit rollback with only a datachannel works

Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@

Harness Error (TIMEOUT), message = null

PASS setStreams causes streams to be reported via ontrack on callee
PASS setStreams can be used to reconstruct a stream with a track on the remote side
PASS Adding streams and changing direction causes new streams to be reported via ontrack on callee
TIMEOUT Adding streams to an active transceiver causes new streams to be reported via ontrack on callee Test timed out
PASS Adding streams to an active transceiver causes new streams to be reported via ontrack on callee
PASS setStreams() fires InvalidStateError on a closed peer connection.

2 changes: 2 additions & 0 deletions LayoutTests/platform/glib/TestExpectations
Original file line number Diff line number Diff line change
Expand Up @@ -1474,6 +1474,8 @@ webrtc/video-av1.html [ Skip ]

# GStreamer's DTLS agent currently generates RSA certificates only. DTLS 1.2 is not supported yet (AFAIK).
webrtc/datachannel/dtls10.html [ Failure ]
# FIXME: Remove Timeout expectation once bug #275685 is fixed.
webkit.org/b/269285 webrtc/h265.html [ Failure Timeout ]

# Too slow with filtering implemented in WebKit. Should be done directly by GstWebRTC.
webrtc/datachannel/filter-ice-candidate.html [ Skip ]
Expand Down
3 changes: 3 additions & 0 deletions LayoutTests/webrtc/msid-setCodecPreferences-expected.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

PASS msid present in offer SDP after setting codec preferences

27 changes: 27 additions & 0 deletions LayoutTests/webrtc/msid-setCodecPreferences.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!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>
<script src ="routines.js"></script>
<script>
var track, firstConnection, secondConnection;
promise_test(async (test) => {
if (window.testRunner)
testRunner.setUserMediaPermission(true);

let pc = new RTCPeerConnection();
let stream = await navigator.mediaDevices.getUserMedia({ video: true });
let track = stream.getVideoTracks()[0];
pc.addTrack(track, stream);
pc.getTransceivers()[0].setCodecPreferences([{mimeType: "video/VP8", clockRate: 90000}]);
let offer = await pc.createOffer();
assert_true(offer.sdp.includes(`a=msid:${stream.id} ${track.id}`), 'offer SDP includes a=msid line');
}, "msid present in offer SDP after setting codec preferences");
</script>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

PASS setConfiguration after data channel is created
PASS setConfiguration after video transceiver is added
PASS setConfiguration after audio transceiver is added

Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Testing media fields in SDP when setConfiguration comes after createDataChannel/addTransceiver</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
</head>
<body>
<script src ="routines.js"></script>
<script>
function testMediaInSDP(addTransceiverOrDataChannel, regex) {
return async (test) => {
const pc = new RTCPeerConnection();
addTransceiverOrDataChannel(pc);
pc.setConfiguration({});
await pc.setLocalDescription();
const sdp = pc.localDescription.sdp;
assert_true(regex.test(sdp));
}
}

promise_test(testMediaInSDP(
pc => pc.createDataChannel("data-channel"),
/\r\nm=application.*webrtc-datachannel\r\n/),
'setConfiguration after data channel is created');

promise_test(testMediaInSDP(
pc => pc.addTransceiver("video"),
/\r\nm=video.*\r\n/),
'setConfiguration after video transceiver is added');

promise_test(testMediaInSDP(
pc => pc.addTransceiver("audio"),
/\r\nm=audio.*\r\n/),
'setConfiguration after audio transceiver is added');
</script>
</body>
</html>
3 changes: 3 additions & 0 deletions Source/WebCore/Modules/mediastream/MediaStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ class MediaStream final

RefPtr<MediaStream> clone();

using WeakValueType = MediaStreamPrivate::Observer::WeakValueType;
using MediaStreamPrivate::Observer::weakPtrFactory;

bool active() const { return m_isActive; }
bool muted() const { return m_private->muted(); }

Expand Down
13 changes: 11 additions & 2 deletions Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -610,12 +610,21 @@ void MediaStreamTrack::trackMutedChanged(MediaStreamTrackPrivate&)
if (document->activeDOMObjectsAreStopped() || m_ended)
return;

queueTaskKeepingObjectAlive(*this, TaskSource::Networking, [this, muted = m_private->muted()] {
Function<void()> updateMuted = [this, muted = m_private->muted()] {
if (!scriptExecutionContext() || scriptExecutionContext()->activeDOMObjectsAreStopped())
return;

if (m_muted == muted)
return;

m_muted = muted;
dispatchEvent(Event::create(muted ? eventNames().muteEvent : eventNames().unmuteEvent, Event::CanBubble::No, Event::IsCancelable::No));
});
};
if (m_shouldFireMuteEventImmediately)
updateMuted();
else
queueTaskKeepingObjectAlive(*this, TaskSource::Networking, WTFMove(updateMuted));

configureTrackRendering();

bool wasInterrupted = m_isInterrupted;
Expand Down
3 changes: 3 additions & 0 deletions Source/WebCore/Modules/mediastream/MediaStreamTrack.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ class MediaStreamTrack
const void* logIdentifier() const final { return m_private->logIdentifier(); }
#endif

void setShouldFireMuteEventImmediately(bool value) { m_shouldFireMuteEventImmediately = value; }

protected:
MediaStreamTrack(ScriptExecutionContext&, Ref<MediaStreamTrackPrivate>&&);

Expand Down Expand Up @@ -212,6 +214,7 @@ class MediaStreamTrack
bool m_ended { false };
const bool m_isCaptureTrack { false };
bool m_isInterrupted { false };
bool m_shouldFireMuteEventImmediately { false };
};

typedef Vector<Ref<MediaStreamTrack>> MediaStreamTrackVector;
Expand Down
Loading