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

Method CompleteRTP

track/h265.go:193–219  ·  view source on GitHub ↗

RTP格式补完

(value *AVFrame)

Source from the content-addressed store, hash-verified

191
192// RTP格式补完
193func (vt *H265) CompleteRTP(value *AVFrame) {
194 // H265打包: https://blog.csdn.net/fanyun_01/article/details/114234290
195 var out [][][]byte
196 if value.IFrame {
197 out = append(out, [][]byte{vt.VPS}, [][]byte{vt.SPS}, [][]byte{vt.PPS})
198 }
199 vt.Value.AUList.Range(func(au *util.BLL) bool {
200 if au.ByteLength < RTPMTU {
201 out = append(out, au.ToBuffers())
202 } else {
203 startIndex := len(out)
204 var naluType codec.H265NALUType
205 r := au.NewReader()
206 b0, _ := r.ReadByte()
207 b1, _ := r.ReadByte()
208 naluType = naluType.Parse(b0)
209 b0 = (byte(codec.NAL_UNIT_RTP_FU) << 1) | (b0 & 0b10000001)
210 for bufs := r.ReadN(RTPMTU); len(bufs) > 0; bufs = r.ReadN(RTPMTU) {
211 out = append(out, append([][]byte{{b0, b1, byte(naluType)}}, bufs...))
212 }
213 out[startIndex][0][2] |= 1 << 7 // set start bit
214 out[len(out)-1][0][2] |= 1 << 6 // set end bit
215 }
216 return true
217 })
218 vt.PacketizeRTP(out...)
219}
220
221func (vt *H265) GetNALU_SEI() (item util.LIBP) {
222 item = vt.BytesPool.Get(1)

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected