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

Codec negotiation #606

Open
wants to merge 33 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
21091e1
Show more controls with one user
ipavlidakis Nov 22, 2024
ed29bef
Add comments
ipavlidakis Dec 13, 2024
eabc398
Update ActionHandlers
ipavlidakis Dec 13, 2024
3c8d6e5
Remove unnecessary files
ipavlidakis Dec 13, 2024
07664aa
Update logic for layers calculation
ipavlidakis Dec 16, 2024
20f1c0f
Fix av1 layers rewrite
ipavlidakis Dec 17, 2024
0cb8f58
Fix screensharing missing due to empty rid
ipavlidakis Dec 17, 2024
0c2498c
Fix low quality issue
ipavlidakis Dec 18, 2024
2217b21
Fix trackInfo layer
ipavlidakis Dec 18, 2024
510beb7
Fix unnecessarily updating transceivers
ipavlidakis Dec 18, 2024
8429948
Update pip and fix screensharing
ipavlidakis Dec 18, 2024
12087c5
Update pip tracks when app becomes active again
ipavlidakis Dec 18, 2024
0634082
Maintain tracks in the SetPublisherRequest after codec disabled or un…
ipavlidakis Dec 18, 2024
e476f55
Initial tests and changes
ipavlidakis Dec 17, 2024
cdd234e
Updated mocks
ipavlidakis Dec 17, 2024
7cf8914
Add tests I
ipavlidakis Dec 17, 2024
2176173
WIP
ipavlidakis Dec 18, 2024
4992051
Make tests compile again
ipavlidakis Dec 19, 2024
5595f7f
Add/update tests
ipavlidakis Dec 19, 2024
2f9de82
Add/Update tests II
ipavlidakis Dec 20, 2024
4b1959b
Add/Update tests III
ipavlidakis Dec 20, 2024
ce358bf
Update publishOptions event handling to align with SFU
ipavlidakis Dec 20, 2024
9ded17e
Add/update tests IV
ipavlidakis Dec 20, 2024
d84e738
Announce expected tracks on migration/rejoin
ipavlidakis Dec 20, 2024
076c74a
Fixed the tests
martinmitrevski Dec 23, 2024
5a0033f
Tests cleanup
martinmitrevski Dec 23, 2024
c2c084c
Fixed wrong target membership
martinmitrevski Dec 23, 2024
6374c5a
Fixed tests
martinmitrevski Dec 23, 2024
93ee255
Misuse of compact map, fix build on Xcode 15
martinmitrevski Dec 23, 2024
01ae4ad
Sending codec in setPublisher
martinmitrevski Dec 23, 2024
7c9c603
Small fixes
martinmitrevski Dec 25, 2024
6e57220
Fix muted track info and processing time
ipavlidakis Dec 30, 2024
d24c5a9
Fix tests
ipavlidakis Dec 30, 2024
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

### ✅ Added
- CallKit availability policies allows you to control wether `Callkit` should be enabled/disabled based on different rules [#611](https://github.com/GetStream/stream-video-swift/pull/611)
- Codec negotiation during calls (#606)(https://github.com/GetStream/stream-video-swift/pull/606)

### 🐞 Fixed
- By observing the `CallKitPushNotificationAdapter.deviceToken` you will be notified with an empty `deviceToken` value, once the object unregister push notifications. [#608](https://github.com/GetStream/stream-video-swift/pull/608)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ final class OSLogDestination: BaseLogDestination {
extendedDetails += "[\(logDetails.functionName)] "
}

let extendedMessage = "\(extendedDetails)> \(logDetails.message)"
var extendedMessage = "\(extendedDetails)> \(logDetails.message)"
if let error = logDetails.error {
extendedMessage += "[Error: \(error)]"
}
let formattedMessage = LogConfig
.formatters
.reduce(extendedMessage) { $1.format(logDetails: logDetails, message: $0) }
Expand Down
4 changes: 1 addition & 3 deletions DemoApp/Sources/Controls/DemoControls.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ struct AppControlsWithChat: View {

var body: some View {
HStack {
if viewModel.callParticipants.count > 1 {
MoreControlsIconView(viewModel: viewModel)
}
MoreControlsIconView(viewModel: viewModel)

#if !targetEnvironment(simulator)
if !ProcessInfo.processInfo.isiOSAppOnMac {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ struct DemoWaitingLocalUserView<Factory: DemoAppViewFactory>: View {
.navigationViewStyle(.stack)
}
}
.presentsMoreControls(viewModel: viewModel)
.alignedToReadableContentGuide()
.padding(.bottom)
} else {
Expand Down
58 changes: 58 additions & 0 deletions Sources/StreamVideo/Models/AudioCodec.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
//
// Copyright © 2024 Stream.io Inc. All rights reserved.
//

import Foundation
import StreamWebRTC

/// Represents different audio codecs.
public enum AudioCodec: String, CustomStringConvertible {
case opus
case red
case unknown

/// Returns the raw value of the codec, which corresponds to its name.
public var description: String {
rawValue
}

/// Initializes an `AudioCodec` instance from WebRTC codec parameters.
///
/// This initializer maps a WebRTC codec (`RTCRtpCodecParameters`) to the
/// corresponding `AudioCodec` value. If the codec name matches `opus` or
/// `red`, the respective case is assigned; otherwise, it defaults to
/// `.unknown`.
///
/// - Parameter source: The `RTCRtpCodecParameters` object containing codec
/// details such as the codec name.
init(_ source: RTCRtpCodecParameters) {
switch source.name.lowercased() {
case AudioCodec.opus.rawValue:
self = .opus
case AudioCodec.red.rawValue:
self = .red
default:
self = .unknown
}
}

/// Initializes an `AudioCodec` instance from SFU codec model parameters.
///
/// This initializer maps an SFU codec model (`Stream_Video_Sfu_Models_Codec`)
/// to the corresponding `AudioCodec` value. If the codec name matches `opus`
/// or `red`, the respective case is assigned; otherwise, it defaults to
/// `.unknown`.
///
/// - Parameter source: The `Stream_Video_Sfu_Models_Codec` object containing
/// codec details such as the codec name.
init(_ source: Stream_Video_Sfu_Models_Codec) {
switch source.name.lowercased() {
case AudioCodec.opus.rawValue:
self = .opus
case AudioCodec.red.rawValue:
self = .red
default:
self = .unknown
}
}
}
26 changes: 26 additions & 0 deletions Sources/StreamVideo/Models/CallParticipant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,32 @@ public struct CallParticipant: Identifiable, Sendable, Hashable {
)
}

public func withUpdated(trackLookupPrefix: String) -> CallParticipant {
CallParticipant(
id: id,
userId: userId,
roles: roles,
name: name,
profileImageURL: profileImageURL,
trackLookupPrefix: trackLookupPrefix,
hasVideo: hasVideo,
hasAudio: hasAudio,
isScreenSharing: isScreensharing,
showTrack: showTrack,
track: track,
trackSize: trackSize,
screenshareTrack: screenshareTrack,
isSpeaking: isSpeaking,
isDominantSpeaker: isDominantSpeaker,
sessionId: sessionId,
connectionQuality: connectionQuality,
joinedAt: joinedAt,
audioLevel: audioLevel,
audioLevels: audioLevels,
pin: pin
)
}

public func withUpdated(
isSpeaking: Bool,
audioLevel: Float
Expand Down
Loading