Title: [275414] trunk/Source/WebCore
- Revision
- 275414
- Author
- [email protected]
- Date
- 2021-04-02 02:14:46 -0700 (Fri, 02 Apr 2021)
Log Message
Start observing outgoing audio/video sources asynchronously
https://bugs.webkit.org/show_bug.cgi?id=224040
Reviewed by Eric Carlson.
We delay sending media a little bit to guarantee that senders can be
assigned a transform synchronously at creation time.
This guarantees all sent media will go through the transform.
Difficult to test in practice as this would be very racy.
* Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp:
(WebCore::operator==):
(WebCore::LibWebRTCRtpSenderBackend::startSource):
* Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (275413 => 275414)
--- trunk/Source/WebCore/ChangeLog 2021-04-02 09:07:41 UTC (rev 275413)
+++ trunk/Source/WebCore/ChangeLog 2021-04-02 09:14:46 UTC (rev 275414)
@@ -1,3 +1,20 @@
+2021-04-02 Youenn Fablet <[email protected]>
+
+ Start observing outgoing audio/video sources asynchronously
+ https://bugs.webkit.org/show_bug.cgi?id=224040
+
+ Reviewed by Eric Carlson.
+
+ We delay sending media a little bit to guarantee that senders can be
+ assigned a transform synchronously at creation time.
+ This guarantees all sent media will go through the transform.
+ Difficult to test in practice as this would be very racy.
+
+ * Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp:
+ (WebCore::operator==):
+ (WebCore::LibWebRTCRtpSenderBackend::startSource):
+ * Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.h:
+
2021-04-02 Rob Buis <[email protected]>
Subpixel layout: Switch inlines' baseline positioning from int to LayoutUnit.
Modified: trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp (275413 => 275414)
--- trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp 2021-04-02 09:07:41 UTC (rev 275413)
+++ trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp 2021-04-02 09:14:46 UTC (rev 275414)
@@ -52,13 +52,29 @@
stopSource();
}
+static bool operator==(const LibWebRTCRtpSenderBackend::Source& a, const LibWebRTCRtpSenderBackend::Source& b)
+{
+ return switchOn(a, [&b](const Ref<RealtimeOutgoingAudioSource>& source) {
+ return WTF::holds_alternative<Ref<RealtimeOutgoingAudioSource>>(b) && source.ptr() == WTF::get<Ref<RealtimeOutgoingAudioSource>>(b).ptr();
+ }, [&b](const Ref<RealtimeOutgoingVideoSource>& source) {
+ return WTF::holds_alternative<Ref<RealtimeOutgoingVideoSource>>(b) && source.ptr() == WTF::get<Ref<RealtimeOutgoingVideoSource>>(b).ptr();
+ }, [&b](std::nullptr_t) {
+ return WTF::holds_alternative<std::nullptr_t>(b);
+ });
+}
+
void LibWebRTCRtpSenderBackend::startSource()
{
- switchOn(m_source, [](Ref<RealtimeOutgoingAudioSource>& source) {
- source->start();
- }, [](Ref<RealtimeOutgoingVideoSource>& source) {
- source->start();
- }, [](std::nullptr_t&) {
+ // We asynchronously start the sources to guarantee media goes through the transform if a transform is set when creating the track.
+ callOnMainThread([weakThis = makeWeakPtr(this), source = m_source]() mutable {
+ if (!weakThis || weakThis->m_source != source)
+ return;
+ switchOn(source, [](Ref<RealtimeOutgoingAudioSource>& source) {
+ source->start();
+ }, [](Ref<RealtimeOutgoingVideoSource>& source) {
+ source->start();
+ }, [](std::nullptr_t&) {
+ });
});
}
Modified: trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.h (275413 => 275414)
--- trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.h 2021-04-02 09:07:41 UTC (rev 275413)
+++ trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.h 2021-04-02 09:14:46 UTC (rev 275414)
@@ -44,7 +44,7 @@
class LibWebRTCPeerConnectionBackend;
-class LibWebRTCRtpSenderBackend final : public RTCRtpSenderBackend {
+class LibWebRTCRtpSenderBackend final : public RTCRtpSenderBackend, public CanMakeWeakPtr<LibWebRTCRtpSenderBackend> {
WTF_MAKE_FAST_ALLOCATED;
public:
LibWebRTCRtpSenderBackend(LibWebRTCPeerConnectionBackend& backend, rtc::scoped_refptr<webrtc::RtpSenderInterface>&& rtcSender)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes