Skip to content

Commit

Permalink
fix(core): made packet and srt packet properties non mutable
Browse files Browse the repository at this point in the history
  • Loading branch information
ThibaultBee committed Jan 8, 2025
1 parent bdd9175 commit 1cb8db0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,24 @@ open class Packet(
/**
* Contains data.
*/
var buffer: ByteBuffer,
val buffer: ByteBuffer,

/**
* Frame timestamp in µs.
*/
var ts: Long, // in µs
val ts: Long, // in µs

/**
* Packet data type
*/
var type: PacketType = PacketType.UNKNOWN,
val type: PacketType = PacketType.UNKNOWN,
) {
val isVideo = type == PacketType.VIDEO
val isAudio = type == PacketType.AUDIO

override fun toString(): String {
return "Packet(buffer=$buffer, ts=$ts, type=$type)"
}
}

enum class PacketType {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,18 @@ class SrtPacket(
/**
* [Boolean.true] if this is the first packet that describes a frame.
*/
var isFirstPacketFrame: Boolean,
val isFirstPacketFrame: Boolean,
/**
* [Boolean.true] if this is the last packet that describes a frame.
*/
var isLastPacketFrame: Boolean,
val isLastPacketFrame: Boolean,
/**
* Frame timestamp in µs.
*/
ts: Long, // in µs
) : Packet(buffer, ts)

/**
* Packet data type
*/
type: PacketType = PacketType.UNKNOWN,
) : Packet(buffer, ts, type)

0 comments on commit 1cb8db0

Please sign in to comment.