Skip to content

Commit d8314da

Browse files
authored
[Enhancement]Improve VideoCapturer handling (#878)
1 parent 9a399fd commit d8314da

File tree

8 files changed

+147
-478
lines changed

8 files changed

+147
-478
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
66

77
### 🔄 Changed
88
- Performance improvements around timers. [#877](https://github.com/GetStream/stream-video-swift/pull/877)
9+
- Improve VideoCapturer handling [#872](https://github.com/GetStream/stream-video-swift/pull/872)
910

1011
### 🐞 Fixed
1112
- An issue causing the CallSettings to be misaligned with the UI components. [#882](https://github.com/GetStream/stream-video-swift/pull/882)

Sources/StreamVideo/WebRTC/v2/PeerConnection/MediaAdapters/LocalMediaAdapters/LocalVideoMediaAdapter.swift

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import StreamWebRTC
1515
/// seamlessly with the WebRTC framework.
1616
final class LocalVideoMediaAdapter: LocalMediaAdapting, @unchecked Sendable {
1717

18-
@Injected(\.videoCapturePolicy) private var videoCapturePolicy
1918
@Injected(\.captureDeviceProvider) private var captureDeviceProvider
2019

2120
/// A unique identifier representing the current call session.
@@ -516,6 +515,12 @@ final class LocalVideoMediaAdapter: LocalMediaAdapting, @unchecked Sendable {
516515
private func adaptCaptureDimensions(
517516
for layerSettings: [Stream_Video_Sfu_Event_VideoSender]
518517
) async {
518+
guard
519+
let capturer = videoCaptureSessionProvider.activeSession?.capturer
520+
else {
521+
return
522+
}
523+
519524
let dimensions = layerSettings
520525
.map { PublishOptions.VideoPublishOptions(id: Int($0.publishOptionID), codec: VideoCodec($0.codec)) }
521526
.filter { transceiverStorage.get(for: $0)?.transceiver.sender.track != nil }
@@ -528,10 +533,7 @@ final class LocalVideoMediaAdapter: LocalMediaAdapting, @unchecked Sendable {
528533
}
529534

530535
do {
531-
try await videoCapturePolicy.updateCaptureQuality(
532-
with: preferredDimensions,
533-
for: videoCaptureSessionProvider.activeSession
534-
)
536+
try await capturer.updateCaptureQuality(preferredDimensions)
535537
} catch {
536538
log.error(error, subsystems: .sfu)
537539
}

Sources/StreamVideo/WebRTC/v2/PeerConnection/MediaAdapters/VideoCapturePolicy/VideoCapturePolicy.swift

Lines changed: 0 additions & 143 deletions
This file was deleted.

0 commit comments

Comments
 (0)