shogo4405 / HaishinKit.swift

Camera and Microphone streaming library via RTMP and SRT for iOS, macOS, tvOS and visionOS.
BSD 3-Clause "New" or "Revised" License
2.78k stars 615 forks source link

MultiPathTCP Support #547

Closed wolfcon closed 5 years ago

wolfcon commented 5 years ago

Can support MultiPathTCP?

RTMPStream may be a problem. RTMPTStream is fine with little change in URLSessionConfiguration.

According to Apple article

When using your app on an iOS device, users are likely to move in and out of range of Wi-Fi, switching to cellular networks and back again.

Multipath TCP improves the performance of your app when a user is in a location with limited Wi-Fi and while their device is transitioning to and from cellular data usage. In its default configuration, a URL session uses a single radio for a network call, preferring Wi-Fi over cellular. However, with Multipath TCP enabled, the URL session initiates the request on both radios and selects the more responsive of the two with a preference for Wi-Fi.

URLSessionConfiguration.MultipathServiceType

// The default service type indicating that Multipath TCP should not be used.
case none
// A Multipath TCP service that provides seamless handover between Wi-Fi and cellular in order to preserve the connection.
case handover
// A service whereby Multipath TCP attempts to use the lowest-latency interface.
case interactive
// A service that aggregates the capacities of other Multipath options in an attempt to increase throughput and minimize latency.
case aggregate
shogo4405 commented 5 years ago

Can support MultiPathTCP?

No.

RTMPStream may be a problem. RTMPTStream is fine with little change in URLSessionConfiguration.

Yes. I think so.

wolfcon commented 4 years ago

About MPTCP

Use Network instead of Stream

Require iOS 12 or above

let connection = RTMPConnection()
connection.requireNetworkFramework = true
let params = NWParameters.tcp
params.multipathServiceType = .aggregate
connection.parameters = params

RTMPS or RTMPTS

Setting with URLSessionConfiguration