diff --git a/submodules/TelegramVoip/Sources/GroupCallContext.swift b/submodules/TelegramVoip/Sources/GroupCallContext.swift index eaeda817df..daefa3fa48 100644 --- a/submodules/TelegramVoip/Sources/GroupCallContext.swift +++ b/submodules/TelegramVoip/Sources/GroupCallContext.swift @@ -392,7 +392,7 @@ public final class OngoingGroupCallContext { public let mirrorHorizontally: Bool public let mirrorVertically: Bool - init(frameData: CallVideoFrameData) { + public init(frameData: CallVideoFrameData) { if let nativeBuffer = frameData.buffer as? CallVideoFrameNativePixelBuffer { if CVPixelBufferGetPixelFormatType(nativeBuffer.pixelBuffer) == kCVPixelFormatType_32ARGB { self.buffer = .argb(NativeBuffer(pixelBuffer: nativeBuffer.pixelBuffer)) diff --git a/submodules/TelegramVoip/Sources/macOS/OngoingCallVideoCapturer.swift b/submodules/TelegramVoip/Sources/macOS/OngoingCallVideoCapturer.swift index 2bf532a9db..a16c539778 100644 --- a/submodules/TelegramVoip/Sources/macOS/OngoingCallVideoCapturer.swift +++ b/submodules/TelegramVoip/Sources/macOS/OngoingCallVideoCapturer.swift @@ -8,7 +8,7 @@ import Foundation import Cocoa import TgVoipWebrtc - +import SwiftSignalKit public enum OngoingCallVideoOrientation { @@ -79,6 +79,25 @@ public final class OngoingCallVideoCapturer { self.impl = OngoingCallThreadLocalContextVideoCapturer(deviceId: deviceId, keepLandscape: keepLandscape) } + public func video() -> Signal { + return Signal { [weak self] subscriber in + let disposable = MetaDisposable() + + guard let strongSelf = self else { + return disposable + } + let innerDisposable = strongSelf.impl.addVideoOutput({ videoFrameData in + subscriber.putNext(OngoingGroupCallContext.VideoFrameData(frameData: videoFrameData)) + }) + disposable.set(ActionDisposable { + innerDisposable.dispose() + }) + + return disposable + } + } + + public func makeOutgoingVideoView(completion: @escaping (OngoingCallContextPresentationCallVideoView?) -> Void) { self.impl.makeOutgoingVideoView(false, completion: { view, _ in if let view = view {