mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Merge branch 'beta'
This commit is contained in:
commit
821d04c38a
@ -435,10 +435,6 @@ public final class OngoingCallVideoCapturer {
|
|||||||
self.impl.setIsVideoEnabled(value)
|
self.impl.setIsVideoEnabled(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func injectSampleBuffer(_ sampleBuffer: CMSampleBuffer) {
|
|
||||||
self.impl.submitSampleBuffer(sampleBuffer)
|
|
||||||
}
|
|
||||||
|
|
||||||
public func injectPixelBuffer(_ pixelBuffer: CVPixelBuffer, rotation: CGImagePropertyOrientation) {
|
public func injectPixelBuffer(_ pixelBuffer: CVPixelBuffer, rotation: CGImagePropertyOrientation) {
|
||||||
var videoRotation: OngoingCallVideoOrientation = .rotation0
|
var videoRotation: OngoingCallVideoOrientation = .rotation0
|
||||||
switch rotation {
|
switch rotation {
|
||||||
|
@ -26,6 +26,9 @@ objc_library(
|
|||||||
"tgcalls/tgcalls/platform/darwin/DesktopSharingCapturer.*",
|
"tgcalls/tgcalls/platform/darwin/DesktopSharingCapturer.*",
|
||||||
"tgcalls/tgcalls/platform/darwin/DesktopCaptureSourceViewMac.*",
|
"tgcalls/tgcalls/platform/darwin/DesktopCaptureSourceViewMac.*",
|
||||||
"tgcalls/tgcalls/platform/darwin/DesktopCaptureSourceView.*",
|
"tgcalls/tgcalls/platform/darwin/DesktopCaptureSourceView.*",
|
||||||
|
"tgcalls/tgcalls/platform/darwin/TGCMIODevice.*",
|
||||||
|
"tgcalls/tgcalls/platform/darwin/TGCMIOCapturer.*",
|
||||||
|
"tgcalls/tgcalls/platform/darwin/VideoCMIOCapture.*",
|
||||||
"tgcalls/tgcalls/desktop_capturer/**",
|
"tgcalls/tgcalls/desktop_capturer/**",
|
||||||
]),
|
]),
|
||||||
hdrs = glob([
|
hdrs = glob([
|
||||||
|
@ -126,7 +126,6 @@ typedef NS_ENUM(int32_t, OngoingCallDataSavingWebrtc) {
|
|||||||
- (void)setOnIsActiveUpdated:(void (^_Nonnull)(bool))onIsActiveUpdated;
|
- (void)setOnIsActiveUpdated:(void (^_Nonnull)(bool))onIsActiveUpdated;
|
||||||
|
|
||||||
#if TARGET_OS_IOS
|
#if TARGET_OS_IOS
|
||||||
- (void)submitSampleBuffer:(CMSampleBufferRef _Nonnull)sampleBuffer;
|
|
||||||
- (void)submitPixelBuffer:(CVPixelBufferRef _Nonnull)pixelBuffer rotation:(OngoingCallVideoOrientationWebrtc)rotation;
|
- (void)submitPixelBuffer:(CVPixelBufferRef _Nonnull)pixelBuffer rotation:(OngoingCallVideoOrientationWebrtc)rotation;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -50,8 +50,26 @@
|
|||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@interface IsProcessingCustomSampleBufferFlag : NSObject
|
||||||
|
|
||||||
|
@property (nonatomic) bool value;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation IsProcessingCustomSampleBufferFlag
|
||||||
|
|
||||||
|
- (instancetype)init {
|
||||||
|
self = [super init];
|
||||||
|
if (self != nil) {
|
||||||
|
}
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
@interface OngoingCallThreadLocalContextVideoCapturer () {
|
@interface OngoingCallThreadLocalContextVideoCapturer () {
|
||||||
std::shared_ptr<tgcalls::VideoCaptureInterface> _interface;
|
std::shared_ptr<tgcalls::VideoCaptureInterface> _interface;
|
||||||
|
IsProcessingCustomSampleBufferFlag *_isProcessingCustomSampleBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@ -217,6 +235,7 @@
|
|||||||
self = [super init];
|
self = [super init];
|
||||||
if (self != nil) {
|
if (self != nil) {
|
||||||
_interface = interface;
|
_interface = interface;
|
||||||
|
_isProcessingCustomSampleBuffer = [[IsProcessingCustomSampleBufferFlag alloc] init];
|
||||||
_croppingBuffer = std::make_shared<std::vector<uint8_t>>();
|
_croppingBuffer = std::make_shared<std::vector<uint8_t>>();
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
@ -254,20 +273,6 @@ tgcalls::VideoCaptureInterfaceObject *GetVideoCaptureAssumingSameThread(tgcalls:
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if TARGET_OS_IOS
|
#if TARGET_OS_IOS
|
||||||
- (void)submitSampleBuffer:(CMSampleBufferRef _Nonnull)sampleBuffer {
|
|
||||||
if (!sampleBuffer) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
tgcalls::StaticThreads::getThreads()->getMediaThread()->PostTask(RTC_FROM_HERE, [interface = _interface, sampleBuffer = CFRetain(sampleBuffer)]() {
|
|
||||||
auto capture = GetVideoCaptureAssumingSameThread(interface.get());
|
|
||||||
auto source = capture->source();
|
|
||||||
if (source) {
|
|
||||||
[CustomExternalCapturer passSampleBuffer:(CMSampleBufferRef)sampleBuffer toSource:source];
|
|
||||||
}
|
|
||||||
CFRelease(sampleBuffer);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)submitPixelBuffer:(CVPixelBufferRef _Nonnull)pixelBuffer rotation:(OngoingCallVideoOrientationWebrtc)rotation {
|
- (void)submitPixelBuffer:(CVPixelBufferRef _Nonnull)pixelBuffer rotation:(OngoingCallVideoOrientationWebrtc)rotation {
|
||||||
if (!pixelBuffer) {
|
if (!pixelBuffer) {
|
||||||
return;
|
return;
|
||||||
@ -289,13 +294,19 @@ tgcalls::VideoCaptureInterfaceObject *GetVideoCaptureAssumingSameThread(tgcalls:
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
tgcalls::StaticThreads::getThreads()->getMediaThread()->PostTask(RTC_FROM_HERE, [interface = _interface, pixelBuffer = CFRetain(pixelBuffer), croppingBuffer = _croppingBuffer, videoRotation = videoRotation]() {
|
if (_isProcessingCustomSampleBuffer.value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_isProcessingCustomSampleBuffer.value = true;
|
||||||
|
|
||||||
|
tgcalls::StaticThreads::getThreads()->getMediaThread()->PostTask(RTC_FROM_HERE, [interface = _interface, pixelBuffer = CFRetain(pixelBuffer), croppingBuffer = _croppingBuffer, videoRotation = videoRotation, isProcessingCustomSampleBuffer = _isProcessingCustomSampleBuffer]() {
|
||||||
auto capture = GetVideoCaptureAssumingSameThread(interface.get());
|
auto capture = GetVideoCaptureAssumingSameThread(interface.get());
|
||||||
auto source = capture->source();
|
auto source = capture->source();
|
||||||
if (source) {
|
if (source) {
|
||||||
[CustomExternalCapturer passPixelBuffer:(CVPixelBufferRef)pixelBuffer rotation:videoRotation toSource:source croppingBuffer:*croppingBuffer];
|
[CustomExternalCapturer passPixelBuffer:(CVPixelBufferRef)pixelBuffer rotation:videoRotation toSource:source croppingBuffer:*croppingBuffer];
|
||||||
}
|
}
|
||||||
CFRelease(pixelBuffer);
|
CFRelease(pixelBuffer);
|
||||||
|
isProcessingCustomSampleBuffer.value = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 91b711e620f7043113a40496f9dddc0ccea16d52
|
Subproject commit 51a2c86469971c98f516579b509d56b856981e56
|
Loading…
x
Reference in New Issue
Block a user