[WIP] Call participant volume adjustment

This commit is contained in:
Ali
2020-12-28 15:17:33 +04:00
parent 4c8c710391
commit e683c8817d
6 changed files with 29 additions and 1 deletions

View File

@@ -294,6 +294,7 @@ public protocol PresentationGroupCall: class {
func toggleIsMuted()
func setIsMuted(action: PresentationGroupCallMuteAction)
func updateDefaultParticipantsAreMuted(isMuted: Bool)
func setVolume(peerId: PeerId, volume: Double)
func setCurrentAudioOutput(_ output: AudioSessionOutput)
func updateMuteState(peerId: PeerId, isMuted: Bool)

View File

@@ -1235,6 +1235,15 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
}
}
public func setVolume(peerId: PeerId, volume: Double) {
for (ssrc, id) in self.ssrcMapping {
if id == peerId {
self.callContext?.setVolume(ssrc: ssrc, volume: volume)
break
}
}
}
public func setCurrentAudioOutput(_ output: AudioSessionOutput) {
guard self.currentSelectedAudioOutputValue != output else {
return

View File

@@ -133,6 +133,10 @@ public final class OngoingGroupCallContext {
})
}
func setVolume(ssrc: UInt32, volume: Double) {
self.context.setVolumeForSsrc(ssrc, volume: volume)
}
func stop() {
self.context.stop()
}
@@ -242,6 +246,12 @@ public final class OngoingGroupCallContext {
}
}
public func setVolume(ssrc: UInt32, volume: Double) {
self.impl.with { impl in
impl.setVolume(ssrc: ssrc, volume: volume)
}
}
public func stop() {
self.impl.with { impl in
impl.stop()

View File

@@ -168,6 +168,8 @@ typedef NS_ENUM(int32_t, GroupCallNetworkState) {
- (void)removeSsrcs:(NSArray<NSNumber *> * _Nonnull)ssrcs;
- (void)setIsMuted:(bool)isMuted;
- (void)setVolumeForSsrc:(uint32_t)ssrc volume:(double)volume;
- (void)switchAudioOutput:(NSString * _Nonnull)deviceId;
- (void)switchAudioInput:(NSString * _Nonnull)deviceId;

View File

@@ -1052,6 +1052,12 @@ static void (*InternalVoipLoggingFunction)(NSString *) = NULL;
}
}
- (void)setVolumeForSsrc:(uint32_t)ssrc volume:(double)volume {
if (_instance) {
_instance->setVolume(ssrc, volume);
}
}
- (void)switchAudioOutput:(NSString * _Nonnull)deviceId {
if (_instance) {
_instance->setAudioOutputDevice(deviceId.UTF8String);