mirror of https://bitbucket.org/ausocean/av.git
codec/h264/lex.go: merge logic for start end packet writing into first if
This commit is contained in:
parent
04cd2e66ff
commit
5dfff61887
|
@ -266,24 +266,20 @@ func (l *RTPLexer) handleFUA(d []byte) {
|
||||||
// If start, form new header, skip FU indicator only and set first byte to
|
// If start, form new header, skip FU indicator only and set first byte to
|
||||||
// new header. Otherwise, skip over both FU indicator and FU header.
|
// new header. Otherwise, skip over both FU indicator and FU header.
|
||||||
if start {
|
if start {
|
||||||
|
if end {
|
||||||
|
panic("bad fragmentation packet")
|
||||||
|
}
|
||||||
const FUIndicatorIdx = 0
|
const FUIndicatorIdx = 0
|
||||||
newHead := (d[FUIndicatorIdx] & 0xe0) | (d[FUHeadIdx] & 0x1f)
|
newHead := (d[FUIndicatorIdx] & 0xe0) | (d[FUHeadIdx] & 0x1f)
|
||||||
d = d[1:]
|
d = d[1:]
|
||||||
d[0] = newHead
|
d[0] = newHead
|
||||||
} else {
|
|
||||||
d = d[2:]
|
|
||||||
}
|
|
||||||
|
|
||||||
if start {
|
|
||||||
if end {
|
|
||||||
panic("bad fragmentation packet")
|
|
||||||
}
|
|
||||||
l.frag = true
|
l.frag = true
|
||||||
l.writeWithPrefix(d)
|
l.writeWithPrefix(d)
|
||||||
} else {
|
} else {
|
||||||
if end {
|
if end {
|
||||||
l.frag = false
|
l.frag = false
|
||||||
}
|
}
|
||||||
|
d = d[2:]
|
||||||
l.writeNoPrefix(d)
|
l.writeNoPrefix(d)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue