Skip to content

Commit

Permalink
Fix boundaries setting for "SampleBufferVideoRenderer" re-layouting (#…
Browse files Browse the repository at this point in the history
…506)

Hello @hiroshihorie! 
I'm experiencing issues with the camera's front-to-back switch feature,
which occasionally causes the video frame to be incorrectly oriented in
landscape mode when it should be in portrait mode.

To resolve this issue, I've found that it's essential to update the
frame of the **AVSampleBufferDisplayLayer** after applying the
transformation matrix. This is because the transformation matrix also
rotates the frame, which can result in incorrect orientation if the
frame is not updated accordingly.
  • Loading branch information
VatamanuBogdan authored Oct 27, 2024
1 parent 5869cea commit 89a0fa2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Sources/LiveKit/Views/SampleBufferVideoRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ class SampleBufferVideoRenderer: NativeView, Loggable {

override func performLayout() {
super.performLayout()
sampleBufferDisplayLayer.frame = bounds


let (rotation, isMirrored) = _state.read { ($0.videoRotation, $0.isMirrored) }
sampleBufferDisplayLayer.transform = CATransform3D.from(rotation: rotation, isMirrored: isMirrored)

sampleBufferDisplayLayer.frame = bounds

sampleBufferDisplayLayer.removeAllAnimations()
}
}
Expand Down

0 comments on commit 89a0fa2

Please sign in to comment.