Skip to content
Merged
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
1 change: 1 addition & 0 deletions .changes/transceiver-refix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
patch type="fixed" "Restrict transceiver memory leak fix to video tracks"
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ let package = Package(
],
dependencies: [
// LK-Prefixed Dynamic WebRTC XCFramework
.package(url: "https://github.com/livekit/webrtc-xcframework.git", exact: "137.7151.04"),
.package(url: "https://github.com/livekit/webrtc-xcframework.git", exact: "137.7151.05"),
.package(url: "https://github.com/apple/swift-protobuf.git", from: "1.29.0"),
.package(url: "https://github.com/apple/swift-log.git", from: "1.6.2"),
.package(url: "https://github.com/apple/swift-collections.git", from: "1.1.0"),
Expand Down
2 changes: 1 addition & 1 deletion [email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ let package = Package(
],
dependencies: [
// LK-Prefixed Dynamic WebRTC XCFramework
.package(url: "https://github.com/livekit/webrtc-xcframework.git", exact: "137.7151.04"),
.package(url: "https://github.com/livekit/webrtc-xcframework.git", exact: "137.7151.05"),
.package(url: "https://github.com/apple/swift-protobuf.git", from: "1.29.0"),
.package(url: "https://github.com/apple/swift-log.git", from: "1.6.2"),
.package(url: "https://github.com/apple/swift-collections.git", from: "1.1.0"),
Expand Down
13 changes: 13 additions & 0 deletions Sources/LiveKit/Core/Transport.swift
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,19 @@ extension Transport {
guard _pc.removeTrack(sender) else {
throw LiveKitError(.webRTC, message: "Failed to remove track")
}

releaseTransceiver(sender: sender)
}

// Try to stop the transceiver and free the resources
// Workaround: https://groups.google.com/g/discuss-webrtc/c/WDsGuVucBjQ?pli=1
private func releaseTransceiver(sender: LKRTCRtpSender) {
if let transceiver = _pc.transceivers.first(where: { $0.sender == sender }),
transceiver.mediaType == .video, !transceiver.isStopped
{
log("Stopping video transceiver", .debug)
transceiver.stopInternal()
}
}

func dataChannel(for label: String,
Expand Down
Loading