mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
- added SQueueLocalObject
This commit is contained in:
parent
57768b5698
commit
4e4bae9247
@ -0,0 +1,19 @@
|
|||||||
|
//
|
||||||
|
// SQueueLocalObject.h
|
||||||
|
// SSignalKit
|
||||||
|
//
|
||||||
|
// Created by Mikhail Filimonov on 13.01.2021.
|
||||||
|
// Copyright © 2021 Telegram. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
#import <SSignalKit/SQueue.h>
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
@interface SQueueLocalObject : NSObject
|
||||||
|
-(id)initWithQueue:(SQueue *)queue generate:(id (^)(void))next;
|
||||||
|
-(void)with:(void (^)(id object))f;
|
||||||
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
||||||
|
|
@ -0,0 +1,40 @@
|
|||||||
|
//
|
||||||
|
// SQueueLocalObject.m
|
||||||
|
// SSignalKit
|
||||||
|
//
|
||||||
|
// Created by Mikhail Filimonov on 13.01.2021.
|
||||||
|
// Copyright © 2021 Telegram. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "SQueueLocalObject.h"
|
||||||
|
|
||||||
|
@implementation SQueueLocalObject {
|
||||||
|
SQueue *queue;
|
||||||
|
id valueRef;
|
||||||
|
}
|
||||||
|
-(id)initWithQueue:(SQueue *)queue generate:(id _Nonnull (^)(void))next {
|
||||||
|
if (self = [super init]) {
|
||||||
|
self->queue = queue;
|
||||||
|
[queue dispatch:^{
|
||||||
|
self->valueRef = next();
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
-(void)with:(void (^)(id object))f {
|
||||||
|
[self->queue dispatch:^{
|
||||||
|
f(self->valueRef);
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(void)dealloc {
|
||||||
|
__block id value = self->valueRef;
|
||||||
|
self->valueRef = nil;
|
||||||
|
[queue dispatch:^{
|
||||||
|
value = nil;
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
@ -35,3 +35,4 @@ FOUNDATION_EXPORT const unsigned char SSignalKitVersionString[];
|
|||||||
#import <SSignalKit/SMulticastSignalManager.h>
|
#import <SSignalKit/SMulticastSignalManager.h>
|
||||||
#import <SSignalKit/STimer.h>
|
#import <SSignalKit/STimer.h>
|
||||||
#import <SSignalKit/SVariable.h>
|
#import <SSignalKit/SVariable.h>
|
||||||
|
#import <SSignalKit/SQueueLocalObject.h>
|
||||||
|
@ -1379,7 +1379,7 @@ static void processJoinPayload(tgcalls::GroupJoinPayload &payload, void (^ _Nonn
|
|||||||
completion(remoteRenderer);
|
completion(remoteRenderer);
|
||||||
} else {
|
} else {
|
||||||
GLVideoView *remoteRenderer = [[GLVideoView alloc] initWithFrame:CGRectZero];
|
GLVideoView *remoteRenderer = [[GLVideoView alloc] initWithFrame:CGRectZero];
|
||||||
|
// [remoteRenderer setVideoContentMode:kCAGravityResizeAspectFill];
|
||||||
std::shared_ptr<rtc::VideoSinkInterface<webrtc::VideoFrame>> sink = [remoteRenderer getSink];
|
std::shared_ptr<rtc::VideoSinkInterface<webrtc::VideoFrame>> sink = [remoteRenderer getSink];
|
||||||
|
|
||||||
[queue dispatch:^{
|
[queue dispatch:^{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user