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
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ open class AudioRtpPacket(
cloneBuffer(BYTES_TO_LEAVE_AT_START_OF_PACKET),
BYTES_TO_LEAVE_AT_START_OF_PACKET,
length
)
).also { postClone(it) }
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class RedAudioRtpPacket(
cloneBuffer(BYTES_TO_LEAVE_AT_START_OF_PACKET),
BYTES_TO_LEAVE_AT_START_OF_PACKET,
length
)
).also { postClone(it) }

companion object {
val parser = RedPacketParser(::AudioRtpPacket)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ open class VideoRtpPacket @JvmOverloads constructor(
BYTES_TO_LEAVE_AT_START_OF_PACKET,
length,
encodingId = encodingId
)
).also { postClone(it) }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class Av1DDPacket : ParsedVideoPacket {
descriptor = descriptor,
statelessDescriptor = statelessDescriptor,
frameInfo = frameInfo
)
).also { postClone(it) }
}

fun getScalabilityStructure(eid: Int = 0, baseFrameRate: Double = 30.0): RtpEncodingDesc? {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ class Vp8Packet private constructor(
height = height,
pictureId = pictureId,
TL0PICIDX = TL0PICIDX
)
).also { postClone(it) }
}

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ class Vp9Packet private constructor(
encodingId = encodingId,
pictureId = pictureId,
TL0PICIDX = TL0PICIDX
)
).also { postClone(it) }
}

companion object {
Expand Down
2 changes: 1 addition & 1 deletion rtp/src/main/kotlin/org/jitsi/rtp/rtp/RedPacketParser.kt
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ internal class RtpRedPacket(buffer: ByteArray, offset: Int, length: Int) : RtpPa
cloneBuffer(BYTES_TO_LEAVE_AT_START_OF_PACKET),
BYTES_TO_LEAVE_AT_START_OF_PACKET,
length
)
).also { postClone(it) }

companion object {
val parser = RedPacketParser { b, o, l -> RtpPacket(b, o, l) }
Expand Down
8 changes: 7 additions & 1 deletion rtp/src/main/kotlin/org/jitsi/rtp/rtp/RtpPacket.kt
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,13 @@ open class RtpPacket(
cloneBuffer(BYTES_TO_LEAVE_AT_START_OF_PACKET),
BYTES_TO_LEAVE_AT_START_OF_PACKET,
length
).also { if (pendingHeaderExtensions != null) it.pendingHeaderExtensions = ArrayList(pendingHeaderExtensions) }
).also { postClone(it) }
}

/** Extra operations that need to be done after [clone]. All subclasses overriding [clone]
* must call this method on the newly-created clone. */
protected fun postClone(clone: RtpPacket) {
pendingHeaderExtensions?.let { clone.pendingHeaderExtensions = ArrayList(it) }
}

override fun toString(): String = buildString {
Expand Down