MCPcopy Create free account
hub / github.com/Monibuca/engine / CompleteAVCC

Method CompleteAVCC

track/h265.go:158–190  ·  view source on GitHub ↗
(rv *AVFrame)

Source from the content-addressed store, hash-verified

156}
157
158func (vt *H265) CompleteAVCC(rv *AVFrame) {
159 mem := vt.BytesPool.Get(8)
160 b := mem.Value
161 if rv.IFrame {
162 b[0] = 0b1001_0000 | byte(codec.PacketTypeCodedFrames)
163 } else {
164 b[0] = 0b1010_0000 | byte(codec.PacketTypeCodedFrames)
165 }
166 util.BigEndian.PutUint32(b[1:], codec.FourCC_H265_32)
167 // println(rv.PTS < rv.DTS, "\t", rv.PTS, "\t", rv.DTS, "\t", rv.PTS-rv.DTS)
168 // 写入CTS
169 util.PutBE(b[5:8], (rv.PTS-rv.DTS)/90)
170 rv.AVCC.Push(mem)
171 // if rv.AVCC.ByteLength != 5 {
172 // panic("error")
173 // }
174 // var tmp = 0
175 rv.AUList.Range(func(au *util.BLL) bool {
176 mem = vt.BytesPool.Get(4)
177 // println(au.ByteLength)
178 util.PutBE(mem.Value, uint32(au.ByteLength))
179 rv.AVCC.Push(mem)
180 au.Range(func(slice util.Buffer) bool {
181 rv.AVCC.Push(vt.BytesPool.GetShell(slice))
182 return true
183 })
184 // tmp += 4 + au.ByteLength
185 // if rv.AVCC.ByteLength != 5+tmp {
186 // panic("error")
187 // }
188 return true
189 })
190}
191
192// RTP格式补完
193func (vt *H265) CompleteRTP(value *AVFrame) {

Callers

nothing calls this directly

Calls 6

PutBEFunction · 0.92
GetShellMethod · 0.80
PushMethod · 0.65
GetMethod · 0.45
PutUint32Method · 0.45
RangeMethod · 0.45

Tested by

no test coverage detected