Various fixes

This commit is contained in:
Ilya Laktyushin
2024-11-29 13:12:12 +04:00
parent de6f737bc1
commit 07436e4705
8 changed files with 113 additions and 109 deletions

View File

@@ -21,8 +21,8 @@ final class CameraVideoSource: VideoSource {
public init?() {
self.device = MetalEngine.shared.device
self.cameraVideoOutput = CameraVideoOutput(sink: { [weak self] buffer in
self?.push(buffer)
self.cameraVideoOutput = CameraVideoOutput(sink: { [weak self] buffer, mirror in
self?.push(buffer, mirror: mirror)
})
CVMetalTextureCacheCreate(nil, nil, self.device, nil, &self.textureCache)
@@ -41,7 +41,7 @@ final class CameraVideoSource: VideoSource {
}
}
private func push(_ sampleBuffer: CMSampleBuffer) {
private func push(_ sampleBuffer: CMSampleBuffer, mirror: Bool) {
guard let buffer = CMSampleBufferGetImageBuffer(sampleBuffer) else {
return
}
@@ -71,7 +71,7 @@ final class CameraVideoSource: VideoSource {
uv: uvTexture
)),
dataBuffer: Output.NativeDataBuffer(pixelBuffer: buffer),
mirrorDirection: [],
mirrorDirection: mirror ? [.vertical] : [],
sourceId: self.sourceId
)