Video stream freeze on front camera orientation changing
authoryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 7 May 2019 21:07:00 +0000 (21:07 +0000)
committeryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 7 May 2019 21:07:00 +0000 (21:07 +0000)
https://bugs.webkit.org/show_bug.cgi?id=197227
<rdar://problem/50175498>

Reviewed by Eric Carlson.

Source/WebCore:

Use m_currentRotationSessionAngle instead of m_currentRotation to create or not a new rotation session.
Covered by updated test.

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

LayoutTests:

* webrtc/video-rotation-expected.txt:
* webrtc/video-rotation.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245033 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/webrtc/video-rotation-expected.txt
LayoutTests/webrtc/video-rotation.html
Source/WebCore/ChangeLog
Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.h
Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.mm

index d598d97..9148427 100644 (file)
@@ -1,3 +1,14 @@
+2019-05-07  Youenn Fablet  <youenn@apple.com>
+
+        Video stream freeze on front camera orientation changing
+        https://bugs.webkit.org/show_bug.cgi?id=197227
+        <rdar://problem/50175498>
+
+        Reviewed by Eric Carlson.
+
+        * webrtc/video-rotation-expected.txt:
+        * webrtc/video-rotation.html:
+
 2019-05-07  Brent Fulgham  <bfulgham@apple.com>
 
         Correct JSON parser to address unterminated escape character
index c5ad455..70dd4fc 100644 (file)
@@ -3,4 +3,5 @@
 PASS Setting video exchange 
 PASS Track is enabled, video should not be black 
 PASS Track is enabled and rotated, video should not be black and should change size 
+PASS Track is enabled and rotated again, video should not be black and should change size 
 
index 15cf805..a87698d 100644 (file)
@@ -86,6 +86,15 @@ promise_test((test) => {
         return waitForVideoSize(video, 240, 320);
     });
 }, "Track is enabled and rotated, video should not be black and should change size");
+
+promise_test((test) => {
+    if (window.internals)
+        window.internals.setCameraMediaStreamTrackOrientation(track, 180);
+
+    return checkVideoBlack(false, "canvas1").then(() => {
+        return waitForVideoSize(video, 320, 240);
+    });
+}, "Track is enabled and rotated again, video should not be black and should change size");
         </script>
     </body>
 </html>
index 889f39c..f0b5dad 100644 (file)
@@ -1,5 +1,20 @@
 2019-05-07  Youenn Fablet  <youenn@apple.com>
 
+        Video stream freeze on front camera orientation changing
+        https://bugs.webkit.org/show_bug.cgi?id=197227
+        <rdar://problem/50175498>
+
+        Reviewed by Eric Carlson.
+
+        Use m_currentRotationSessionAngle instead of m_currentRotation to create or not a new rotation session.
+        Covered by updated test.
+
+        * platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.h:
+        * platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.mm:
+        (WebCore::RealtimeOutgoingVideoSourceCocoa::rotatePixelBuffer):
+
+2019-05-07  Youenn Fablet  <youenn@apple.com>
+
         getUserMedia framerate unusable under low light in iOS 12.2
         https://bugs.webkit.org/show_bug.cgi?id=196214
         <rdar://problem/49232193>
index 6cc5ace..486c9a5 100644 (file)
@@ -54,7 +54,7 @@ private:
     std::unique_ptr<PixelBufferConformerCV> m_pixelBufferConformer;
     RetainPtr<VTImageRotationSessionRef> m_rotationSession;
     RetainPtr<CVPixelBufferPoolRef> m_rotationPool;
-    webrtc::VideoRotation m_currentRotationAngle { webrtc::kVideoRotation_0 };
+    webrtc::VideoRotation m_currentRotationSessionAngle { webrtc::kVideoRotation_0 };
     size_t m_rotatedWidth { 0 };
     size_t m_rotatedHeight { 0 };
     OSType m_rotatedFormat;
index 6f6d471..d33806d 100644 (file)
@@ -71,7 +71,7 @@ RetainPtr<CVPixelBufferRef> RealtimeOutgoingVideoSourceCocoa::rotatePixelBuffer(
     if (!rotation)
         return pixelBuffer;
 
-    if (!m_rotationSession || rotation != m_currentRotation) {
+    if (!m_rotationSession || rotation != m_currentRotationSessionAngle) {
         VTImageRotationSessionRef rawRotationSession = nullptr;
         auto status = VTImageRotationSessionCreate(kCFAllocatorDefault, rotation, &rawRotationSession);
         if (status != noErr) {
@@ -80,7 +80,7 @@ RetainPtr<CVPixelBufferRef> RealtimeOutgoingVideoSourceCocoa::rotatePixelBuffer(
         }
 
         m_rotationSession = adoptCF(rawRotationSession);
-        m_currentRotation = rotation;
+        m_currentRotationSessionAngle = rotation;
 
         VTImageRotationSessionSetProperty(rawRotationSession, kVTImageRotationPropertyKey_EnableHighSpeedTransfer, kCFBooleanTrue);
     }