Skip to content

Commit

Permalink
fix(avc/slice): breaks doesn't stop parser loops
Browse files Browse the repository at this point in the history
  • Loading branch information
thejoeejoee committed Sep 26, 2023
1 parent 77b91dd commit 6161e63
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions avc/slice.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ func ParseSliceHeader(nalu []byte, spsMap map[uint32]*SPS, ppsMap map[uint32]*PP
if sliceType != SLICE_I && sliceType != SLICE_SI {
sh.RefPicListModificationL0Flag = r.ReadFlag()
if sh.RefPicListModificationL0Flag {
refPicListL0Loop:
for {
sh.ModificationOfPicNumsIDC = uint32(r.ReadExpGolomb())
switch sh.ModificationOfPicNumsIDC {
Expand All @@ -216,17 +217,18 @@ func ParseSliceHeader(nalu []byte, spsMap map[uint32]*SPS, ppsMap map[uint32]*PP
case 2:
sh.LongTermPicNum = uint32(r.ReadExpGolomb())
case 3:
break
break refPicListL0Loop
}
if r.AccError() != nil {
break
break refPicListL0Loop
}
}
}
}
if sliceType == SLICE_B {
sh.RefPicListModificationL1Flag = r.ReadFlag()
if sh.RefPicListModificationL1Flag {
refPicListL1Loop:
for {
sh.ModificationOfPicNumsIDC = uint32(r.ReadExpGolomb())
switch sh.ModificationOfPicNumsIDC {
Expand All @@ -235,7 +237,7 @@ func ParseSliceHeader(nalu []byte, spsMap map[uint32]*SPS, ppsMap map[uint32]*PP
case 2:
sh.LongTermPicNum = uint32(r.ReadExpGolomb())
case 3:
break
break refPicListL1Loop
}
}
}
Expand Down Expand Up @@ -299,6 +301,7 @@ func ParseSliceHeader(nalu []byte, spsMap map[uint32]*SPS, ppsMap map[uint32]*PP
} else {
sh.AdaptiveRefPicMarkingModeFlag = r.ReadFlag()
if sh.AdaptiveRefPicMarkingModeFlag {
adaptiveRefPicLoop:
for {
memoryManagementControlOperation := r.ReadExpGolomb()
switch memoryManagementControlOperation {
Expand All @@ -313,7 +316,7 @@ func ParseSliceHeader(nalu []byte, spsMap map[uint32]*SPS, ppsMap map[uint32]*PP
case 4:
sh.MaxLongTermFrameIdxPlus1 = uint32(r.ReadExpGolomb())
case 0:
break
break adaptiveRefPicLoop
}
}
}
Expand Down

0 comments on commit 6161e63

Please sign in to comment.