(rtpItem *LIRTP)
| 49 | } |
| 50 | |
| 51 | func (vt *AV1) WriteRTPFrame(rtpItem *LIRTP) { |
| 52 | defer func() { |
| 53 | err := recover() |
| 54 | if err != nil { |
| 55 | vt.Error("WriteRTPFrame panic", zap.Any("err", err)) |
| 56 | vt.Publisher.Stop(zap.Any("err", err)) |
| 57 | } |
| 58 | }() |
| 59 | if vt.lastSeq != vt.lastSeq2+1 && vt.lastSeq2 != 0 { |
| 60 | vt.lostFlag = true |
| 61 | vt.Warn("lost rtp packet", zap.Uint16("lastSeq", vt.lastSeq), zap.Uint16("lastSeq2", vt.lastSeq2)) |
| 62 | } |
| 63 | frame := &rtpItem.Value |
| 64 | rv := vt.Value |
| 65 | rv.RTP.Push(rtpItem) |
| 66 | obus, err := vt.decoder.Decode(frame.Packet) |
| 67 | for _, obu := range obus { |
| 68 | var obuHeader av1.OBUHeader |
| 69 | obuHeader.Unmarshal(obu) |
| 70 | switch obuHeader.Type { |
| 71 | case av1.OBUTypeSequenceHeader: |
| 72 | rtmpHead := []byte{0b1001_0000 | byte(codec.PacketTypeMPEG2TSSequenceStart), 0, 0, 0, 0} |
| 73 | util.BigEndian.PutUint32(rtmpHead[1:], codec.FourCC_AV1_32) |
| 74 | // TODO: 生成 head |
| 75 | rtmpHead = append(rtmpHead, obu...) |
| 76 | vt.Video.WriteSequenceHead(rtmpHead) |
| 77 | vt.ParamaterSets[0] = obu |
| 78 | default: |
| 79 | rv.AUList.Push(vt.BytesPool.GetShell(obu)) |
| 80 | } |
| 81 | } |
| 82 | if err == nil { |
| 83 | vt.generateTimestamp(frame.Timestamp) |
| 84 | vt.Flush() |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | func (vt *AV1) writeAVCCFrame(ts uint32, r *util.BLLReader, frame *util.BLL) (err error) { |
| 89 | vt.Value.PTS = time.Duration(ts) * 90 |
nothing calls this directly
no test coverage detected