init
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
Close stale issues and PRs / stale (push) Has been cancelled
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
Close stale issues and PRs / stale (push) Has been cancelled
This commit is contained in:
24
Telegram/ThirdParty/tgcalls/macos/PublicHeaders/TgVoipWebrtc/LibYuvBinding.h
vendored
Normal file
24
Telegram/ThirdParty/tgcalls/macos/PublicHeaders/TgVoipWebrtc/LibYuvBinding.h
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
#ifndef TgVoipWebrtc_LibYuvBinding_h
|
||||
#define TgVoipWebrtc_LibYuvBinding_h
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface LibYUVConverter : NSObject
|
||||
|
||||
+ (BOOL)I420ToNV12WithSrcY:(const uint8_t *)src_y
|
||||
srcStrideY:(int)src_stride_y
|
||||
srcU:(const uint8_t *)src_u
|
||||
srcStrideU:(int)src_stride_u
|
||||
srcV:(const uint8_t *)src_v
|
||||
srcStrideV:(int)src_stride_v
|
||||
dstY:(uint8_t *)dst_y
|
||||
dstStrideY:(int)dst_stride_y
|
||||
dstUV:(uint8_t *)dst_uv
|
||||
dstStrideUV:(int)dst_stride_uv
|
||||
width:(int)width
|
||||
height:(int)height;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
#endif
|
||||
23
Telegram/ThirdParty/tgcalls/macos/PublicHeaders/TgVoipWebrtc/MediaStreaming.h
vendored
Normal file
23
Telegram/ThirdParty/tgcalls/macos/PublicHeaders/TgVoipWebrtc/MediaStreaming.h
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef TgVoipWebrtc_MediaStreaming_h
|
||||
#define TgVoipWebrtc_MediaStreaming_h
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <TgVoipWebrtc/OngoingCallThreadLocalContext.h>
|
||||
|
||||
@interface MediaStreamingContext : NSObject
|
||||
|
||||
- (instancetype _Nonnull)initWithQueue:(id<OngoingCallThreadLocalContextQueueWebrtc> _Nonnull)queue
|
||||
requestCurrentTime:(id<OngoingGroupCallBroadcastPartTask> _Nonnull (^ _Nonnull)(void (^ _Nonnull)(int64_t)))requestAudioBroadcastPart
|
||||
requestAudioBroadcastPart:(id<OngoingGroupCallBroadcastPartTask> _Nonnull (^ _Nonnull)(int64_t, int64_t, void (^ _Nonnull)(OngoingGroupCallBroadcastPart * _Nullable)))requestAudioBroadcastPart
|
||||
requestVideoBroadcastPart:(id<OngoingGroupCallBroadcastPartTask> _Nonnull (^ _Nonnull)(int64_t, int64_t, int32_t, OngoingGroupCallRequestedVideoQuality, void (^ _Nonnull)(OngoingGroupCallBroadcastPart * _Nullable)))requestVideoBroadcastPart;
|
||||
|
||||
- (void)start;
|
||||
- (void)stop;
|
||||
|
||||
- (GroupCallDisposable * _Nonnull)addVideoOutput:(void (^_Nonnull)(CallVideoFrameData * _Nonnull))sink;
|
||||
- (void)getAudio:(int16_t * _Nonnull)audioSamples numSamples:(NSInteger)numSamples numChannels:(NSInteger)numChannels samplesPerSecond:(NSInteger)samplesPerSecond;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
437
Telegram/ThirdParty/tgcalls/macos/PublicHeaders/TgVoipWebrtc/OngoingCallThreadLocalContext.h
vendored
Normal file
437
Telegram/ThirdParty/tgcalls/macos/PublicHeaders/TgVoipWebrtc/OngoingCallThreadLocalContext.h
vendored
Normal file
@@ -0,0 +1,437 @@
|
||||
#ifndef OngoingCallContext_h
|
||||
#define OngoingCallContext_h
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#if TARGET_OS_IOS
|
||||
#import <UIKit/UIKit.h>
|
||||
#import <CoreMedia/CoreMedia.h>
|
||||
#else
|
||||
#import <AppKit/AppKit.h>
|
||||
#define UIView NSView
|
||||
#endif
|
||||
|
||||
@interface CallAudioTone : NSObject
|
||||
|
||||
@property (nonatomic, strong, readonly) NSData * _Nonnull samples;
|
||||
@property (nonatomic, readonly) NSInteger sampleRate;
|
||||
@property (nonatomic, readonly) NSInteger loopCount;
|
||||
|
||||
- (instancetype _Nonnull)initWithSamples:(NSData * _Nonnull)samples sampleRate:(NSInteger)sampleRate loopCount:(NSInteger)loopCount;
|
||||
|
||||
@end
|
||||
|
||||
@interface SharedCallAudioDevice : NSObject
|
||||
|
||||
- (instancetype _Nonnull)initWithDisableRecording:(bool)disableRecording enableSystemMute:(bool)enableSystemMute;
|
||||
|
||||
+ (void)setupAudioSession;
|
||||
|
||||
- (void)setManualAudioSessionIsActive:(bool)isAudioSessionActive;
|
||||
|
||||
- (void)setTone:(CallAudioTone * _Nullable)tone;
|
||||
|
||||
@end
|
||||
|
||||
@interface OngoingCallConnectionDescriptionWebrtc : NSObject
|
||||
|
||||
@property (nonatomic, readonly) uint8_t reflectorId;
|
||||
@property (nonatomic, readonly) bool hasStun;
|
||||
@property (nonatomic, readonly) bool hasTurn;
|
||||
@property (nonatomic, readonly) bool hasTcp;
|
||||
@property (nonatomic, strong, readonly) NSString * _Nonnull ip;
|
||||
@property (nonatomic, readonly) int32_t port;
|
||||
@property (nonatomic, strong, readonly) NSString * _Nonnull username;
|
||||
@property (nonatomic, strong, readonly) NSString * _Nonnull password;
|
||||
|
||||
- (instancetype _Nonnull)initWithReflectorId:(uint8_t)reflectorId hasStun:(bool)hasStun hasTurn:(bool)hasTurn hasTcp:(bool)hasTcp ip:(NSString * _Nonnull)ip port:(int32_t)port username:(NSString * _Nonnull)username password:(NSString * _Nonnull)password;
|
||||
|
||||
@end
|
||||
|
||||
typedef NS_ENUM(int32_t, OngoingCallStateWebrtc) {
|
||||
OngoingCallStateInitializing,
|
||||
OngoingCallStateConnected,
|
||||
OngoingCallStateFailed,
|
||||
OngoingCallStateReconnecting
|
||||
};
|
||||
|
||||
typedef NS_ENUM(int32_t, OngoingCallVideoStateWebrtc) {
|
||||
OngoingCallVideoStateInactive,
|
||||
OngoingCallVideoStateActive,
|
||||
OngoingCallVideoStatePaused
|
||||
};
|
||||
|
||||
typedef NS_ENUM(int32_t, OngoingCallRemoteVideoStateWebrtc) {
|
||||
OngoingCallRemoteVideoStateInactive,
|
||||
OngoingCallRemoteVideoStateActive,
|
||||
OngoingCallRemoteVideoStatePaused
|
||||
};
|
||||
|
||||
typedef NS_ENUM(int32_t, OngoingCallRemoteAudioStateWebrtc) {
|
||||
OngoingCallRemoteAudioStateMuted,
|
||||
OngoingCallRemoteAudioStateActive,
|
||||
};
|
||||
|
||||
typedef NS_ENUM(int32_t, OngoingCallRemoteBatteryLevelWebrtc) {
|
||||
OngoingCallRemoteBatteryLevelNormal,
|
||||
OngoingCallRemoteBatteryLevelLow
|
||||
};
|
||||
|
||||
typedef NS_ENUM(int32_t, OngoingCallVideoOrientationWebrtc) {
|
||||
OngoingCallVideoOrientation0,
|
||||
OngoingCallVideoOrientation90,
|
||||
OngoingCallVideoOrientation180,
|
||||
OngoingCallVideoOrientation270
|
||||
};
|
||||
|
||||
typedef NS_ENUM(int32_t, OngoingCallNetworkTypeWebrtc) {
|
||||
OngoingCallNetworkTypeWifi,
|
||||
OngoingCallNetworkTypeCellularGprs,
|
||||
OngoingCallNetworkTypeCellularEdge,
|
||||
OngoingCallNetworkTypeCellular3g,
|
||||
OngoingCallNetworkTypeCellularLte
|
||||
};
|
||||
|
||||
typedef NS_ENUM(int32_t, OngoingCallDataSavingWebrtc) {
|
||||
OngoingCallDataSavingNever,
|
||||
OngoingCallDataSavingCellular,
|
||||
OngoingCallDataSavingAlways
|
||||
};
|
||||
|
||||
@interface GroupCallDisposable : NSObject
|
||||
|
||||
- (instancetype _Nonnull)initWithBlock:(dispatch_block_t _Nonnull)block;
|
||||
- (void)dispose;
|
||||
|
||||
@end
|
||||
|
||||
@protocol OngoingCallThreadLocalContextQueueWebrtc <NSObject>
|
||||
|
||||
- (void)dispatch:(void (^ _Nonnull)())f;
|
||||
- (bool)isCurrent;
|
||||
|
||||
- (GroupCallDisposable * _Nonnull)scheduleBlock:(void (^ _Nonnull)())f after:(double)timeout;
|
||||
|
||||
@end
|
||||
|
||||
@interface VoipProxyServerWebrtc : NSObject
|
||||
|
||||
@property (nonatomic, strong, readonly) NSString * _Nonnull host;
|
||||
@property (nonatomic, readonly) int32_t port;
|
||||
@property (nonatomic, strong, readonly) NSString * _Nullable username;
|
||||
@property (nonatomic, strong, readonly) NSString * _Nullable password;
|
||||
|
||||
- (instancetype _Nonnull)initWithHost:(NSString * _Nonnull)host port:(int32_t)port username:(NSString * _Nullable)username password:(NSString * _Nullable)password;
|
||||
|
||||
@end
|
||||
|
||||
@protocol OngoingCallThreadLocalContextWebrtcVideoView <NSObject>
|
||||
|
||||
@property (nonatomic, readonly) OngoingCallVideoOrientationWebrtc orientation;
|
||||
@property (nonatomic, readonly) CGFloat aspect;
|
||||
|
||||
- (void)setOnFirstFrameReceived:(void (^ _Nullable)(float))onFirstFrameReceived;
|
||||
- (void)setOnOrientationUpdated:(void (^ _Nullable)(OngoingCallVideoOrientationWebrtc, CGFloat))onOrientationUpdated;
|
||||
- (void)setOnIsMirroredUpdated:(void (^ _Nullable)(bool))onIsMirroredUpdated;
|
||||
- (void)updateIsEnabled:(bool)isEnabled;
|
||||
#if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
|
||||
- (void)setVideoContentMode:(CALayerContentsGravity _Nonnull )mode;
|
||||
- (void)setForceMirrored:(bool)forceMirrored;
|
||||
- (void)setIsPaused:(bool)paused;
|
||||
- (void)renderToSize:(NSSize)size animated: (bool)animated;
|
||||
#endif
|
||||
@end
|
||||
|
||||
@protocol CallVideoFrameBuffer
|
||||
|
||||
@end
|
||||
|
||||
@interface CallVideoFrameNativePixelBuffer : NSObject<CallVideoFrameBuffer>
|
||||
|
||||
@property (nonatomic, readonly) CVPixelBufferRef _Nonnull pixelBuffer;
|
||||
|
||||
@end
|
||||
|
||||
@interface CallVideoFrameNV12Buffer : NSObject<CallVideoFrameBuffer>
|
||||
|
||||
@property (nonatomic, readonly) int width;
|
||||
@property (nonatomic, readonly) int height;
|
||||
|
||||
@property (nonatomic, strong, readonly) NSData * _Nonnull y;
|
||||
@property (nonatomic, readonly) int strideY;
|
||||
|
||||
@property (nonatomic, strong, readonly) NSData * _Nonnull uv;
|
||||
@property (nonatomic, readonly) int strideUV;
|
||||
|
||||
@end
|
||||
|
||||
@interface CallVideoFrameI420Buffer : NSObject<CallVideoFrameBuffer>
|
||||
|
||||
@property (nonatomic, readonly) int width;
|
||||
@property (nonatomic, readonly) int height;
|
||||
|
||||
@property (nonatomic, strong, readonly) NSData * _Nonnull y;
|
||||
@property (nonatomic, readonly) int strideY;
|
||||
|
||||
@property (nonatomic, strong, readonly) NSData * _Nonnull u;
|
||||
@property (nonatomic, readonly) int strideU;
|
||||
|
||||
@property (nonatomic, strong, readonly) NSData * _Nonnull v;
|
||||
@property (nonatomic, readonly) int strideV;
|
||||
|
||||
@end
|
||||
|
||||
@interface CallVideoFrameData : NSObject
|
||||
|
||||
@property (nonatomic, strong, readonly) id<CallVideoFrameBuffer> _Nonnull buffer;
|
||||
@property (nonatomic, readonly) int width;
|
||||
@property (nonatomic, readonly) int height;
|
||||
@property (nonatomic, readonly) OngoingCallVideoOrientationWebrtc orientation;
|
||||
@property (nonatomic, readonly) bool hasDeviceRelativeOrientation;
|
||||
@property (nonatomic, readonly) OngoingCallVideoOrientationWebrtc deviceRelativeOrientation;
|
||||
@property (nonatomic, readonly) bool mirrorHorizontally;
|
||||
@property (nonatomic, readonly) bool mirrorVertically;
|
||||
|
||||
@end
|
||||
|
||||
@interface OngoingCallThreadLocalContextVideoCapturer : NSObject
|
||||
|
||||
- (instancetype _Nonnull)initWithDeviceId:(NSString * _Nonnull)deviceId keepLandscape:(bool)keepLandscape;
|
||||
|
||||
#if TARGET_OS_IOS
|
||||
+ (instancetype _Nonnull)capturerWithExternalSampleBufferProvider;
|
||||
#endif
|
||||
|
||||
- (void)switchVideoInput:(NSString * _Nonnull)deviceId;
|
||||
- (void)setIsVideoEnabled:(bool)isVideoEnabled;
|
||||
|
||||
- (void)makeOutgoingVideoView:(bool)requestClone completion:(void (^_Nonnull)(UIView<OngoingCallThreadLocalContextWebrtcVideoView> * _Nullable, UIView<OngoingCallThreadLocalContextWebrtcVideoView> * _Nullable))completion;
|
||||
|
||||
- (void)setOnFatalError:(dispatch_block_t _Nullable)onError;
|
||||
- (void)setOnPause:(void (^ _Nullable)(bool))onPause;
|
||||
- (void)setOnIsActiveUpdated:(void (^_Nonnull)(bool))onIsActiveUpdated;
|
||||
|
||||
#if TARGET_OS_IOS
|
||||
- (void)submitPixelBuffer:(CVPixelBufferRef _Nonnull)pixelBuffer rotation:(OngoingCallVideoOrientationWebrtc)rotation;
|
||||
#endif
|
||||
|
||||
- (GroupCallDisposable * _Nonnull)addVideoOutput:(void (^_Nonnull)(CallVideoFrameData * _Nonnull))sink;
|
||||
|
||||
@end
|
||||
|
||||
@protocol OngoingCallDirectConnection <NSObject>
|
||||
|
||||
- (NSData * _Nonnull)addOnIncomingPacket:(void (^_Nonnull)(NSData * _Nonnull))addOnIncomingPacket;
|
||||
- (void)removeOnIncomingPacket:(NSData * _Nonnull)token;
|
||||
- (void)sendPacket:(NSData * _Nonnull)packet;
|
||||
|
||||
@end
|
||||
|
||||
@interface OngoingCallThreadLocalContextWebrtc : NSObject
|
||||
|
||||
+ (void)setupLoggingFunction:(void (* _Nullable)(NSString * _Nullable))loggingFunction;
|
||||
+ (void)applyServerConfig:(NSString * _Nullable)data;
|
||||
+ (int32_t)maxLayer;
|
||||
+ (NSArray<NSString *> * _Nonnull)versionsWithIncludeReference:(bool)includeReference;
|
||||
|
||||
@property (nonatomic, copy) void (^ _Nullable stateChanged)(OngoingCallStateWebrtc, OngoingCallVideoStateWebrtc, OngoingCallRemoteVideoStateWebrtc, OngoingCallRemoteAudioStateWebrtc, OngoingCallRemoteBatteryLevelWebrtc, float);
|
||||
@property (nonatomic, copy) void (^ _Nullable signalBarsChanged)(int32_t);
|
||||
@property (nonatomic, copy) void (^ _Nullable audioLevelUpdated)(float);
|
||||
|
||||
- (instancetype _Nonnull)initWithVersion:(NSString * _Nonnull)version queue:(id<OngoingCallThreadLocalContextQueueWebrtc> _Nonnull)queue proxy:(VoipProxyServerWebrtc * _Nullable)proxy networkType:(OngoingCallNetworkTypeWebrtc)networkType dataSaving:(OngoingCallDataSavingWebrtc)dataSaving derivedState:(NSData * _Nonnull)derivedState key:(NSData * _Nonnull)key isOutgoing:(bool)isOutgoing connections:(NSArray<OngoingCallConnectionDescriptionWebrtc *> * _Nonnull)connections maxLayer:(int32_t)maxLayer allowP2P:(BOOL)allowP2P allowTCP:(BOOL)allowTCP enableStunMarking:(BOOL)enableStunMarking logPath:(NSString * _Nonnull)logPath statsLogPath:(NSString * _Nonnull)statsLogPath sendSignalingData:(void (^ _Nonnull)(NSData * _Nonnull))sendSignalingData videoCapturer:(OngoingCallThreadLocalContextVideoCapturer * _Nullable)videoCapturer preferredVideoCodec:(NSString * _Nullable)preferredVideoCodec inputDeviceId: (NSString * _Nonnull)inputDeviceId outputDeviceId: (NSString * _Nonnull)outputDeviceId;
|
||||
|
||||
- (void)beginTermination;
|
||||
- (void)stop:(void (^_Nullable)(NSString * _Nullable debugLog, int64_t bytesSentWifi, int64_t bytesReceivedWifi, int64_t bytesSentMobile, int64_t bytesReceivedMobile))completion;
|
||||
|
||||
- (bool)needRate;
|
||||
|
||||
- (NSString * _Nullable)debugInfo;
|
||||
- (NSString * _Nullable)version;
|
||||
- (NSData * _Nonnull)getDerivedState;
|
||||
|
||||
- (void)setIsMuted:(bool)isMuted;
|
||||
- (void)setIsLowBatteryLevel:(bool)isLowBatteryLevel;
|
||||
- (void)setNetworkType:(OngoingCallNetworkTypeWebrtc)networkType;
|
||||
- (void)makeIncomingVideoView:(void (^_Nonnull)(UIView<OngoingCallThreadLocalContextWebrtcVideoView> * _Nullable))completion;
|
||||
- (void)requestVideo:(OngoingCallThreadLocalContextVideoCapturer * _Nullable)videoCapturer;
|
||||
- (void)setRequestedVideoAspect:(float)aspect;
|
||||
- (void)disableVideo;
|
||||
- (void)addSignalingData:(NSData * _Nonnull)data;
|
||||
- (void)switchAudioOutput:(NSString * _Nonnull)deviceId;
|
||||
- (void)switchAudioInput:(NSString * _Nonnull)deviceId;
|
||||
- (void)addExternalAudioData:(NSData * _Nonnull)data;
|
||||
|
||||
- (GroupCallDisposable * _Nonnull)addVideoOutputWithIsIncoming:(bool)isIncoming sink:(void (^_Nonnull)(CallVideoFrameData * _Nonnull))sink;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
typedef struct {
|
||||
bool isConnected;
|
||||
bool isTransitioningFromBroadcastToRtc;
|
||||
} GroupCallNetworkState;
|
||||
|
||||
typedef NS_ENUM(int32_t, OngoingGroupCallMediaChannelType) {
|
||||
OngoingGroupCallMediaChannelTypeAudio,
|
||||
OngoingGroupCallMediaChannelTypeVideo
|
||||
};
|
||||
|
||||
@interface OngoingGroupCallMediaChannelDescription : NSObject
|
||||
@property (nonatomic, readonly) OngoingGroupCallMediaChannelType type;
|
||||
@property (nonatomic, readonly) uint64_t peerId;
|
||||
@property (nonatomic, readonly) uint32_t audioSsrc;
|
||||
@property (nonatomic, strong, readonly) NSString * _Nullable videoDescription;
|
||||
|
||||
- (instancetype _Nonnull)initWithType:(OngoingGroupCallMediaChannelType)type
|
||||
peerId:(int64_t)peerId
|
||||
audioSsrc:(uint32_t)audioSsrc
|
||||
videoDescription:(NSString * _Nullable)videoDescription;
|
||||
|
||||
@end
|
||||
|
||||
@protocol OngoingGroupCallBroadcastPartTask <NSObject>
|
||||
|
||||
- (void)cancel;
|
||||
|
||||
@end
|
||||
|
||||
@protocol OngoingGroupCallMediaChannelDescriptionTask <NSObject>
|
||||
|
||||
- (void)cancel;
|
||||
|
||||
@end
|
||||
|
||||
typedef NS_ENUM(int32_t, OngoingCallConnectionMode) {
|
||||
OngoingCallConnectionModeNone,
|
||||
OngoingCallConnectionModeRtc,
|
||||
OngoingCallConnectionModeBroadcast
|
||||
};
|
||||
|
||||
typedef NS_ENUM(int32_t, OngoingGroupCallBroadcastPartStatus) {
|
||||
OngoingGroupCallBroadcastPartStatusSuccess,
|
||||
OngoingGroupCallBroadcastPartStatusNotReady,
|
||||
OngoingGroupCallBroadcastPartStatusResyncNeeded
|
||||
};
|
||||
|
||||
typedef NS_ENUM(int32_t, OngoingGroupCallVideoContentType) {
|
||||
OngoingGroupCallVideoContentTypeNone,
|
||||
OngoingGroupCallVideoContentTypeGeneric,
|
||||
OngoingGroupCallVideoContentTypeScreencast,
|
||||
};
|
||||
|
||||
@interface OngoingGroupCallBroadcastPart : NSObject
|
||||
|
||||
@property (nonatomic, readonly) int64_t timestampMilliseconds;
|
||||
@property (nonatomic, readonly) double responseTimestamp;
|
||||
@property (nonatomic, readonly) OngoingGroupCallBroadcastPartStatus status;
|
||||
@property (nonatomic, strong, readonly) NSData * _Nonnull oggData;
|
||||
|
||||
- (instancetype _Nonnull)initWithTimestampMilliseconds:(int64_t)timestampMilliseconds responseTimestamp:(double)responseTimestamp status:(OngoingGroupCallBroadcastPartStatus)status oggData:(NSData * _Nonnull)oggData;
|
||||
|
||||
@end
|
||||
|
||||
typedef NS_ENUM(int32_t, OngoingGroupCallRequestedVideoQuality) {
|
||||
OngoingGroupCallRequestedVideoQualityThumbnail,
|
||||
OngoingGroupCallRequestedVideoQualityMedium,
|
||||
OngoingGroupCallRequestedVideoQualityFull,
|
||||
};
|
||||
|
||||
@interface OngoingGroupCallSsrcGroup : NSObject
|
||||
|
||||
@property (nonatomic, strong, readonly) NSString * _Nonnull semantics;
|
||||
@property (nonatomic, strong, readonly) NSArray<NSNumber *> * _Nonnull ssrcs;
|
||||
|
||||
- (instancetype _Nonnull)initWithSemantics:(NSString * _Nonnull)semantics ssrcs:(NSArray<NSNumber *> * _Nonnull)ssrcs;
|
||||
|
||||
@end
|
||||
|
||||
@interface OngoingGroupCallRequestedVideoChannel : NSObject
|
||||
|
||||
@property (nonatomic, readonly) uint32_t audioSsrc;
|
||||
@property (nonatomic, readonly) int64_t userId;
|
||||
@property (nonatomic, strong, readonly) NSString * _Nonnull endpointId;
|
||||
@property (nonatomic, strong, readonly) NSArray<OngoingGroupCallSsrcGroup *> * _Nonnull ssrcGroups;
|
||||
|
||||
@property (nonatomic, readonly) OngoingGroupCallRequestedVideoQuality minQuality;
|
||||
@property (nonatomic, readonly) OngoingGroupCallRequestedVideoQuality maxQuality;
|
||||
|
||||
- (instancetype _Nonnull)initWithAudioSsrc:(uint32_t)audioSsrc userId:(int64_t)userId endpointId:(NSString * _Nonnull)endpointId ssrcGroups:(NSArray<OngoingGroupCallSsrcGroup *> * _Nonnull)ssrcGroups minQuality:(OngoingGroupCallRequestedVideoQuality)minQuality maxQuality:(OngoingGroupCallRequestedVideoQuality)maxQuality;
|
||||
|
||||
@end
|
||||
|
||||
@interface OngoingGroupCallIncomingVideoStats : NSObject
|
||||
|
||||
@property (nonatomic, readonly) int receivingQuality;
|
||||
@property (nonatomic, readonly) int availableQuality;
|
||||
|
||||
- (instancetype _Nonnull)initWithReceivingQuality:(int)receivingQuality availableQuality:(int)availableQuality;
|
||||
|
||||
@end
|
||||
|
||||
@interface OngoingGroupCallStats : NSObject
|
||||
|
||||
@property (nonatomic, strong, readonly) NSDictionary<NSString *, OngoingGroupCallIncomingVideoStats *> * _Nonnull incomingVideoStats;
|
||||
|
||||
- (instancetype _Nonnull)initWithIncomingVideoStats:(NSDictionary<NSString *, OngoingGroupCallIncomingVideoStats *> * _Nonnull)incomingVideoStats;
|
||||
|
||||
@end
|
||||
|
||||
@interface GroupCallThreadLocalContext : NSObject
|
||||
|
||||
@property (nonatomic, copy) void (^ _Nullable signalBarsChanged)(int32_t);
|
||||
|
||||
- (instancetype _Nonnull)initWithQueue:(id<OngoingCallThreadLocalContextQueueWebrtc> _Nonnull)queue
|
||||
networkStateUpdated:(void (^ _Nonnull)(GroupCallNetworkState))networkStateUpdated
|
||||
audioLevelsUpdated:(void (^ _Nonnull)(NSArray<NSNumber *> * _Nonnull))audioLevelsUpdated
|
||||
activityUpdated:(void (^ _Nonnull)(NSArray<NSNumber *> * _Nonnull))activityUpdated
|
||||
inputDeviceId:(NSString * _Nonnull)inputDeviceId
|
||||
outputDeviceId:(NSString * _Nonnull)outputDeviceId
|
||||
videoCapturer:(OngoingCallThreadLocalContextVideoCapturer * _Nullable)videoCapturer
|
||||
requestMediaChannelDescriptions:(id<OngoingGroupCallMediaChannelDescriptionTask> _Nonnull (^ _Nonnull)(NSArray<NSNumber *> * _Nonnull, void (^ _Nonnull)(NSArray<OngoingGroupCallMediaChannelDescription *> * _Nonnull)))requestMediaChannelDescriptions
|
||||
requestCurrentTime:(id<OngoingGroupCallBroadcastPartTask> _Nonnull (^ _Nonnull)(void (^ _Nonnull)(int64_t)))requestAudioBroadcastPart
|
||||
requestAudioBroadcastPart:(id<OngoingGroupCallBroadcastPartTask> _Nonnull (^ _Nonnull)(int64_t, int64_t, void (^ _Nonnull)(OngoingGroupCallBroadcastPart * _Nullable)))requestAudioBroadcastPart
|
||||
requestVideoBroadcastPart:(id<OngoingGroupCallBroadcastPartTask> _Nonnull (^ _Nonnull)(int64_t, int64_t, int32_t, OngoingGroupCallRequestedVideoQuality, void (^ _Nonnull)(OngoingGroupCallBroadcastPart * _Nullable)))requestVideoBroadcastPart
|
||||
outgoingAudioBitrateKbit:(int32_t)outgoingAudioBitrateKbit
|
||||
videoContentType:(OngoingGroupCallVideoContentType)videoContentType
|
||||
enableNoiseSuppression:(bool)enableNoiseSuppression
|
||||
disableAudioInput:(bool)disableAudioInput
|
||||
prioritizeVP8:(bool)prioritizeVP8
|
||||
logPath:(NSString * _Nonnull)logPath
|
||||
statsLogPath:(NSString * _Nonnull)statsLogPath
|
||||
audioDevice:(SharedCallAudioDevice * _Nullable)audioDevice
|
||||
isConference:(bool)isConference
|
||||
isActiveByDefault:(bool)isActiveByDefault
|
||||
encryptDecrypt:(NSData * _Nullable (^ _Nullable)(NSData * _Nonnull, int64_t, bool, int32_t))encryptDecrypt;
|
||||
|
||||
- (void)stop:(void (^ _Nullable)())completion;
|
||||
|
||||
- (void)setManualAudioSessionIsActive:(bool)isAudioSessionActive;
|
||||
|
||||
- (void)setTone:(CallAudioTone * _Nullable)tone;
|
||||
|
||||
- (void)setConnectionMode:(OngoingCallConnectionMode)connectionMode keepBroadcastConnectedIfWasEnabled:(bool)keepBroadcastConnectedIfWasEnabled isUnifiedBroadcast:(bool)isUnifiedBroadcast;
|
||||
|
||||
- (void)emitJoinPayload:(void (^ _Nonnull)(NSString * _Nonnull, uint32_t))completion;
|
||||
- (void)setJoinResponsePayload:(NSString * _Nonnull)payload;
|
||||
- (void)removeSsrcs:(NSArray<NSNumber *> * _Nonnull)ssrcs;
|
||||
- (void)removeIncomingVideoSource:(uint32_t)ssrc;
|
||||
- (void)setIsMuted:(bool)isMuted;
|
||||
- (void)setIsNoiseSuppressionEnabled:(bool)isNoiseSuppressionEnabled;
|
||||
- (void)requestVideo:(OngoingCallThreadLocalContextVideoCapturer * _Nullable)videoCapturer completion:(void (^ _Nonnull)(NSString * _Nonnull, uint32_t))completion;
|
||||
- (void)disableVideo:(void (^ _Nonnull)(NSString * _Nonnull, uint32_t))completion;
|
||||
|
||||
- (void)setVolumeForSsrc:(uint32_t)ssrc volume:(double)volume;
|
||||
- (void)setRequestedVideoChannels:(NSArray<OngoingGroupCallRequestedVideoChannel *> * _Nonnull)requestedVideoChannels;
|
||||
|
||||
- (void)switchAudioOutput:(NSString * _Nonnull)deviceId;
|
||||
- (void)switchAudioInput:(NSString * _Nonnull)deviceId;
|
||||
- (void)makeIncomingVideoViewWithEndpointId:(NSString * _Nonnull)endpointId requestClone:(bool)requestClone completion:(void (^_Nonnull)(UIView<OngoingCallThreadLocalContextWebrtcVideoView> * _Nullable, UIView<OngoingCallThreadLocalContextWebrtcVideoView> * _Nullable))completion;
|
||||
- (GroupCallDisposable * _Nonnull)addVideoOutputWithEndpointId:(NSString * _Nonnull)endpointId sink:(void (^_Nonnull)(CallVideoFrameData * _Nonnull))sink;
|
||||
|
||||
- (void)addExternalAudioData:(NSData * _Nonnull)data;
|
||||
|
||||
- (void)getStats:(void (^ _Nonnull)(OngoingGroupCallStats * _Nonnull))completion;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
1
Telegram/ThirdParty/tgcalls/macos/PublicHeaders/shim.h
vendored
Normal file
1
Telegram/ThirdParty/tgcalls/macos/PublicHeaders/shim.h
vendored
Normal file
@@ -0,0 +1 @@
|
||||
#import <../../tgcalls/platform/darwin/DesktopCaptureSourceViewMac.h>
|
||||
28
Telegram/ThirdParty/tgcalls/macos/Sources/LibYuvBinding.mm
vendored
Normal file
28
Telegram/ThirdParty/tgcalls/macos/Sources/LibYuvBinding.mm
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
#import <TgVoipWebrtc/LibYuvBinding.h>
|
||||
|
||||
#include "third_party/libyuv/include/libyuv/convert_from.h"
|
||||
|
||||
|
||||
@implementation LibYUVConverter
|
||||
|
||||
+ (BOOL)I420ToNV12WithSrcY:(const uint8_t *)src_y
|
||||
srcStrideY:(int)src_stride_y
|
||||
srcU:(const uint8_t *)src_u
|
||||
srcStrideU:(int)src_stride_u
|
||||
srcV:(const uint8_t *)src_v
|
||||
srcStrideV:(int)src_stride_v
|
||||
dstY:(uint8_t *)dst_y
|
||||
dstStrideY:(int)dst_stride_y
|
||||
dstUV:(uint8_t *)dst_uv
|
||||
dstStrideUV:(int)dst_stride_uv
|
||||
width:(int)width
|
||||
height:(int)height {
|
||||
// Call the actual libyuv function
|
||||
int result = libyuv::I420ToNV12(src_y, src_stride_y, src_u, src_stride_u, src_v, src_stride_v,
|
||||
dst_y, dst_stride_y, dst_uv, dst_stride_uv, width, height);
|
||||
|
||||
// Return YES if the conversion was successful, NO otherwise
|
||||
return result == 0;
|
||||
}
|
||||
|
||||
@end
|
||||
275
Telegram/ThirdParty/tgcalls/macos/Sources/MediaStreaming.mm
vendored
Normal file
275
Telegram/ThirdParty/tgcalls/macos/Sources/MediaStreaming.mm
vendored
Normal file
@@ -0,0 +1,275 @@
|
||||
#import <TgVoipWebrtc/MediaStreaming.h>
|
||||
|
||||
#import "MediaUtils.h"
|
||||
|
||||
#include "StaticThreads.h"
|
||||
#include "group/StreamingMediaContext.h"
|
||||
|
||||
#include "api/video/video_sink_interface.h"
|
||||
#include "sdk/objc/native/src/objc_frame_buffer.h"
|
||||
#include "api/video/video_frame.h"
|
||||
|
||||
#import "components/video_frame_buffer/RTCCVPixelBuffer.h"
|
||||
#import "platform/darwin/TGRTCCVPixelBuffer.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace {
|
||||
|
||||
class BroadcastPartTaskImpl : public tgcalls::BroadcastPartTask {
|
||||
public:
|
||||
BroadcastPartTaskImpl(id<OngoingGroupCallBroadcastPartTask> task) {
|
||||
_task = task;
|
||||
}
|
||||
|
||||
virtual ~BroadcastPartTaskImpl() {
|
||||
}
|
||||
|
||||
virtual void cancel() override {
|
||||
[_task cancel];
|
||||
}
|
||||
|
||||
private:
|
||||
id<OngoingGroupCallBroadcastPartTask> _task;
|
||||
};
|
||||
|
||||
class VideoSinkAdapter : public rtc::VideoSinkInterface<webrtc::VideoFrame> {
|
||||
public:
|
||||
VideoSinkAdapter(void (^frameReceived)(webrtc::VideoFrame const &)) {
|
||||
_frameReceived = [frameReceived copy];
|
||||
}
|
||||
|
||||
void OnFrame(const webrtc::VideoFrame& nativeVideoFrame) override {
|
||||
@autoreleasepool {
|
||||
if (_frameReceived) {
|
||||
_frameReceived(nativeVideoFrame);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
void (^_frameReceived)(webrtc::VideoFrame const &);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@interface MediaStreamingVideoSink : NSObject {
|
||||
std::shared_ptr<VideoSinkAdapter> _adapter;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation MediaStreamingVideoSink
|
||||
|
||||
- (instancetype)initWithSink:(void (^_Nonnull)(CallVideoFrameData * _Nonnull))sink {
|
||||
self = [super init];
|
||||
if (self != nil) {
|
||||
void (^storedSink)(CallVideoFrameData * _Nonnull) = [sink copy];
|
||||
|
||||
_adapter.reset(new VideoSinkAdapter(^(webrtc::VideoFrame const &videoFrame) {
|
||||
id<CallVideoFrameBuffer> mappedBuffer = nil;
|
||||
|
||||
bool mirrorHorizontally = false;
|
||||
bool mirrorVertically = false;
|
||||
|
||||
if (videoFrame.video_frame_buffer()->type() == webrtc::VideoFrameBuffer::Type::kNative) {
|
||||
id<RTC_OBJC_TYPE(RTCVideoFrameBuffer)> nativeBuffer = static_cast<webrtc::ObjCFrameBuffer *>(videoFrame.video_frame_buffer().get())->wrapped_frame_buffer();
|
||||
if ([nativeBuffer isKindOfClass:[RTC_OBJC_TYPE(RTCCVPixelBuffer) class]]) {
|
||||
RTCCVPixelBuffer *pixelBuffer = (RTCCVPixelBuffer *)nativeBuffer;
|
||||
mappedBuffer = [[CallVideoFrameNativePixelBuffer alloc] initWithPixelBuffer:pixelBuffer.pixelBuffer];
|
||||
}
|
||||
if ([nativeBuffer isKindOfClass:[TGRTCCVPixelBuffer class]]) {
|
||||
if (((TGRTCCVPixelBuffer *)nativeBuffer).shouldBeMirrored) {
|
||||
switch (videoFrame.rotation()) {
|
||||
case webrtc::kVideoRotation_0:
|
||||
case webrtc::kVideoRotation_180:
|
||||
mirrorHorizontally = true;
|
||||
break;
|
||||
case webrtc::kVideoRotation_90:
|
||||
case webrtc::kVideoRotation_270:
|
||||
mirrorVertically = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (videoFrame.video_frame_buffer()->type() == webrtc::VideoFrameBuffer::Type::kNV12) {
|
||||
rtc::scoped_refptr<webrtc::NV12BufferInterface> nv12Buffer(static_cast<webrtc::NV12BufferInterface *>(videoFrame.video_frame_buffer().get()));
|
||||
|
||||
mappedBuffer = [[CallVideoFrameNV12Buffer alloc] initWithBuffer:nv12Buffer];
|
||||
} else if (videoFrame.video_frame_buffer()->type() == webrtc::VideoFrameBuffer::Type::kI420) {
|
||||
rtc::scoped_refptr<webrtc::I420BufferInterface> i420Buffer(static_cast<webrtc::I420BufferInterface *>(videoFrame.video_frame_buffer().get()));
|
||||
|
||||
mappedBuffer = [[CallVideoFrameI420Buffer alloc] initWithBuffer:i420Buffer];
|
||||
}
|
||||
|
||||
if (storedSink && mappedBuffer) {
|
||||
storedSink([[CallVideoFrameData alloc] initWithBuffer:mappedBuffer frame:videoFrame mirrorHorizontally:mirrorHorizontally mirrorVertically:mirrorVertically]);
|
||||
}
|
||||
}));
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (std::shared_ptr<rtc::VideoSinkInterface<webrtc::VideoFrame>>)sink {
|
||||
return _adapter;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@interface MediaStreamingContext () {
|
||||
id<OngoingCallThreadLocalContextQueueWebrtc> _queue;
|
||||
|
||||
id<OngoingGroupCallBroadcastPartTask> _Nonnull (^ _Nonnull _requestCurrentTime)(void (^ _Nonnull)(int64_t));
|
||||
id<OngoingGroupCallBroadcastPartTask> _Nonnull (^ _Nonnull _requestAudioBroadcastPart)(int64_t, int64_t, void (^ _Nonnull)(OngoingGroupCallBroadcastPart * _Nullable));
|
||||
id<OngoingGroupCallBroadcastPartTask> _Nonnull (^ _Nonnull _requestVideoBroadcastPart)(int64_t, int64_t, int32_t, OngoingGroupCallRequestedVideoQuality, void (^ _Nonnull)(OngoingGroupCallBroadcastPart * _Nullable));
|
||||
|
||||
std::unique_ptr<tgcalls::StreamingMediaContext> _context;
|
||||
|
||||
int _nextSinkId;
|
||||
NSMutableDictionary<NSNumber *, MediaStreamingVideoSink *> *_sinks;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation MediaStreamingContext
|
||||
|
||||
- (instancetype _Nonnull)initWithQueue:(id<OngoingCallThreadLocalContextQueueWebrtc> _Nonnull)queue
|
||||
requestCurrentTime:(id<OngoingGroupCallBroadcastPartTask> _Nonnull (^ _Nonnull)(void (^ _Nonnull)(int64_t)))requestCurrentTime
|
||||
requestAudioBroadcastPart:(id<OngoingGroupCallBroadcastPartTask> _Nonnull (^ _Nonnull)(int64_t, int64_t, void (^ _Nonnull)(OngoingGroupCallBroadcastPart * _Nullable)))requestAudioBroadcastPart
|
||||
requestVideoBroadcastPart:(id<OngoingGroupCallBroadcastPartTask> _Nonnull (^ _Nonnull)(int64_t, int64_t, int32_t, OngoingGroupCallRequestedVideoQuality, void (^ _Nonnull)(OngoingGroupCallBroadcastPart * _Nullable)))requestVideoBroadcastPart {
|
||||
self = [super init];
|
||||
if (self != nil) {
|
||||
_queue = queue;
|
||||
|
||||
_requestCurrentTime = [requestCurrentTime copy];
|
||||
_requestAudioBroadcastPart = [requestAudioBroadcastPart copy];
|
||||
_requestVideoBroadcastPart = [requestVideoBroadcastPart copy];
|
||||
|
||||
_sinks = [[NSMutableDictionary alloc] init];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
}
|
||||
|
||||
- (void)resetContext {
|
||||
tgcalls::StreamingMediaContext::StreamingMediaContextArguments arguments;
|
||||
arguments.threads = tgcalls::StaticThreads::getThreads();
|
||||
arguments.isUnifiedBroadcast = true;
|
||||
arguments.requestCurrentTime = [requestCurrentTime = _requestCurrentTime](std::function<void(int64_t)> completion) -> std::shared_ptr<tgcalls::BroadcastPartTask> {
|
||||
id<OngoingGroupCallBroadcastPartTask> task = requestCurrentTime(^(int64_t result) {
|
||||
completion(result);
|
||||
});
|
||||
return std::make_shared<BroadcastPartTaskImpl>(task);
|
||||
};
|
||||
arguments.requestAudioBroadcastPart = nullptr;
|
||||
arguments.requestVideoBroadcastPart = [requestVideoBroadcastPart = _requestVideoBroadcastPart](int64_t timestampMilliseconds, int64_t durationMilliseconds, int32_t channelId, tgcalls::VideoChannelDescription::Quality quality, std::function<void(tgcalls::BroadcastPart &&)> completion) -> std::shared_ptr<tgcalls::BroadcastPartTask> {
|
||||
OngoingGroupCallRequestedVideoQuality mappedQuality;
|
||||
switch (quality) {
|
||||
case tgcalls::VideoChannelDescription::Quality::Thumbnail: {
|
||||
mappedQuality = OngoingGroupCallRequestedVideoQualityThumbnail;
|
||||
break;
|
||||
}
|
||||
case tgcalls::VideoChannelDescription::Quality::Medium: {
|
||||
mappedQuality = OngoingGroupCallRequestedVideoQualityMedium;
|
||||
break;
|
||||
}
|
||||
case tgcalls::VideoChannelDescription::Quality::Full: {
|
||||
mappedQuality = OngoingGroupCallRequestedVideoQualityFull;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
mappedQuality = OngoingGroupCallRequestedVideoQualityThumbnail;
|
||||
break;
|
||||
}
|
||||
}
|
||||
id<OngoingGroupCallBroadcastPartTask> task = requestVideoBroadcastPart(timestampMilliseconds, durationMilliseconds, channelId, mappedQuality, ^(OngoingGroupCallBroadcastPart * _Nullable part) {
|
||||
tgcalls::BroadcastPart parsedPart;
|
||||
parsedPart.timestampMilliseconds = part.timestampMilliseconds;
|
||||
|
||||
parsedPart.responseTimestamp = part.responseTimestamp;
|
||||
|
||||
tgcalls::BroadcastPart::Status mappedStatus;
|
||||
switch (part.status) {
|
||||
case OngoingGroupCallBroadcastPartStatusSuccess: {
|
||||
mappedStatus = tgcalls::BroadcastPart::Status::Success;
|
||||
break;
|
||||
}
|
||||
case OngoingGroupCallBroadcastPartStatusNotReady: {
|
||||
mappedStatus = tgcalls::BroadcastPart::Status::NotReady;
|
||||
break;
|
||||
}
|
||||
case OngoingGroupCallBroadcastPartStatusResyncNeeded: {
|
||||
mappedStatus = tgcalls::BroadcastPart::Status::ResyncNeeded;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
mappedStatus = tgcalls::BroadcastPart::Status::NotReady;
|
||||
break;
|
||||
}
|
||||
}
|
||||
parsedPart.status = mappedStatus;
|
||||
|
||||
parsedPart.data.resize(part.oggData.length);
|
||||
[part.oggData getBytes:parsedPart.data.data() length:part.oggData.length];
|
||||
|
||||
completion(std::move(parsedPart));
|
||||
});
|
||||
return std::make_shared<BroadcastPartTaskImpl>(task);
|
||||
};
|
||||
|
||||
arguments.updateAudioLevel = nullptr;
|
||||
|
||||
_context = std::make_unique<tgcalls::StreamingMediaContext>(std::move(arguments));
|
||||
|
||||
for (MediaStreamingVideoSink *storedSink in _sinks.allValues) {
|
||||
_context->addVideoSink("unified", [storedSink sink]);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)start {
|
||||
[self resetContext];
|
||||
}
|
||||
|
||||
- (void)stop {
|
||||
_context.reset();
|
||||
}
|
||||
|
||||
- (GroupCallDisposable * _Nonnull)addVideoOutput:(void (^_Nonnull)(CallVideoFrameData * _Nonnull))sink {
|
||||
int sinkId = _nextSinkId;
|
||||
_nextSinkId += 1;
|
||||
|
||||
MediaStreamingVideoSink *storedSink = [[MediaStreamingVideoSink alloc] initWithSink:sink];
|
||||
_sinks[@(sinkId)] = storedSink;
|
||||
|
||||
if (_context) {
|
||||
_context->addVideoSink("unified", [storedSink sink]);
|
||||
}
|
||||
|
||||
__weak MediaStreamingContext *weakSelf = self;
|
||||
id<OngoingCallThreadLocalContextQueueWebrtc> queue = _queue;
|
||||
return [[GroupCallDisposable alloc] initWithBlock:^{
|
||||
[queue dispatch:^{
|
||||
__strong MediaStreamingContext *strongSelf = weakSelf;
|
||||
if (!strongSelf) {
|
||||
return;
|
||||
}
|
||||
|
||||
[strongSelf->_sinks removeObjectForKey:@(sinkId)];
|
||||
}];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)getAudio:(int16_t * _Nonnull)audioSamples numSamples:(NSInteger)numSamples numChannels:(NSInteger)numChannels samplesPerSecond:(NSInteger)samplesPerSecond {
|
||||
if (_context) {
|
||||
_context->getAudio(audioSamples, (size_t)numSamples, (size_t)numChannels, (uint32_t)samplesPerSecond);
|
||||
} else {
|
||||
memset(audioSamples, 0, numSamples * numChannels * sizeof(int16_t));
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
57
Telegram/ThirdParty/tgcalls/macos/Sources/MediaUtils.h
vendored
Normal file
57
Telegram/ThirdParty/tgcalls/macos/Sources/MediaUtils.h
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
#import <TgVoipWebrtc/OngoingCallThreadLocalContext.h>
|
||||
|
||||
|
||||
#import "Instance.h"
|
||||
#import "InstanceImpl.h"
|
||||
#import "v2/InstanceV2Impl.h"
|
||||
#include "StaticThreads.h"
|
||||
|
||||
#import "VideoCaptureInterface.h"
|
||||
#import "platform/darwin/VideoCameraCapturer.h"
|
||||
|
||||
#ifndef WEBRTC_IOS
|
||||
#import "platform/darwin/VideoMetalViewMac.h"
|
||||
#import "platform/darwin/VideoSampleBufferViewMac.h"
|
||||
#define UIViewContentModeScaleAspectFill kCAGravityResizeAspectFill
|
||||
#define UIViewContentModeScaleAspect kCAGravityResizeAspect
|
||||
|
||||
#else
|
||||
#import "platform/darwin/VideoMetalView.h"
|
||||
#import "platform/darwin/GLVideoView.h"
|
||||
#import "platform/darwin/VideoSampleBufferView.h"
|
||||
#import "platform/darwin/VideoCaptureView.h"
|
||||
#import "platform/darwin/CustomExternalCapturer.h"
|
||||
#endif
|
||||
|
||||
#import "group/GroupInstanceImpl.h"
|
||||
#import "group/GroupInstanceCustomImpl.h"
|
||||
|
||||
#import "VideoCaptureInterfaceImpl.h"
|
||||
|
||||
#include "sdk/objc/native/src/objc_frame_buffer.h"
|
||||
#import "components/video_frame_buffer/RTCCVPixelBuffer.h"
|
||||
#import "platform/darwin/TGRTCCVPixelBuffer.h"
|
||||
|
||||
@interface CallVideoFrameNativePixelBuffer (Initialization)
|
||||
|
||||
- (instancetype _Nonnull)initWithPixelBuffer:(CVPixelBufferRef _Nonnull)pixelBuffer;
|
||||
|
||||
@end
|
||||
|
||||
@interface CallVideoFrameI420Buffer (Initialization)
|
||||
|
||||
- (instancetype _Nonnull)initWithBuffer:(rtc::scoped_refptr<webrtc::I420BufferInterface>)i420Buffer;
|
||||
|
||||
@end
|
||||
|
||||
@interface CallVideoFrameNV12Buffer (Initialization)
|
||||
|
||||
- (instancetype _Nonnull)initWithBuffer:(rtc::scoped_refptr<webrtc::NV12BufferInterface>)nv12Buffer;
|
||||
|
||||
@end
|
||||
|
||||
@interface CallVideoFrameData (Initialization)
|
||||
|
||||
- (instancetype _Nonnull)initWithBuffer:(id<CallVideoFrameBuffer> _Nonnull)buffer frame:(webrtc::VideoFrame const &)frame mirrorHorizontally:(bool)mirrorHorizontally mirrorVertically:(bool)mirrorVertically;
|
||||
|
||||
@end
|
||||
2099
Telegram/ThirdParty/tgcalls/macos/Sources/OngoingCallThreadLocalContext.mm
vendored
Normal file
2099
Telegram/ThirdParty/tgcalls/macos/Sources/OngoingCallThreadLocalContext.mm
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user