Skip to content

Commit

Permalink
Remove maxReceiverVideoConstraints (unused). (#2038)
Browse files Browse the repository at this point in the history
  • Loading branch information
bgrozev authored Aug 3, 2023
1 parent 99534de commit 5fd429e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 29 deletions.
34 changes: 8 additions & 26 deletions jvb/src/main/kotlin/org/jitsi/videobridge/AbstractEndpoint.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import org.jitsi.videobridge.cc.allocation.ReceiverConstraintsMap
import org.jitsi.videobridge.cc.allocation.VideoConstraints
import org.json.simple.JSONObject
import java.time.Instant
import java.util.*

/**
* Represents an endpoint in a conference (i.e. the entity associated with
Expand Down Expand Up @@ -61,7 +60,7 @@ abstract class AbstractEndpoint protected constructor(
/**
* The map of source name -> ReceiverConstraintsMap.
*/
private val receiverVideoConstraints: MutableMap<String, ReceiverConstraintsMap> = HashMap()
private val receiverVideoConstraints = mutableMapOf<String, ReceiverConstraintsMap>()

/**
* The statistics id of this <tt>Endpoint</tt>.
Expand All @@ -81,26 +80,17 @@ abstract class AbstractEndpoint protected constructor(
var isExpired = false
private set

/**
* The maximum set of constraints applied by all receivers of this endpoint
* in the conference. The client needs to send _at least_ this to satisfy
* all receivers.
*
*/
@Deprecated("Use maxReceiverVideoConstraintsMap.")
protected var maxReceiverVideoConstraints = VideoConstraints(0, 0.0)

/**
* A map of source name -> VideoConstraints.
*
* Stores the maximum set of constraints applied by all receivers for each media source sent by this endpoint.
* The client needs to send _at least_ this for a media source to satisfy all its receivers.
*/
protected var maxReceiverVideoConstraintsMap: MutableMap<String, VideoConstraints> = HashMap()
protected var maxReceiverVideoConstraints = mutableMapOf<String, VideoConstraints>()

protected val eventEmitter: EventEmitter<EventHandler> = SyncEventEmitter()

protected var videoTypeCache: MutableMap<String, VideoType> = HashMap()
private val videoTypeCache = mutableMapOf<String, VideoType>()

fun hasVideoAvailable(): Boolean {
for (source in mediaSources) {
Expand Down Expand Up @@ -177,12 +167,7 @@ abstract class AbstractEndpoint protected constructor(
eventEmitter.removeHandler(eventHandler)
}

/**
* {@inheritDoc}
*/
override fun toString(): String {
return javaClass.name + " " + id
}
override fun toString() = "${javaClass.name} $id"

/**
* Expires this [AbstractEndpoint].
Expand Down Expand Up @@ -224,10 +209,7 @@ abstract class AbstractEndpoint protected constructor(
*/
abstract fun requestKeyframe()

/**
* A JSON representation of the parts of this object's state that
* are deemed useful for debugging.
*/
/** A JSON representation of the parts of this object's state that are deemed useful for debugging. */
open val debugState: JSONObject
get() {
val debugState = JSONObject()
Expand All @@ -236,7 +218,7 @@ abstract class AbstractEndpoint protected constructor(
receiverVideoConstraints[sourceName] = receiverConstraints.getDebugState()
}
debugState["receiverVideoConstraints"] = receiverVideoConstraints
debugState["maxReceiverVideoConstraintsMap"] = HashMap(maxReceiverVideoConstraintsMap)
debugState["maxReceiverVideoConstraints"] = HashMap(maxReceiverVideoConstraints)
debugState["expired"] = isExpired
debugState["statsId"] = statsId
return debugState
Expand All @@ -251,10 +233,10 @@ abstract class AbstractEndpoint protected constructor(
* (Currently we only support constraining the height, and not frame rate.)
*/
private fun receiverVideoConstraintsChanged(sourceName: String, newMaxHeight: Int) {
val oldReceiverMaxVideoConstraints = maxReceiverVideoConstraintsMap[sourceName]
val oldReceiverMaxVideoConstraints = maxReceiverVideoConstraints[sourceName]
val newReceiverMaxVideoConstraints = VideoConstraints(newMaxHeight, -1.0)
if (newReceiverMaxVideoConstraints != oldReceiverMaxVideoConstraints) {
maxReceiverVideoConstraintsMap[sourceName] = newReceiverMaxVideoConstraints
maxReceiverVideoConstraints[sourceName] = newReceiverMaxVideoConstraints
sendVideoConstraintsV2(sourceName, newReceiverMaxVideoConstraints)
}
}
Expand Down
4 changes: 2 additions & 2 deletions jvb/src/main/kotlin/org/jitsi/videobridge/Endpoint.kt
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ class Endpoint @JvmOverloads constructor(
}

private fun sendAllVideoConstraints() {
maxReceiverVideoConstraintsMap.forEach { (sourceName, constraints) ->
maxReceiverVideoConstraints.forEach { (sourceName, constraints) ->
sendVideoConstraintsV2(sourceName, constraints)
}
}
Expand Down Expand Up @@ -591,7 +591,7 @@ class Endpoint @JvmOverloads constructor(
logger.cdebug { "Sender constraints changed: ${senderSourceConstraintsMessage.toJson()}" }
sendMessage(senderSourceConstraintsMessage)
} else {
maxReceiverVideoConstraintsMap[sourceName]?.let {
maxReceiverVideoConstraints[sourceName]?.let {
sendVideoConstraints(it)
}
?: logger.error("No max receiver constraints mapping found for: $sourceName")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ class RelayedEndpoint(
}

fun relayMessageTransportConnected() {
maxReceiverVideoConstraintsMap.forEach { (sourceName, constraints) ->
maxReceiverVideoConstraints.forEach { (sourceName, constraints) ->
sendVideoConstraintsV2(sourceName, constraints)
}
}
Expand Down

0 comments on commit 5fd429e

Please sign in to comment.