diff --git a/submodules/FFMpegBinding/Sources/FFMpegAVFrame.m b/submodules/FFMpegBinding/Sources/FFMpegAVFrame.m index 9c8218e0fe..c9876feb9b 100644 --- a/submodules/FFMpegBinding/Sources/FFMpegAVFrame.m +++ b/submodules/FFMpegBinding/Sources/FFMpegAVFrame.m @@ -20,7 +20,7 @@ - (void)dealloc { if (_impl) { - av_frame_unref(_impl); + av_frame_free(&_impl); } } diff --git a/submodules/MtProtoKit/Sources/MTNetworkAvailability.m b/submodules/MtProtoKit/Sources/MTNetworkAvailability.m index 500cc281cb..47f45844de 100644 --- a/submodules/MtProtoKit/Sources/MTNetworkAvailability.m +++ b/submodules/MtProtoKit/Sources/MTNetworkAvailability.m @@ -98,13 +98,13 @@ static void MTNetworkAvailabilityContextRelease(const void *info) MTTimer *timer = _timer; _timer = nil; - [[MTNetworkAvailability networkAvailabilityQueue] dispatchOnQueue:^ - { - [timer invalidate]; - - SCNetworkReachabilitySetCallback(reachability, NULL, NULL); - SCNetworkReachabilitySetDispatchQueue(reachability, NULL); - }]; + [[MTNetworkAvailability networkAvailabilityQueue] dispatchOnQueue:^{ + [timer invalidate]; + + SCNetworkReachabilitySetCallback(reachability, NULL, NULL); + SCNetworkReachabilitySetDispatchQueue(reachability, NULL); + CFRelease(reachability); + }]; } + (MTQueue *)networkAvailabilityQueue diff --git a/submodules/TelegramCallsUI/Sources/Components/MediaStreamComponent.swift b/submodules/TelegramCallsUI/Sources/Components/MediaStreamComponent.swift index 5944f985df..8286436ac9 100644 --- a/submodules/TelegramCallsUI/Sources/Components/MediaStreamComponent.swift +++ b/submodules/TelegramCallsUI/Sources/Components/MediaStreamComponent.swift @@ -270,7 +270,7 @@ public final class MediaStreamComponent: CombinedComponent { let moreButtonTag = local.moreButtonTag let moreAnimationTag = local.moreAnimationTag - func makeBody() -> CGSize { + let makeBody: () -> CGSize = { [weak local] in let canEnforceOrientation = UIDevice.current.model != "iPad" var forceFullScreenInLandscape: Bool { canEnforceOrientation && true } let environment = context.environment[ViewControllerComponentContainer.Environment.self].value @@ -289,13 +289,20 @@ public final class MediaStreamComponent: CombinedComponent { let state = context.state let controller = environment.controller - context.state.deactivatePictureInPictureIfVisible.connect { + context.state.deactivatePictureInPictureIfVisible.connect { [weak state] in guard let controller = controller(), controller.view.window != nil else { return } + guard let state else { + return + } state.updated(transition: .easeInOut(duration: 3)) - deactivatePictureInPicture.invoke(Void()) + + guard let local else { + return + } + local.deactivatePictureInPicture.invoke(Void()) } let isFullscreen: Bool let isLandscape = context.availableSize.width > context.availableSize.height @@ -347,8 +354,7 @@ public final class MediaStreamComponent: CombinedComponent { availableSize: CGSize(width: context.availableSize.width, height: dismissTapAreaHeight), transition: context.transition ) - // (controller() as? MediaStreamComponentController)?.prefersOnScreenNavigationHidden = isFullscreen - // (controller() as? MediaStreamComponentController)?.window?.invalidatePrefersOnScreenNavigationHidden() + let video = video.update( component: MediaStreamVideoComponent( call: context.component.call, @@ -832,6 +838,8 @@ public final class MediaStreamComponent: CombinedComponent { UIColor(red: 0.314, green: 0.161, blue: 0.197, alpha: 1).cgColor ], image: generateImage(CGSize(width: 44.0 * imageRenderScale, height: 44 * imageRenderScale), opaque: false, rotatedContext: { size, context in + context.clear(CGRect(origin: CGPoint(), size: size)) + context.translateBy(x: size.width / 2, y: size.height / 2) context.scaleBy(x: 0.4, y: 0.4) context.translateBy(x: -size.width / 2, y: -size.height / 2) diff --git a/submodules/TelegramCallsUI/Sources/PresentationCallManager.swift b/submodules/TelegramCallsUI/Sources/PresentationCallManager.swift index 0cf186c698..de7135864c 100644 --- a/submodules/TelegramCallsUI/Sources/PresentationCallManager.swift +++ b/submodules/TelegramCallsUI/Sources/PresentationCallManager.swift @@ -753,12 +753,18 @@ public final class PresentationCallManagerImpl: PresentationCallManager { public func joinGroupCall(context: AccountContext, peerId: PeerId, invite: String?, requestJoinAsPeerId: ((@escaping (PeerId?) -> Void) -> Void)?, initialCall: EngineGroupCallDescription, endCurrentIfAny: Bool) -> JoinGroupCallManagerResult { let begin: () -> Void = { [weak self] in - if let requestJoinAsPeerId = requestJoinAsPeerId { + if let requestJoinAsPeerId = requestJoinAsPeerId, (initialCall.isStream == nil || initialCall.isStream == false) { requestJoinAsPeerId({ joinAsPeerId in - let _ = self?.startGroupCall(accountContext: context, peerId: peerId, invite: invite, joinAsPeerId: joinAsPeerId, initialCall: initialCall).start() + guard let self else { + return + } + self.startCallDisposable.set(self.startGroupCall(accountContext: context, peerId: peerId, invite: invite, joinAsPeerId: joinAsPeerId, initialCall: initialCall).startStrict()) }) } else { - let _ = self?.startGroupCall(accountContext: context, peerId: peerId, invite: invite, joinAsPeerId: nil, initialCall: initialCall).start() + guard let self else { + return + } + self.startCallDisposable.set(self.startGroupCall(accountContext: context, peerId: peerId, invite: invite, joinAsPeerId: nil, initialCall: initialCall).startStrict()) } } @@ -805,6 +811,8 @@ public final class PresentationCallManagerImpl: PresentationCallManager { let accessEnabledSignal: Signal = Signal { subscriber in if let isStream = initialCall.isStream, isStream { subscriber.putNext(true) + subscriber.putCompletion() + return EmptyDisposable }