Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to ktlint-maven-plugin 1.16.0. #2029

Merged
merged 2 commits into from
Jun 15, 2023
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
10 changes: 7 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
[*.{kt,kts}]
# Comma-separated list of rules to disable (Since 0.34.0)
# Note that rules in any ruleset other than the standard ruleset will need to be prefixed
# by the ruleset identifier.
max_line_length=120

# I find trailing commas annoying
ktlint_standard_trailing-comma-on-call-site = disabled
ktlint_standard_trailing-comma-on-declaration-site = disabled

# This forbids underscores in package names, which we use
ktlint_standard_package-name = disabled
2 changes: 1 addition & 1 deletion jitsi-media-transform/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@
<plugin>
<groupId>com.github.gantsign.maven</groupId>
<artifactId>ktlint-maven-plugin</artifactId>
<version>1.13.1</version>
<version>${ktlint-maven-plugin.version}</version>
<configuration>
<sourceRoots>
<sourceRoot>${project.basedir}/src/main/kotlin</sourceRoot>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,10 @@ class MediaSourceDesc
*/
@Synchronized
fun copy() = MediaSourceDesc(
Array(this.rtpEncodings.size) { i -> this.rtpEncodings[i].copy() }, this.owner, this.sourceName, this.videoType
Array(this.rtpEncodings.size) { i -> this.rtpEncodings[i].copy() },
this.owner,
this.sourceName,
this.videoType
)

override fun toString(): String = "MediaSourceDesc[name=$sourceName owner=$owner, videoType=$videoType, " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ open class PacketInfo @JvmOverloads constructor(
clone.endpointId = endpointId
clone.layeringChanged = layeringChanged
clone.payloadVerification = payloadVerification
@Suppress("UNCHECKED_CAST") /* ArrayList.clone() really does return ArrayList, not Object. */
@Suppress("UNCHECKED_CAST") // ArrayList.clone() really does return ArrayList, not Object.
clone.onSentActions = onSentActions?.clone() as ArrayList<() -> Unit>?
return clone
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ constructor(
fun matches(ssrc: Long): Boolean {
return if (primarySSRC == ssrc) {
true
} else secondarySsrcs.containsKey(ssrc)
} else {
secondarySsrcs.containsKey(ssrc)
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,10 @@ constructor(
*/
@JvmStatic
fun indexString(index: Int): String =
if (index == SUSPENDED_INDEX) "SUSP"
else "E${getEidFromIndex(index)}S${getSidFromIndex(index)}T${getTidFromIndex(index)}"
if (index == SUSPENDED_INDEX) {
"SUSP"
} else {
"E${getEidFromIndex(index)}S${getSidFromIndex(index)}T${getTidFromIndex(index)}"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ abstract class RtpReceiver :
* input chain).
*/
abstract var packetHandler: PacketHandler?

/**
* Enqueue an incoming packet to be processed
*/
Expand Down Expand Up @@ -69,6 +70,7 @@ interface RtpReceiverEventHandler {
* We received an audio level indication from the remote endpoint.
*/
fun audioLevelReceived(sourceSsrc: Long, level: Long): Boolean = false

/**
* The estimation of the available send bandwidth changed.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ class RtpSenderImpl(
var running = true
private var localVideoSsrc: Long? = null
private var localAudioSsrc: Long? = null

// TODO(brian): this is changed to a handler instead of a queue because we want to use
// a PacketQueue, and the handler for a PacketQueue must be set at the time of creation.
// since we want the handler to be another entity (something in jvb) we just use
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ import java.util.concurrent.ExecutorService
import java.util.concurrent.ScheduledExecutorService

// This is an API class, so its usages will largely be outside of this library
@Suppress("unused")
/**
* Handles all packets (incoming and outgoing) for a particular stream.
* (TODO: 'stream' defined as what, exactly, here?)
Expand All @@ -56,6 +55,7 @@ import java.util.concurrent.ScheduledExecutorService
* have the one thread just read from the queue and send, rather than that thread
* having to read from a bunch of individual queues)
*/
@Suppress("unused")
class Transceiver(
private val id: String,
receiverExecutor: ExecutorService,
Expand All @@ -80,6 +80,7 @@ class Transceiver(
private val endpointConnectionStats = EndpointConnectionStats(logger)
private val streamInformationStore = StreamInformationStoreImpl()
val readOnlyStreamInformationStore: ReadOnlyStreamInformationStore = streamInformationStore

/**
* A central place to subscribe to be notified on the reception or transmission of RTCP packets for
* this transceiver. This is intended to be used by internal entities: mainly logic for things like generating
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ enum class VideoType {
DESKTOP,
DESKTOP_HIGH_FPS,
DISABLED,

// NONE was used in the context where an Endpoint has always one media source description. It used to cover both
// lack of the actual source and the source being temporarily disabled. With the support for multiple sources per
// endpoint DISABLED means a source is turned off. Lack of a MediaSourceDesc is equivalent to NONE.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ class Vp8Utils {
vp8Packet.payloadLength
)
return DePacketizer.VP8KeyframeHeader.getHeight(
vp8Packet.buffer, vp8Packet.payloadOffset + payloadDescriptorLen + VP8_PAYLOAD_HEADER_LEN
vp8Packet.buffer,
vp8Packet.payloadOffset + payloadDescriptorLen + VP8_PAYLOAD_HEADER_LEN
)
}

Expand All @@ -80,12 +81,16 @@ class Vp8Utils {

fun getTemporalLayerIdOfFrame(vp8Payload: ByteBuffer) =
DePacketizer.VP8PayloadDescriptor.getTemporalLayerIndex(
vp8Payload.array(), vp8Payload.arrayOffset(), vp8Payload.limit()
vp8Payload.array(),
vp8Payload.arrayOffset(),
vp8Payload.limit()
)

fun getTemporalLayerIdOfFrame(vp8Packet: RtpPacket) =
DePacketizer.VP8PayloadDescriptor.getTemporalLayerIndex(
vp8Packet.buffer, vp8Packet.payloadOffset, vp8Packet.payloadLength
vp8Packet.buffer,
vp8Packet.payloadOffset,
vp8Packet.payloadLength
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ class DtlsServer(
return dtlsServerProtocol.accept(tlsServer, datagramTransport).also {
logger.cdebug { "DTLS handshake finished" }
handshakeCompleteHandler(
tlsServer.chosenSrtpProtectionProfile, TlsRole.SERVER, tlsServer.srtpKeyingMaterial
tlsServer.chosenSrtpProtectionProfile,
TlsRole.SERVER,
tlsServer.srtpKeyingMaterial
)
}
} catch (t: Throwable) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ class DtlsStack(
)
roleSet.countDown()
}

/**
* 'start' this stack, in whatever role it has been told to operate (client or server). If a role
* has not yet been yet (via [actAsServer] or [actAsClient]), then it will block until the role
Expand Down Expand Up @@ -243,6 +244,7 @@ class DtlsStack(

companion object {
private const val QUEUE_SIZE = 50

/**
* Because generating the certificateInfo can be expensive, we generate a single
* one to be used everywhere which expires in 24 hours (when we'll generate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ class DtlsUtils {
certificateInfo: org.bouncycastle.tls.Certificate,
remoteFingerprints: Map<String, String>
) {

if (certificateInfo.certificateList.isEmpty()) {
throw DtlsException("No remote fingerprints.")
}
Expand Down Expand Up @@ -224,7 +223,7 @@ class DtlsUtils {
hashFunction = hashFunctionUpgrade
}
}
*/
*/

val certificateFingerprint = certificate.getFingerprint(hashFunction)

Expand Down Expand Up @@ -265,6 +264,7 @@ class DtlsUtils {
}

private val HEX_CHARS = "0123456789ABCDEF".toCharArray()

/**
* Helper function to convert a [ByteArray] to a colon-delimited hex string
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,14 @@ class TlsClientImpl(
(context.crypto as BcTlsCrypto),
PrivateKeyFactory.createKey(certificateInfo.keyPair.private.encoded),
certificateInfo.certificate,
if (TlsUtils.isSignatureAlgorithmsExtensionAllowed(context.serverVersion))
if (TlsUtils.isSignatureAlgorithmsExtensionAllowed(context.serverVersion)) {
SignatureAndHashAlgorithm(
HashAlgorithm.sha256,
SignatureAlgorithm.ecdsa
)
else null
} else {
null
}
)
}
return clientCredentials!!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,14 @@ class TlsServerImpl(
PrivateKeyFactory.createKey(certificateInfo.keyPair.private.encoded),
certificateInfo.certificate,
/* For DTLS 1.0 support (needed for Jigasi) we can't set this to sha256 fixed */
if (TlsUtils.isSignatureAlgorithmsExtensionAllowed(context.serverVersion)) SignatureAndHashAlgorithm(
HashAlgorithm.sha256,
SignatureAlgorithm.ecdsa
)
else null
if (TlsUtils.isSignatureAlgorithmsExtensionAllowed(context.serverVersion)) {
SignatureAndHashAlgorithm(
HashAlgorithm.sha256,
SignatureAlgorithm.ecdsa
)
} else {
null
}
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ fun RtcpFeedbackSet.supportsPli(): Boolean = this.contains("nack pli")
fun RtcpFeedbackSet.supportsFir(): Boolean = this.contains("ccm fir")
fun RtcpFeedbackSet.supportsRemb(): Boolean = this.contains("goog-remb")
fun RtcpFeedbackSet.supportsTcc(): Boolean = this.contains("transport-cc")

/**
* Represents an RTP payload type.
*
Expand Down
56 changes: 0 additions & 56 deletions jitsi-media-transform/src/main/kotlin/org/jitsi/nlj/main.kt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,18 @@ class KeyframeRequester @JvmOverloads constructor(
// Number of PLI/FIRs received and forwarded to the endpoint.
private var numPlisForwarded: Int = 0
private var numFirsForwarded: Int = 0

// Number of PLI/FIRs received but dropped due to throttling.
private var numPlisDropped: Int = 0
private var numFirsDropped: Int = 0

// Number of PLI/FIRs generated as a result of an API request or due to translation between PLI/FIR.
private var numPlisGenerated: Int = 0
private var numFirsGenerated: Int = 0

// Number of calls to requestKeyframe
private var numApiRequests: Int = 0

// Number of calls to requestKeyframe ignored due to throttling
private var numApiRequestsDropped: Int = 0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ import org.jitsi.rtp.rtcp.RtcpPacket
import org.jitsi.utils.logging2.Logger

class CompoundRtcpParser(parentLogger: Logger) : PacketParser(
"Compound RTCP parser", parentLogger,
"Compound RTCP parser",
parentLogger,
{
CompoundRtcpPacket(it.buffer, it.offset, it.length).also { compoundPacket ->
// Force packets to be evaluated to trigger any parsing errors
Expand All @@ -34,7 +35,8 @@ class CompoundRtcpParser(parentLogger: Logger) : PacketParser(
}

class SingleRtcpParser(parentLogger: Logger) : PacketParser(
"Single RTCP parser", parentLogger,
"Single RTCP parser",
parentLogger,
{
RtcpPacket.parse(it.buffer, it.offset, it.length)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,11 @@ class RedAudioRtpPacket(
}

fun removeRedAndGetRedundancyPackets(): List<AudioRtpPacket> =
if (removed) throw IllegalStateException("RED encapsulation already removed.")
else parser.decapsulate(this, parseRedundancy = true).also { removed = true }
if (removed) {
throw IllegalStateException("RED encapsulation already removed.")
} else {
parser.decapsulate(this, parseRedundancy = true).also { removed = true }
}

override fun clone(): RedAudioRtpPacket =
RedAudioRtpPacket(
Expand Down
Loading