I am developing a video streaming application in which I need to capture the front video camera and encode and then transfer it to the other end, a typical stream is like this
AVCaptureSession -> AVCaptureDeviceInput -> AVCaptureVideoDataOutput -> frame frame -> encode frame -> send a frame to the other end,
It works fine, I set kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange as the frame format.
also uses the preview preview level,
The problem occurs when the orientation of the device changes, if the device moves from portrait to landscape, and then rotates 90 at the other ends of the frames, I expected the orientation to be maintained at the preview level, so I automatically get a rotating buffer in the Capture callback, but, it looks like the preview layer will just show me a preview of the captured buffer, and the user interface will show me the buffer, while at the other end I get a roving buffer
So, I want to know if there is any configuration to change it, or I need to rotate / convert the buffer in the callback of the Capture buffer.
source
share