Files
HaishinKit.swift/RTMPHaishinKit/Sources/RTMP/RTMPStreamInfo.swift
2025-09-01 07:25:12 +09:00

31 lines
939 B
Swift

import Foundation
/// A structor that provides the statistics related to the RTMPStream.
public struct RTMPStreamInfo: Sendable {
/// The number of bytes received by the RTMPStream.
public internal(set) var byteCount = 0
/// The resource name of a stream.
public internal(set) var resourceName: String?
/// The number of bytes received per second by the RTMPStream.
public internal(set) var currentBytesPerSecond = 0
private var previousByteCount = 0
mutating func update() {
currentBytesPerSecond = byteCount - previousByteCount
previousByteCount = byteCount
}
mutating func clear() {
byteCount = 0
currentBytesPerSecond = 0
previousByteCount = 0
}
}
extension RTMPStreamInfo: CustomDebugStringConvertible {
// MARK: CustomDebugStringConvertible
public var debugDescription: String {
Mirror(reflecting: self).debugDescription
}
}