Skip to content

Commit

Permalink
Make tests compile again
Browse files Browse the repository at this point in the history
  • Loading branch information
ipavlidakis committed Dec 19, 2024
1 parent ffbfbce commit f08b4b6
Show file tree
Hide file tree
Showing 5 changed files with 486 additions and 463 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,18 @@ final class LocalVideoMediaAdapter: LocalMediaAdapting, @unchecked Sendable {
/// A storage container for managing video transceivers.
private let transceiverStorage = MediaTransceiverStorage<PublishOptions.VideoPublishOptions>(for: .video)

/// The primary video track used in the current session.
let primaryTrack: RTCVideoTrack

/// A provider for managing the video capture session.
private let videoCaptureSessionProvider: VideoCaptureSessionProvider

/// The capturer responsible for capturing video frames.
private var capturer: StreamVideoCapturer?

/// A publisher that emits events related to video track changes.
let subject: PassthroughSubject<TrackEvent, Never>

/// A container for managing cancellable tasks to ensure proper cleanup.
private let disposableBag = DisposableBag()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ extension WebRTCCoordinator.StateMachine.Stage {
/// Executes the disconnected stage logic.
private func execute() {
context.sfuEventObserver = nil
context.flowError = nil
context.disconnectionSource = nil
Task {
let statsReporter = await context
Expand All @@ -128,6 +127,7 @@ extension WebRTCCoordinator.StateMachine.Stage {
try transition?(.migrating(context))
case .unknown:
if let error = context.flowError {
context.flowError = nil
try transition?(.error(context, error: error))
} else {
try transition?(.leaving(context))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,14 @@ final class RTCRtpTransceiverInit_Tests: XCTestCase {
XCTAssertEqual(
subject.direction,
direction,
"direction should be \(direction).",
file: file,
line: line
)
XCTAssertEqual(
subject.streamIds,
[streamID],
"streamIds should be \([streamID]).",
file: file,
line: line
)
Expand All @@ -202,13 +204,15 @@ final class RTCRtpTransceiverInit_Tests: XCTestCase {
XCTAssertEqual(
subject.sendEncodings.count,
1,
"sendEncoding count should be 1.",
file: file,
line: line
)
} else {
XCTAssertEqual(
subject.sendEncodings.count,
videoOptions.capturingLayers.spatialLayers,
"sendEncodings count should be \(videoOptions.capturingLayers.spatialLayers).",
file: file,
line: line
)
Expand All @@ -220,20 +224,23 @@ final class RTCRtpTransceiverInit_Tests: XCTestCase {
XCTAssertEqual(
sendEncoding.rid,
VideoLayer.Quality.quarter.rawValue,
"rid should be set to \(VideoLayer.Quality.quarter.rawValue).",
file: file,
line: line
)
case 1:
XCTAssertEqual(
sendEncoding.rid,
VideoLayer.Quality.half.rawValue,
"rid should be set to \(VideoLayer.Quality.half.rawValue).",
file: file,
line: line
)
case 2:
XCTAssertEqual(
sendEncoding.rid,
VideoLayer.Quality.full.rawValue,
"rid should be set to \(VideoLayer.Quality.full.rawValue).",
file: file,
line: line
)
Expand All @@ -247,31 +254,42 @@ final class RTCRtpTransceiverInit_Tests: XCTestCase {
XCTAssertEqual(
sendEncoding.maxFramerate?.intValue,
videoOptions.frameRate,
"frameRate should be set to \(videoOptions.frameRate).",
file: file,
line: line
)
XCTAssertEqual(
sendEncoding.maxBitrateBps?.intValue,
videoOptions.bitrate / scaleDownFactor,
file: file,
line: line
)
XCTAssertEqual(
sendEncoding.scaleResolutionDownBy?.intValue,
scaleDownFactor,
"bitrate should be set to \(videoOptions.bitrate / scaleDownFactor).",
file: file,
line: line
)
if videoOptions.codec.isSVC {
XCTAssertNil(
sendEncoding.scaleResolutionDownBy,
"scaleDownFactor should not be set.",
file: file,
line: line
)
XCTAssertEqual(
sendEncoding.scalabilityMode,
videoOptions.capturingLayers.scalabilityMode,
"scalability mode should be set to \(videoOptions.capturingLayers.scalabilityMode).",
file: file,
line: line
)
} else {
XCTAssertEqual(
sendEncoding.scaleResolutionDownBy?.intValue,
scaleDownFactor,
"scaleDownFactor should be set to \(scaleDownFactor).",
file: file,
line: line
)
XCTAssertNil(
sendEncoding.scalabilityMode,
"scalability mode should not be set.",
file: file,
line: line
)
Expand Down
Loading

0 comments on commit f08b4b6

Please sign in to comment.