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

Method CompleteRTP

track/h264.go:200–224  ·  view source on GitHub ↗

RTP格式补完

(value *AVFrame)

Source from the content-addressed store, hash-verified

198
199// RTP格式补完
200func (vt *H264) CompleteRTP(value *AVFrame) {
201 var out [][][]byte
202 if value.IFrame {
203 out = append(out, [][]byte{vt.SPS}, [][]byte{vt.PPS})
204 }
205 vt.Value.AUList.Range(func(au *util.BLL) bool {
206 if au.ByteLength < RTPMTU {
207 out = append(out, au.ToBuffers())
208 } else {
209 startIndex := len(out)
210 var naluType codec.H264NALUType
211 r := au.NewReader()
212 b0, _ := r.ReadByte()
213 naluType = naluType.Parse(b0)
214 b0 = codec.NALU_FUA.Or(b0 & 0x60)
215 for bufs := r.ReadN(RTPMTU); len(bufs) > 0; bufs = r.ReadN(RTPMTU) {
216 out = append(out, append([][]byte{{b0, naluType.Byte()}}, bufs...))
217 }
218 out[startIndex][0][1] |= 1 << 7 // set start bit
219 out[len(out)-1][0][1] |= 1 << 6 // set end bit
220 }
221 return true
222 })
223 vt.PacketizeRTP(out...)
224}
225
226func (vt *H264) GetNALU_SEI() (item util.LIBP) {
227 item = vt.BytesPool.Get(1)

Callers

nothing calls this directly

Calls 9

ParseMethod · 0.95
ByteMethod · 0.95
OrMethod · 0.80
PacketizeRTPMethod · 0.80
ReadByteMethod · 0.65
ReadNMethod · 0.65
RangeMethod · 0.45
ToBuffersMethod · 0.45
NewReaderMethod · 0.45

Tested by

no test coverage detected