Skip to content

Commit

Permalink
Fix(AV1): Prevent some exceptions in AV1 processing. (#2191)
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanLennox authored Jul 18, 2024
1 parent e2b1c47 commit 97e03bb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 97e03bb

Please sign in to comment.