(ts uint32, frame *util.BLL, pool util.BytesPool)
| 84 | } |
| 85 | |
| 86 | func (p *Publisher) WriteAVCCVideo(ts uint32, frame *util.BLL, pool util.BytesPool) { |
| 87 | if frame.ByteLength < 6 { |
| 88 | return |
| 89 | } |
| 90 | if p.VideoTrack == nil { |
| 91 | b0 := frame.GetByte(0) |
| 92 | // https://github.com/veovera/enhanced-rtmp/blob/main/enhanced-rtmp-v1.pdf |
| 93 | if isExtHeader := b0 & 0b1000_0000; isExtHeader != 0 { |
| 94 | fourCC := frame.GetUintN(1, 4) |
| 95 | switch fourCC { |
| 96 | case codec.FourCC_H265_32: |
| 97 | p.VideoTrack = track.NewH265(p, pool) |
| 98 | p.VideoTrack.WriteAVCC(ts, frame) |
| 99 | case codec.FourCC_AV1_32: |
| 100 | p.VideoTrack = track.NewAV1(p, pool) |
| 101 | p.VideoTrack.WriteAVCC(ts, frame) |
| 102 | } |
| 103 | } else { |
| 104 | if frame.GetByte(1) == 0 { |
| 105 | ts = 0 |
| 106 | p.CreateVideoTrack(codec.VideoCodecID(b0&0x0F), pool) |
| 107 | if p.VideoTrack == nil { |
| 108 | p.Stream.Error("video codecID not support", zap.Uint8("codeId", uint8(codec.VideoCodecID(b0&0x0F)))) |
| 109 | return |
| 110 | } |
| 111 | p.VideoTrack.WriteAVCC(ts, frame) |
| 112 | } else { |
| 113 | p.Stream.Warn("need sequence frame") |
| 114 | } |
| 115 | } |
| 116 | } else { |
| 117 | p.VideoTrack.WriteAVCC(ts, frame) |
| 118 | } |
| 119 | } |
| 120 | |
| 121 | func (p *Publisher) WriteAVCCAudio(ts uint32, frame *util.BLL, pool util.BytesPool) { |
| 122 | if frame.ByteLength < 4 { |
nothing calls this directly
no test coverage detected