mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Merge commit '51290f7ee2d3ef1990a945030f963e380512dd0a'
This commit is contained in:
commit
f06925ad22
@ -51,7 +51,7 @@ public final class OngoingGroupCallContext {
|
|||||||
let audioLevels = ValuePipe<[(UInt32, Float)]>()
|
let audioLevels = ValuePipe<[(UInt32, Float)]>()
|
||||||
let myAudioLevel = ValuePipe<Float>()
|
let myAudioLevel = ValuePipe<Float>()
|
||||||
|
|
||||||
init(queue: Queue) {
|
init(queue: Queue, inputDeviceId: String, outputDeviceId: String) {
|
||||||
self.queue = queue
|
self.queue = queue
|
||||||
|
|
||||||
var networkStateUpdatedImpl: ((GroupCallNetworkState) -> Void)?
|
var networkStateUpdatedImpl: ((GroupCallNetworkState) -> Void)?
|
||||||
@ -68,7 +68,9 @@ public final class OngoingGroupCallContext {
|
|||||||
},
|
},
|
||||||
myAudioLevelUpdated: { level in
|
myAudioLevelUpdated: { level in
|
||||||
myAudioLevelUpdatedImpl?(level)
|
myAudioLevelUpdatedImpl?(level)
|
||||||
}
|
},
|
||||||
|
inputDeviceId: inputDeviceId,
|
||||||
|
outputDeviceId: outputDeviceId
|
||||||
)
|
)
|
||||||
|
|
||||||
let queue = self.queue
|
let queue = self.queue
|
||||||
@ -190,6 +192,13 @@ public final class OngoingGroupCallContext {
|
|||||||
self.isMuted.set(isMuted)
|
self.isMuted.set(isMuted)
|
||||||
self.context.setIsMuted(isMuted)
|
self.context.setIsMuted(isMuted)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func switchAudioInput(_ deviceId: String) {
|
||||||
|
self.context.switchAudioInput(deviceId)
|
||||||
|
}
|
||||||
|
func switchAudioOutput(_ deviceId: String) {
|
||||||
|
self.context.switchAudioOutput(deviceId)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private let queue = Queue()
|
private let queue = Queue()
|
||||||
@ -267,10 +276,10 @@ public final class OngoingGroupCallContext {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public init() {
|
public init(inputDeviceId: String = "", outputDeviceId: String = "") {
|
||||||
let queue = self.queue
|
let queue = self.queue
|
||||||
self.impl = QueueLocalObject(queue: queue, generate: {
|
self.impl = QueueLocalObject(queue: queue, generate: {
|
||||||
return Impl(queue: queue)
|
return Impl(queue: queue, inputDeviceId: inputDeviceId, outputDeviceId: outputDeviceId)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -280,6 +289,16 @@ public final class OngoingGroupCallContext {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public func switchAudioInput(_ deviceId: String) {
|
||||||
|
self.impl.with { impl in
|
||||||
|
impl.switchAudioInput(deviceId)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public func switchAudioOutput(_ deviceId: String) {
|
||||||
|
self.impl.with { impl in
|
||||||
|
impl.switchAudioOutput(deviceId)
|
||||||
|
}
|
||||||
|
}
|
||||||
public func setJoinResponse(payload: String, ssrcs: [UInt32]) {
|
public func setJoinResponse(payload: String, ssrcs: [UInt32]) {
|
||||||
self.impl.with { impl in
|
self.impl.with { impl in
|
||||||
impl.setJoinResponse(payload: payload, ssrcs: ssrcs)
|
impl.setJoinResponse(payload: payload, ssrcs: ssrcs)
|
||||||
|
@ -158,7 +158,7 @@ typedef NS_ENUM(int32_t, GroupCallNetworkState) {
|
|||||||
|
|
||||||
@interface GroupCallThreadLocalContext : NSObject
|
@interface GroupCallThreadLocalContext : NSObject
|
||||||
|
|
||||||
- (instancetype _Nonnull)initWithQueue:(id<OngoingCallThreadLocalContextQueueWebrtc> _Nonnull)queue networkStateUpdated:(void (^ _Nonnull)(GroupCallNetworkState))networkStateUpdated audioLevelsUpdated:(void (^ _Nonnull)(NSArray<NSNumber *> * _Nonnull))audioLevelsUpdated myAudioLevelUpdated:(void (^ _Nonnull)(float))myAudioLevelUpdated;
|
- (instancetype _Nonnull)initWithQueue:(id<OngoingCallThreadLocalContextQueueWebrtc> _Nonnull)queue networkStateUpdated:(void (^ _Nonnull)(GroupCallNetworkState))networkStateUpdated audioLevelsUpdated:(void (^ _Nonnull)(NSArray<NSNumber *> * _Nonnull))audioLevelsUpdated myAudioLevelUpdated:(void (^ _Nonnull)(float))myAudioLevelUpdated inputDeviceId:(NSString * _Nonnull)inputDeviceId outputDeviceId:(NSString * _Nonnull)outputDeviceId;
|
||||||
|
|
||||||
- (void)stop;
|
- (void)stop;
|
||||||
|
|
||||||
@ -167,6 +167,9 @@ typedef NS_ENUM(int32_t, GroupCallNetworkState) {
|
|||||||
- (void)setSsrcs:(NSArray<NSNumber *> * _Nonnull)ssrcs;
|
- (void)setSsrcs:(NSArray<NSNumber *> * _Nonnull)ssrcs;
|
||||||
- (void)setIsMuted:(bool)isMuted;
|
- (void)setIsMuted:(bool)isMuted;
|
||||||
|
|
||||||
|
- (void)switchAudioOutput:(NSString * _Nonnull)deviceId;
|
||||||
|
- (void)switchAudioInput:(NSString * _Nonnull)deviceId;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -808,7 +808,7 @@ static void (*InternalVoipLoggingFunction)(NSString *) = NULL;
|
|||||||
|
|
||||||
@implementation GroupCallThreadLocalContext
|
@implementation GroupCallThreadLocalContext
|
||||||
|
|
||||||
- (instancetype _Nonnull)initWithQueue:(id<OngoingCallThreadLocalContextQueueWebrtc> _Nonnull)queue networkStateUpdated:(void (^ _Nonnull)(GroupCallNetworkState))networkStateUpdated audioLevelsUpdated:(void (^ _Nonnull)(NSArray<NSNumber *> * _Nonnull))audioLevelsUpdated myAudioLevelUpdated:(void (^ _Nonnull)(float))myAudioLevelUpdated {
|
- (instancetype _Nonnull)initWithQueue:(id<OngoingCallThreadLocalContextQueueWebrtc> _Nonnull)queue networkStateUpdated:(void (^ _Nonnull)(GroupCallNetworkState))networkStateUpdated audioLevelsUpdated:(void (^ _Nonnull)(NSArray<NSNumber *> * _Nonnull))audioLevelsUpdated myAudioLevelUpdated:(void (^ _Nonnull)(float))myAudioLevelUpdated inputDeviceId:(NSString * _Nonnull)inputDeviceId outputDeviceId:(NSString * _Nonnull)outputDeviceId {
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if (self != nil) {
|
if (self != nil) {
|
||||||
_queue = queue;
|
_queue = queue;
|
||||||
@ -836,7 +836,9 @@ static void (*InternalVoipLoggingFunction)(NSString *) = NULL;
|
|||||||
},
|
},
|
||||||
.myAudioLevelUpdated = [myAudioLevelUpdated](float level) {
|
.myAudioLevelUpdated = [myAudioLevelUpdated](float level) {
|
||||||
myAudioLevelUpdated(level);
|
myAudioLevelUpdated(level);
|
||||||
}
|
},
|
||||||
|
.initialInputDeviceId = inputDeviceId.UTF8String,
|
||||||
|
.initialOutputDeviceId = outputDeviceId.UTF8String
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
@ -1043,5 +1045,16 @@ static void (*InternalVoipLoggingFunction)(NSString *) = NULL;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)switchAudioOutput:(NSString * _Nonnull)deviceId {
|
||||||
|
if (_instance) {
|
||||||
|
_instance->setAudioOutputDevice(deviceId.UTF8String);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
- (void)switchAudioInput:(NSString * _Nonnull)deviceId {
|
||||||
|
if (_instance) {
|
||||||
|
_instance->setAudioInputDevice(deviceId.UTF8String);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user