From 35069bd4f3071d76785a7f2184c780e64148ca19 Mon Sep 17 00:00:00 2001 From: Saxon Date: Thu, 23 May 2019 13:55:25 +0930 Subject: [PATCH] codec/h264/lex.go: using if and else statements rather than switch for start and end indicator logic in handleFUA --- codec/h264/lex.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) 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") } }