mirror of
https://github.com/eerimoq/moblin.git
synced 2026-07-04 15:06:48 +00:00
Debug toggle to enable/disable SRT(LA) packet padding.
This commit is contained in:
@@ -203660,6 +203660,9 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"SRT(LA) packet padding" : {
|
||||
|
||||
},
|
||||
"SRT(LA) port number missing" : {
|
||||
"localizations" : {
|
||||
|
||||
@@ -77,6 +77,7 @@ class RemoteConnection: @unchecked Sendable {
|
||||
private(set) var destinationHost: NWEndpoint.Host?
|
||||
private(set) var destinationPort: NWEndpoint.Port?
|
||||
private let mpegtsPacketsPerPacket: Int
|
||||
private let packetPadding: Bool
|
||||
var typeString: String {
|
||||
switch type {
|
||||
case .wifi:
|
||||
@@ -100,6 +101,7 @@ class RemoteConnection: @unchecked Sendable {
|
||||
init(
|
||||
type: NWInterface.InterfaceType?,
|
||||
mpegtsPacketsPerPacket: Int,
|
||||
packetPadding: Bool,
|
||||
interface: NWInterface?,
|
||||
networkInterfaces: SrtlaNetworkInterfaces,
|
||||
priority: Float,
|
||||
@@ -108,6 +110,7 @@ class RemoteConnection: @unchecked Sendable {
|
||||
) {
|
||||
self.type = type
|
||||
self.mpegtsPacketsPerPacket = mpegtsPacketsPerPacket
|
||||
self.packetPadding = packetPadding
|
||||
self.interface = interface
|
||||
self.networkInterfaces = networkInterfaces
|
||||
self.priority = priority
|
||||
@@ -360,7 +363,7 @@ class RemoteConnection: @unchecked Sendable {
|
||||
packetsInFlight.insert(getSrtSequenceNumber(packet: packet))
|
||||
var numberOfMpegTsPackets = (packet.count - 16) / MpegTsPacket.size
|
||||
numberOfNonNullPacketsSent += UInt64(numberOfMpegTsPackets)
|
||||
if numberOfMpegTsPackets < mpegtsPacketsPerPacket {
|
||||
if packetPadding, numberOfMpegTsPackets < mpegtsPacketsPerPacket {
|
||||
var paddedPacket = packet
|
||||
while numberOfMpegTsPackets < mpegtsPacketsPerPacket {
|
||||
paddedPacket.append(nullPacket)
|
||||
|
||||
@@ -42,6 +42,7 @@ class SrtlaClient: NSObject, @unchecked Sendable {
|
||||
|
||||
private let networkPathMonitor = NWPathMonitor()
|
||||
private let mpegtsPacketsPerPacket: Int
|
||||
private let packetPadding: Bool
|
||||
private var host: String = ""
|
||||
private var port: Int = 0
|
||||
private var groupId: Data?
|
||||
@@ -56,6 +57,7 @@ class SrtlaClient: NSObject, @unchecked Sendable {
|
||||
delegate: any SrtlaDelegate,
|
||||
passThrough: Bool,
|
||||
mpegtsPacketsPerPacket: Int,
|
||||
packetPadding: Bool,
|
||||
networkInterfaceNames: [SettingsNetworkInterfaceName],
|
||||
connectionPriorities: SettingsStreamSrtConnectionPriorities,
|
||||
srtImplementation: SettingsStreamSrtImplementation
|
||||
@@ -63,6 +65,7 @@ class SrtlaClient: NSObject, @unchecked Sendable {
|
||||
self.delegate = delegate
|
||||
self.passThrough = passThrough
|
||||
self.mpegtsPacketsPerPacket = mpegtsPacketsPerPacket
|
||||
self.packetPadding = packetPadding
|
||||
networkInterfaces = .init()
|
||||
self.connectionPriorities = .init()
|
||||
self.srtImplementation = srtImplementation
|
||||
@@ -74,6 +77,7 @@ class SrtlaClient: NSObject, @unchecked Sendable {
|
||||
remoteConnections.append(RemoteConnection(
|
||||
type: nil,
|
||||
mpegtsPacketsPerPacket: mpegtsPacketsPerPacket,
|
||||
packetPadding: packetPadding,
|
||||
interface: nil,
|
||||
networkInterfaces: networkInterfaces,
|
||||
priority: 1.0
|
||||
@@ -151,6 +155,7 @@ class SrtlaClient: NSObject, @unchecked Sendable {
|
||||
let remoteConnection = RemoteConnection(
|
||||
type: .other,
|
||||
mpegtsPacketsPerPacket: self.mpegtsPacketsPerPacket,
|
||||
packetPadding: self.packetPadding,
|
||||
interface: nil,
|
||||
networkInterfaces: self.networkInterfaces,
|
||||
priority: self.getRelayConnectionPriority(relayId: id),
|
||||
@@ -319,6 +324,7 @@ class SrtlaClient: NSObject, @unchecked Sendable {
|
||||
newRemoteConnections.append(RemoteConnection(
|
||||
type: interface.type,
|
||||
mpegtsPacketsPerPacket: mpegtsPacketsPerPacket,
|
||||
packetPadding: self.packetPadding,
|
||||
interface: interface,
|
||||
networkInterfaces: networkInterfaces,
|
||||
priority: getConnectionPriority(name: name)
|
||||
|
||||
@@ -199,6 +199,7 @@ final class Media: NSObject, @unchecked Sendable {
|
||||
overheadBandwidth: Int32,
|
||||
maximumBandwidthFollowInput: Bool,
|
||||
mpegtsPacketsPerPacket: Int,
|
||||
packetPadding: Bool,
|
||||
networkInterfaceNames: [SettingsNetworkInterfaceName],
|
||||
connectionPriorities: SettingsStreamSrtConnectionPriorities,
|
||||
dnsLookupStrategy: SettingsDnsLookupStrategy
|
||||
@@ -213,6 +214,7 @@ final class Media: NSObject, @unchecked Sendable {
|
||||
overheadBandwidth: overheadBandwidth,
|
||||
maximumBandwidthFollowInput: maximumBandwidthFollowInput,
|
||||
mpegtsPacketsPerPacket: mpegtsPacketsPerPacket,
|
||||
packetPadding: packetPadding,
|
||||
networkInterfaceNames: networkInterfaceNames,
|
||||
connectionPriorities: connectionPriorities
|
||||
)
|
||||
@@ -229,6 +231,7 @@ final class Media: NSObject, @unchecked Sendable {
|
||||
overheadBandwidth: Int32,
|
||||
maximumBandwidthFollowInput: Bool,
|
||||
mpegtsPacketsPerPacket: Int,
|
||||
packetPadding: Bool,
|
||||
networkInterfaceNames: [SettingsNetworkInterfaceName],
|
||||
connectionPriorities: SettingsStreamSrtConnectionPriorities
|
||||
) {
|
||||
@@ -245,6 +248,7 @@ final class Media: NSObject, @unchecked Sendable {
|
||||
delegate: self,
|
||||
passThrough: !isSrtla,
|
||||
mpegtsPacketsPerPacket: mpegtsPacketsPerPacket,
|
||||
packetPadding: packetPadding,
|
||||
networkInterfaceNames: networkInterfaceNames,
|
||||
connectionPriorities: connectionPriorities,
|
||||
srtImplementation: srtImplementation
|
||||
|
||||
@@ -213,6 +213,7 @@ extension Model {
|
||||
overheadBandwidth: database.debug.srtOverheadBandwidth,
|
||||
maximumBandwidthFollowInput: database.debug.maximumBandwidthFollowInput,
|
||||
mpegtsPacketsPerPacket: srt.mpegtsPacketsPerPacket(),
|
||||
packetPadding: database.debug.packetPadding,
|
||||
networkInterfaceNames: database.networkInterfaceNames,
|
||||
connectionPriorities: srt.connectionPriorities,
|
||||
dnsLookupStrategy: srt.dnsLookupStrategy
|
||||
|
||||
@@ -51,6 +51,7 @@ class SettingsDebug: Codable, ObservableObject {
|
||||
@Published var videoBitrateChange: Bool = false
|
||||
@Published var highQualityDownsampling: Bool = false
|
||||
@Published var httpProxy: Bool = false
|
||||
@Published var packetPadding: Bool = false
|
||||
|
||||
enum CodingKeys: CodingKey {
|
||||
case logLevel
|
||||
@@ -94,6 +95,7 @@ class SettingsDebug: Codable, ObservableObject {
|
||||
case videoBitrateChangeEnabled
|
||||
case highQualityDownsampling
|
||||
case httpProxy3
|
||||
case packetPadding
|
||||
}
|
||||
|
||||
func encode(to encoder: any Encoder) throws {
|
||||
@@ -132,6 +134,7 @@ class SettingsDebug: Codable, ObservableObject {
|
||||
try container.encode(.videoBitrateChangeEnabled, videoBitrateChange)
|
||||
try container.encode(.highQualityDownsampling, highQualityDownsampling)
|
||||
try container.encode(.httpProxy3, httpProxy)
|
||||
try container.encode(.packetPadding, packetPadding)
|
||||
}
|
||||
|
||||
init() {}
|
||||
@@ -184,5 +187,6 @@ class SettingsDebug: Codable, ObservableObject {
|
||||
videoBitrateChange = container.decode(.videoBitrateChangeEnabled, Bool.self, false)
|
||||
highQualityDownsampling = container.decode(.highQualityDownsampling, Bool.self, false)
|
||||
httpProxy = container.decode(.httpProxy3, Bool.self, false)
|
||||
packetPadding = container.decode(.packetPadding, Bool.self, false)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,6 +121,7 @@ struct DebugSettingsView: View {
|
||||
.onChange(of: debug.httpProxy) { _ in
|
||||
model.httpProxyServerChanged()
|
||||
}
|
||||
Toggle("SRT(LA) packet padding", isOn: $debug.packetPadding)
|
||||
} header: {
|
||||
Text("Experimental")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user