Skip to content

Commit

Permalink
Prevent some exceptions in AV1 processing.
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanLennox committed Jul 17, 2024
1 parent 877b6a2 commit d1ff573
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 d1ff573

Please sign in to comment.