Title: [289891] trunk/Source
Revision
289891
Author
[email protected]
Date
2022-02-16 08:54:55 -0800 (Wed, 16 Feb 2022)

Log Message

RemoteVideoFrameProxy is missing reference field encode, decode
https://bugs.webkit.org/show_bug.cgi?id=236690

Patch by Kimmo Kinnunen <[email protected]> on 2022-02-16
Reviewed by Antti Koivisto.

Source/WebKit:

Add the missing encode, decode. Use the better decode pattern
to avoid default construction and reduce the chance of having
a declaration but no decode.
Also add TextStream operator<< for RemoteVideoFrameProxy::Properties
for easier debugging with WebKit2Logging IPCMessages.

No new tests, tested by existing WebRTC tests
when WebRTCRemoteVideoFrameEnabled=true (not default currently)

* WebProcess/GPU/media/RemoteVideoFrameProxy.cpp:
(WebKit::operator<<):
* WebProcess/GPU/media/RemoteVideoFrameProxy.h:
(WebKit::RemoteVideoFrameProxy::Properties::encode const):
(WebKit::RemoteVideoFrameProxy::Properties::decode):

Source/WTF:

Export the MediaTime TextStream operator<< as inline function
for all compilation modes. It is useful also when NDEBUG is defined,
and it is hard to ifdef at all the call sites.

* wtf/MediaTime.cpp:
* wtf/MediaTime.h:

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (289890 => 289891)


--- trunk/Source/WTF/ChangeLog	2022-02-16 16:52:54 UTC (rev 289890)
+++ trunk/Source/WTF/ChangeLog	2022-02-16 16:54:55 UTC (rev 289891)
@@ -1,3 +1,17 @@
+2022-02-16  Kimmo Kinnunen  <[email protected]>
+
+        RemoteVideoFrameProxy is missing reference field encode, decode
+        https://bugs.webkit.org/show_bug.cgi?id=236690
+
+        Reviewed by Antti Koivisto.
+
+        Export the MediaTime TextStream operator<< as inline function
+        for all compilation modes. It is useful also when NDEBUG is defined,
+        and it is hard to ifdef at all the call sites.
+
+        * wtf/MediaTime.cpp:
+        * wtf/MediaTime.h:
+
 2022-02-15  Kimmo Kinnunen  <[email protected]>
 
         Constructing untaken LOG(Channel, ...) arguments slow debug binaries down

Modified: trunk/Source/WTF/wtf/MediaTime.cpp (289890 => 289891)


--- trunk/Source/WTF/wtf/MediaTime.cpp	2022-02-16 16:52:54 UTC (rev 289890)
+++ trunk/Source/WTF/wtf/MediaTime.cpp	2022-02-16 16:54:55 UTC (rev 289891)
@@ -615,13 +615,9 @@
     return object->toJSONString();
 }
 
-#ifndef NDEBUG
-
 TextStream& operator<<(TextStream& stream, const MediaTime& time)
 {
     return stream << time.toJSONString();
 }
 
-#endif
-
 }

Modified: trunk/Source/WTF/wtf/MediaTime.h (289890 => 289891)


--- trunk/Source/WTF/wtf/MediaTime.h	2022-02-16 16:52:54 UTC (rev 289890)
+++ trunk/Source/WTF/wtf/MediaTime.h	2022-02-16 16:54:55 UTC (rev 289891)
@@ -213,9 +213,7 @@
     static String toString(const MediaTimeRange& range) { return range.toJSONString(); }
 };
 
-#ifndef NDEBUG
 WTF_EXPORT_PRIVATE TextStream& operator<<(TextStream&, const MediaTime&);
-#endif
 
 }
 

Modified: trunk/Source/WebKit/ChangeLog (289890 => 289891)


--- trunk/Source/WebKit/ChangeLog	2022-02-16 16:52:54 UTC (rev 289890)
+++ trunk/Source/WebKit/ChangeLog	2022-02-16 16:54:55 UTC (rev 289891)
@@ -1,3 +1,25 @@
+2022-02-16  Kimmo Kinnunen  <[email protected]>
+
+        RemoteVideoFrameProxy is missing reference field encode, decode
+        https://bugs.webkit.org/show_bug.cgi?id=236690
+
+        Reviewed by Antti Koivisto.
+
+        Add the missing encode, decode. Use the better decode pattern
+        to avoid default construction and reduce the chance of having
+        a declaration but no decode.
+        Also add TextStream operator<< for RemoteVideoFrameProxy::Properties
+        for easier debugging with WebKit2Logging IPCMessages.
+
+        No new tests, tested by existing WebRTC tests
+        when WebRTCRemoteVideoFrameEnabled=true (not default currently)
+
+        * WebProcess/GPU/media/RemoteVideoFrameProxy.cpp:
+        (WebKit::operator<<):
+        * WebProcess/GPU/media/RemoteVideoFrameProxy.h:
+        (WebKit::RemoteVideoFrameProxy::Properties::encode const):
+        (WebKit::RemoteVideoFrameProxy::Properties::decode):
+
 2022-02-16  Wenson Hsieh  <[email protected]>
 
         [macOS] Add an "Markup Image" item to the sharing services picker context menu

Modified: trunk/Source/WebKit/WebProcess/GPU/media/RemoteVideoFrameProxy.cpp (289890 => 289891)


--- trunk/Source/WebKit/WebProcess/GPU/media/RemoteVideoFrameProxy.cpp	2022-02-16 16:52:54 UTC (rev 289890)
+++ trunk/Source/WebKit/WebProcess/GPU/media/RemoteVideoFrameProxy.cpp	2022-02-16 16:54:55 UTC (rev 289891)
@@ -146,5 +146,17 @@
 }
 #endif
 
+TextStream& operator<<(TextStream& ts, const RemoteVideoFrameProxy::Properties& properties)
+{
+    ts << "{ reference=" << properties.reference
+        << ", presentationTime=" << properties.presentationTime
+        << ", isMirrored=" << properties.isMirrored
+        << ", rotation=" << static_cast<int>(properties.rotation)
+        << ", size=" << properties.size
+        << ", pixelFormat=" << properties.pixelFormat
+        << " }";
+    return ts;
 }
+
+}
 #endif

Modified: trunk/Source/WebKit/WebProcess/GPU/media/RemoteVideoFrameProxy.h (289890 => 289891)


--- trunk/Source/WebKit/WebProcess/GPU/media/RemoteVideoFrameProxy.h	2022-02-16 16:52:54 UTC (rev 289890)
+++ trunk/Source/WebKit/WebProcess/GPU/media/RemoteVideoFrameProxy.h	2022-02-16 16:54:55 UTC (rev 289891)
@@ -122,32 +122,26 @@
 
 template<typename Encoder> void RemoteVideoFrameProxy::Properties::encode(Encoder& encoder) const
 {
-    encoder << presentationTime
-        << isMirrored
-        << rotation
-        << size
-        << pixelFormat;
+    encoder << reference << presentationTime << isMirrored << rotation << size << pixelFormat;
 }
 
 template<typename Decoder> std::optional<RemoteVideoFrameProxy::Properties> RemoteVideoFrameProxy::Properties::decode(Decoder& decoder)
 {
-    std::optional<RemoteVideoFrameReference> reference;
-    std::optional<MediaTime> presentationTime;
-    std::optional<bool> isMirrored;
-    std::optional<VideoRotation> videoRotation;
-    std::optional<WebCore::IntSize> size;
-    std::optional<uint32_t> pixelFormat;
-    decoder >> presentationTime
-        >> isMirrored
-        >> videoRotation
-        >> size
-        >> pixelFormat;
+    auto reference = decoder.template decode<RemoteVideoFrameReference>();
+    auto presentationTime = decoder.template decode<MediaTime>();
+    auto isMirrored = decoder.template decode<bool>();
+    auto videoRotation = decoder.template decode<VideoRotation>();
+    auto size = decoder.template decode<WebCore::IntSize>();
+    auto pixelFormat = decoder.template decode<uint32_t>();
     if (!decoder.isValid())
         return std::nullopt;
     return Properties { WTFMove(*reference), WTFMove(*presentationTime), *isMirrored, *videoRotation, *size, *pixelFormat };
 }
 
+TextStream& operator<<(TextStream&, const RemoteVideoFrameProxy::Properties&);
+
 }
+
 SPECIALIZE_TYPE_TRAITS_BEGIN(WebKit::RemoteVideoFrameProxy)
     static bool isType(const WebCore::MediaSample& mediaSample) { return mediaSample.platformSample().type == WebCore::PlatformSample::RemoteVideoFrameProxyType; }
 SPECIALIZE_TYPE_TRAITS_END()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to