diff --git a/jvb/src/main/kotlin/org/jitsi/videobridge/cc/av1/Av1DDQualityFilter.kt b/jvb/src/main/kotlin/org/jitsi/videobridge/cc/av1/Av1DDQualityFilter.kt index dc83977718..0ecd90324a 100644 --- a/jvb/src/main/kotlin/org/jitsi/videobridge/cc/av1/Av1DDQualityFilter.kt +++ b/jvb/src/main/kotlin/org/jitsi/videobridge/cc/av1/Av1DDQualityFilter.kt @@ -107,7 +107,7 @@ internal class Av1DDQualityFilter( val accept = doAcceptFrame(frame, incomingEncoding, externalTargetIndex, receivedTime) val currentDt = getDtFromIndex(currentIndex) val mark = currentDt != SUSPENDED_DT && - (frame.frameInfo?.spatialId == frame.structure?.decodeTargetLayers?.get(currentDt)?.spatialId) + (frame.frameInfo?.spatialId == frame.structure?.decodeTargetLayers?.getOrNull(currentDt)?.spatialId) val isResumption = (prevIndex == SUSPENDED_INDEX && currentIndex != SUSPENDED_INDEX) if (isResumption) { check(accept) { diff --git a/rtp/src/main/kotlin/org/jitsi/rtp/rtp/header_extensions/Av1DependencyDescriptorHeaderExtension.kt b/rtp/src/main/kotlin/org/jitsi/rtp/rtp/header_extensions/Av1DependencyDescriptorHeaderExtension.kt index c18061c8f7..58aa07729c 100644 --- a/rtp/src/main/kotlin/org/jitsi/rtp/rtp/header_extensions/Av1DependencyDescriptorHeaderExtension.kt +++ b/rtp/src/main/kotlin/org/jitsi/rtp/rtp/header_extensions/Av1DependencyDescriptorHeaderExtension.kt @@ -441,7 +441,8 @@ class Av1TemplateDependencyStructure( * Note this makes certain assumptions about the encoding structure. */ fun canSwitchWithoutKeyframe(fromDt: Int, toDt: Int): Boolean = templateInfo.any { - it.hasInterPictureDependency() && it.dti[fromDt] != DTI.NOT_PRESENT && it.dti[toDt] == DTI.SWITCH + it.hasInterPictureDependency() && it.dti.size > fromDt && it.dti.size > toDt && + it.dti[fromDt] != DTI.NOT_PRESENT && it.dti[toDt] == DTI.SWITCH } /** Given that we are sending packets for a given DT, return a decodeTargetBitmask corresponding to all DTs