Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

revert: feat: simulcast support - WPB-11481 #2475

Draft
wants to merge 2 commits into
base: release/cycle-3.117
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
binary "wire-avs.json" "10.0.4"
binary "wire-avs.json" "9.10.16"
github "wireapp/ZipArchive" "v2.4.2"
github "wireapp/core-crypto" "v3.0.2"
github "wireapp/cryptobox-ios" "v1.1.0_xcframework_arm64simulator"
Expand Down
2 changes: 1 addition & 1 deletion WireUI/Sources/WireDesign/Buttons/LinkButtonStyle.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// Wire
// Copyright (C) 2025 Wire Swiss GmbH
// Copyright (C) 2024 Wire Swiss GmbH
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// Wire
// Copyright (C) 2025 Wire Swiss GmbH
// Copyright (C) 2024 Wire Swiss GmbH
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion wire-avs.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"10.0.4": "https://github.com/wireapp/wire-avs/releases/download/10.0.4/avs.xcframework.zip",
"9.10.16": "https://github.com/wireapp/wire-avs/releases/download/9.10.16/avs.xcframework.zip",
}
42 changes: 2 additions & 40 deletions wire-ios-sync-engine/Source/Calling/AVS/AVSVideoStreams.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,50 +18,12 @@

import Foundation

public struct AVSVideoStreams: Encodable, Equatable {
public struct AVSVideoStreams: Codable, Equatable {
let conversationId: String
let clients: [AVSClientVideoStream]
let clients: [AVSClient]

enum CodingKeys: String, CodingKey {
case conversationId = "convid"
case clients
}
}

public enum AVSStreamQuality: Int, Codable {
case any = 0 // any resolution (avs decides)
case low = 1 // low quality resolution
case high = 2 // high quality resolution

var debugDescription: String {
String(describing: self)
}
}

public struct AVSClientVideoStream: Encodable, Equatable, Hashable {
public let userId: String
public let clientId: String
public let quality: AVSStreamQuality

enum CodingKeys: String, CodingKey {
case userId = "userid"
case clientId = "clientid"
case streamQuality = "quality"
}

public init(
client: AVSClient,
quality: AVSStreamQuality = .any
) {
self.userId = client.userId
self.clientId = client.clientId
self.quality = quality
}

public func encode(to encoder: any Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(userId, forKey: .userId)
try container.encode(clientId, forKey: .clientId)
try container.encode(quality.rawValue, forKey: .streamQuality)
}
}
2 changes: 1 addition & 1 deletion wire-ios-sync-engine/Source/Calling/VoiceChannel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public protocol CallActions: NSObjectProtocol {
func join(video: Bool, userSession: ZMUserSession) -> Bool
func leave(userSession: ZMUserSession, completion: (() -> Void)?)
func continueByDecreasingConversationSecurity(userSession: ZMUserSession)
func request(videoStreams: [AVSClientVideoStream])
func request(videoStreams: [AVSClient])

}

Expand Down
3 changes: 2 additions & 1 deletion wire-ios-sync-engine/Source/Calling/VoiceChannelV3.swift
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,9 @@ extension VoiceChannelV3: CallActions {
}
}

public func request(videoStreams: [AVSClientVideoStream]) {
public func request(videoStreams: [AVSClient]) {
guard let conversationId = conversation?.avsIdentifier else { return }

callCenter?.requestVideoStreams(conversationId: conversationId, clients: videoStreams)
}
}
Expand Down
2 changes: 1 addition & 1 deletion wire-ios-sync-engine/Source/Calling/WireCallCenterV3.swift
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,7 @@ public extension WireCallCenterV3 {
/// - Parameters:
/// - conversationId: The identifier of the conversation where the video call is hosted.
/// - clients: The list of clients for which AVS should load video streams.
func requestVideoStreams(conversationId: AVSIdentifier, clients: [AVSClientVideoStream]) {
func requestVideoStreams(conversationId: AVSIdentifier, clients: [AVSClient]) {
let videoStreams = AVSVideoStreams(conversationId: conversationId.serialized, clients: clients)
avsWrapper.requestVideoStreams(videoStreams, conversationId: conversationId)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,18 @@ class AVSVideoStreamsTest: XCTestCase {
let clientId = UUID()

let client = AVSClient(userId: userId, clientId: clientId.transportString())
let stream = AVSClientVideoStream(client: client, quality: .low)

let expectedJson = """
{\
"clients":[\
\(stream.jsonString(sortedKeys: true)!)\
\(client.jsonString(sortedKeys: true)!)\
],\
"convid":"\(conversationId.transportString())"\
}
"""

// when
let sut = AVSVideoStreams(conversationId: conversationId.transportString(), clients: [stream])
let sut = AVSVideoStreams(conversationId: conversationId.transportString(), clients: [client])

// then
XCTAssertEqual(sut.jsonString(sortedKeys: true), expectedJson)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2367,9 +2367,7 @@ extension WireCallCenterV3Tests {
let clients = [
AVSClient(userId: selfUserID, clientId: clientId1),
AVSClient(userId: otherUserID, clientId: clientId2)
].map { client in
AVSClientVideoStream(client: client, quality: .low)
}
]

let expectedResult = AVSVideoStreams(conversationId: conversationId.serialized, clients: clients)

Expand Down
4 changes: 2 additions & 2 deletions wire-ios/Tests/Mocks/MockVoiceChannel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ final class MockVoiceChannel: NSObject, VoiceChannel {

func leave() {}

var requestedVideoStreams: [AVSClientVideoStream]?
func request(videoStreams: [AVSClientVideoStream]) {
var requestedVideoStreams: [AVSClient]?
func request(videoStreams: [AVSClient]) {
requestedVideoStreams = videoStreams
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -293,12 +293,11 @@ final class CallGridViewControllerSnapshotTests: XCTestCase {
}

// Page 2 - Second half with video enabled
var expectedClientStreams = [AVSClientVideoStream]()
var expectedClients = [AVSClient]()
for _ in half ..< CallGridViewController.maxItemsPerPage {
let client = AVSClient(userId: AVSIdentifier.stub, clientId: UUID().transportString())

configuration.streams += [stubProvider.stream(client: client, videoState: .started)]
expectedClientStreams += [AVSClientVideoStream(client: client, quality: .low)]
expectedClients += [client]
}

sut.configuration = configuration
Expand All @@ -307,7 +306,7 @@ final class CallGridViewControllerSnapshotTests: XCTestCase {
sut.requestVideoStreamsIfNeeded(forPage: 1)

// then
XCTAssertEqual(mockDelegate.requestedClients, expectedClientStreams)
XCTAssertEqual(mockDelegate.requestedClients, expectedClients)
}

func testThatItDoesntRequestVideoStreams_IfPageIsInvalid() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ final class CallViewControllerTests: ZMSnapshotTestCase {
let clients = [
AVSClient(userId: AVSIdentifier.stub, clientId: UUID().transportString()),
AVSClient(userId: AVSIdentifier.stub, clientId: UUID().transportString())
].map { AVSClientVideoStream(client: $0) }
]

// When
sut.callGridViewController(viewController, perform: .requestVideoStreamsForClients(clients))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import Foundation

final class MockCallGridViewControllerDelegate: CallGridViewControllerDelegate {

var requestedClients: [AVSClientVideoStream]?
var requestedClients: [AVSClient]?

func callGridViewController(_ viewController: CallGridViewController, perform action: CallGridAction) {
guard case let .requestVideoStreamsForClients(clients) = action else { return }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ final class CallGridViewController: UIViewController {
PinchToZoomRule(isOneToOneCall: configuration.callHasTwoParticipants)
}

private var visibleClientsSharingVideo: Set<AVSClientVideoStream> = []
private var visibleClientsSharingVideo: [AVSClient] = []
private var dataSource: [Stream] = []
private let gridView = GridView(maxItemsPerPage: maxItemsPerPage)
private let thumbnailViewController = PinnableThumbnailViewController()
Expand Down Expand Up @@ -158,7 +158,7 @@ final class CallGridViewController: UIViewController {
networkConditionView.accessibilityIdentifier = "network-conditions-indicator"
}

func reloadGridData() {
func releadGridData() {
gridView.reloadData()
}

Expand Down Expand Up @@ -220,7 +220,6 @@ final class CallGridViewController: UIViewController {
maximizedView = shouldMaximize ? view : nil
view.isMaximized = shouldMaximize
updateGrid(with: streams)
requestVideoStreamsIfNeeded(forPage: gridView.currentPage)
updateHint(for: .maximizationChanged(stream: view.stream, maximized: view.isMaximized))
}

Expand Down Expand Up @@ -419,23 +418,14 @@ final class CallGridViewController: UIViewController {
endIndex > startIndex
else { return }

let clientsWithVideo = dataSource[startIndex ..< endIndex]
let clients = dataSource[startIndex ..< endIndex]
.filter(\.isSharingVideo)
.map(\.streamId)

let oneStreamDisplayedExcludingSelf = clientsWithVideo.count == 1
let clientStreams = clientsWithVideo
.map { client in
AVSClientVideoStream(
client: client.streamId,
quality: oneStreamDisplayedExcludingSelf ? .high : .low
)
}

let newVisibleClientsSharingVideo = Set(clientStreams)
guard Set(clients) != Set(visibleClientsSharingVideo) else { return }

guard newVisibleClientsSharingVideo != visibleClientsSharingVideo else { return }
delegate?.callGridViewController(self, perform: .requestVideoStreamsForClients(clientStreams))
visibleClientsSharingVideo = newVisibleClientsSharingVideo
delegate?.callGridViewController(self, perform: .requestVideoStreamsForClients(clients))
visibleClientsSharingVideo = clients
}

// MARK: - Grid View Axis
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ struct Stream: Equatable {
let callParticipantState: CallParticipantState
let activeSpeakerState: ActiveSpeakerState
let isPaused: Bool

}

extension Stream: Differentiable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ import WireSyncEngine

// The actions `CallGridViewController` can perform.
enum CallGridAction {
case requestVideoStreamsForClients(_ clients: [AVSClientVideoStream])
case requestVideoStreamsForClients(_ clients: [AVSClient])
}
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ final class CallViewController: UIViewController {
}

func reloadGrid() {
callGridViewController.reloadGridData()
callGridViewController.releadGridData()
}

override func accessibilityPerformEscape() -> Bool {
Expand Down
Loading