Title: [280421] trunk/Source/WebCore
Revision
280421
Author
you...@apple.com
Date
2021-07-29 04:21:58 -0700 (Thu, 29 Jul 2021)

Log Message

RealtimeOutgoingVideoSourceCocoa::rotatePixelBuffer should update m_currentRotationSessionAngle
https://bugs.webkit.org/show_bug.cgi?id=228549
<rdar://80608977>

Reviewed by Eric Carlson.

Do not forget to update m_currentRotationSessionAngle when creating a new rotation session.
Also, make sure to recreate rotation session in case the pixel buffer size changes.

* platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.mm:
(WebCore::RealtimeOutgoingVideoSourceCocoa::rotatePixelBuffer):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (280420 => 280421)


--- trunk/Source/WebCore/ChangeLog	2021-07-29 11:21:26 UTC (rev 280420)
+++ trunk/Source/WebCore/ChangeLog	2021-07-29 11:21:58 UTC (rev 280421)
@@ -1,3 +1,17 @@
+2021-07-29  Youenn Fablet  <you...@apple.com>
+
+        RealtimeOutgoingVideoSourceCocoa::rotatePixelBuffer should update m_currentRotationSessionAngle
+        https://bugs.webkit.org/show_bug.cgi?id=228549
+        <rdar://80608977>
+
+        Reviewed by Eric Carlson.
+
+        Do not forget to update m_currentRotationSessionAngle when creating a new rotation session.
+        Also, make sure to recreate rotation session in case the pixel buffer size changes.
+
+        * platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.mm:
+        (WebCore::RealtimeOutgoingVideoSourceCocoa::rotatePixelBuffer):
+
 2021-07-29  Adrian Perez de Castro  <ape...@igalia.com>
 
         Non-unified build fixes, late July 2021 edition

Modified: trunk/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.mm (280420 => 280421)


--- trunk/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.mm	2021-07-29 11:21:26 UTC (rev 280420)
+++ trunk/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.mm	2021-07-29 11:21:58 UTC (rev 280421)
@@ -71,12 +71,17 @@
     if (!rotation)
         return pixelBuffer;
 
-    if (!m_rotationSession || rotation != m_currentRotationSessionAngle) {
-        RELEASE_LOG_ERROR(WebRTC, "RealtimeOutgoingVideoSourceCocoa::rotatePixelBuffer creating rotation session for rotation %u", rotationToAngle(rotation));
-        IntSize size = { (int)CVPixelBufferGetWidth(pixelBuffer) , (int)CVPixelBufferGetHeight(pixelBuffer) };
+    auto pixelWidth = CVPixelBufferGetWidth(pixelBuffer);
+    auto pixelHeight = CVPixelBufferGetHeight(pixelBuffer);
+    if (!m_rotationSession || rotation != m_currentRotationSessionAngle || pixelWidth != m_rotatedWidth || pixelHeight != m_rotatedHeight) {
+        RELEASE_LOG_INFO(WebRTC, "RealtimeOutgoingVideoSourceCocoa::rotatePixelBuffer creating rotation session for rotation %u", rotationToAngle(rotation));
         AffineTransform transform;
         transform.rotate(rotationToAngle(rotation));
-        m_rotationSession = makeUnique<ImageRotationSessionVT>(WTFMove(transform), size, ImageRotationSessionVT::IsCGImageCompatible::No);
+        m_rotationSession = makeUnique<ImageRotationSessionVT>(WTFMove(transform), FloatSize { static_cast<float>(pixelWidth), static_cast<float>(pixelHeight) }, ImageRotationSessionVT::IsCGImageCompatible::No);
+
+        m_currentRotationSessionAngle = rotation;
+        m_rotatedWidth = pixelWidth;
+        m_rotatedHeight = pixelHeight;
     }
 
     return m_rotationSession->rotate(pixelBuffer);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to