(ts uint32, frame *util.BLL, pool util.BytesPool)
| 119 | } |
| 120 | |
| 121 | func (p *Publisher) WriteAVCCAudio(ts uint32, frame *util.BLL, pool util.BytesPool) { |
| 122 | if frame.ByteLength < 4 { |
| 123 | return |
| 124 | } |
| 125 | if p.AudioTrack == nil { |
| 126 | b0 := frame.GetByte(0) |
| 127 | t := p.CreateAudioTrack(codec.AudioCodecID(b0>>4), pool) |
| 128 | switch a := t.(type) { |
| 129 | case *track.AAC: |
| 130 | if frame.GetByte(1) != 0 { |
| 131 | return |
| 132 | } |
| 133 | a.AVCCHead = []byte{frame.GetByte(0), 1} |
| 134 | a.WriteAVCC(0, frame) |
| 135 | case *track.G711: |
| 136 | a.Audio.SampleRate = uint32(codec.SoundRate[(b0&0x0c)>>2]) |
| 137 | if b0&0x02 == 0 { |
| 138 | a.Audio.SampleSize = 8 |
| 139 | } |
| 140 | a.Channels = b0&0x01 + 1 |
| 141 | a.AVCCHead = []byte{b0} |
| 142 | a.WriteAVCC(ts, frame) |
| 143 | default: |
| 144 | p.Stream.Error("audio codec not support yet", zap.Uint8("codecId", uint8(codec.AudioCodecID(b0>>4)))) |
| 145 | } |
| 146 | } else { |
| 147 | p.AudioTrack.WriteAVCC(ts, frame) |
| 148 | } |
| 149 | } |
nothing calls this directly
no test coverage detected