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

Method CompleteAVCC

track/video.go:212–245  ·  view source on GitHub ↗
(rv *AVFrame)

Source from the content-addressed store, hash-verified

210}
211
212func (vt *Video) CompleteAVCC(rv *AVFrame) {
213 mem := vt.BytesPool.Get(5)
214 b := mem.Value
215 if rv.IFrame {
216 b[0] = 0x10 | byte(vt.CodecID)
217 } else {
218 b[0] = 0x20 | byte(vt.CodecID)
219 }
220 b[1] = 1
221 // println(rv.PTS < rv.DTS, "\t", rv.PTS, "\t", rv.DTS, "\t", rv.PTS-rv.DTS)
222 // vt.Info("cts", zap.Uint32("cts", uint32((rv.PTS-rv.DTS)/90)))
223 // 写入CTS
224 util.PutBE(b[2:5], (rv.PTS-rv.DTS)/90)
225 rv.AVCC.Push(mem)
226 // if rv.AVCC.ByteLength != 5 {
227 // panic("error")
228 // }
229 // var tmp = 0
230 rv.AUList.Range(func(au *util.BLL) bool {
231 mem = vt.BytesPool.Get(4)
232 // println(au.ByteLength)
233 util.PutBE(mem.Value, uint32(au.ByteLength))
234 rv.AVCC.Push(mem)
235 au.Range(func(slice util.Buffer) bool {
236 rv.AVCC.Push(vt.BytesPool.GetShell(slice))
237 return true
238 })
239 // tmp += 4 + au.ByteLength
240 // if rv.AVCC.ByteLength != 5+tmp {
241 // panic("error")
242 // }
243 return true
244 })
245}
246
247func (vt *Video) Flush() {
248 rv := vt.Value

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected