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

Method writeAVCCFrame

track/video.go:120–139  ·  view source on GitHub ↗
(ts uint32, r *util.BLLReader, frame *util.BLL)

Source from the content-addressed store, hash-verified

118}
119
120func (vt *Video) writeAVCCFrame(ts uint32, r *util.BLLReader, frame *util.BLL) (err error) {
121 var cts uint32
122 cts, err = r.ReadBE(3)
123 if err != nil {
124 return err
125 }
126 vt.Value.PTS = time.Duration(ts+cts) * 90
127 vt.Value.DTS = time.Duration(ts) * 90
128 var nalulen uint32
129 for nalulen, err = r.ReadBE(vt.nalulenSize); err == nil; nalulen, err = r.ReadBE(vt.nalulenSize) {
130 if remain := frame.ByteLength - r.GetOffset(); remain < int(nalulen) {
131 vt.Error("read nalu length error", zap.Int("nalulen", int(nalulen)), zap.Int("remain", remain))
132 frame.Recycle()
133 vt.Value.Reset()
134 return
135 }
136 vt.AppendAuBytes(r.ReadN(int(nalulen))...)
137 }
138 return nil
139}
140
141func (vt *Video) WriteAVCC(ts uint32, frame *util.BLL) (err error) {
142 if l := frame.ByteLength; l < 6 {

Callers

nothing calls this directly

Calls 7

ReadBEMethod · 0.80
GetOffsetMethod · 0.80
AppendAuBytesMethod · 0.80
ErrorMethod · 0.65
RecycleMethod · 0.65
ResetMethod · 0.65
ReadNMethod · 0.65

Tested by

no test coverage detected