diff --git a/codec/h264/lex.go b/codec/h264/lex.go index 0883c160..a5b94bb8 100644 --- a/codec/h264/lex.go +++ b/codec/h264/lex.go @@ -274,17 +274,17 @@ func (l *RTPLexer) handleFUA(d []byte) { d = d[2:] } - switch { - case start && !end: + if start { + if end { + panic("bad fragmentation packet") + } l.frag = true l.writeWithPrefix(d) - case !start && end: - l.frag = false - fallthrough - case !start && !end: + } else { + if end { + l.frag = false + } l.writeNoPrefix(d) - default: - panic("bad fragmentation packet") } }