(ts uint32, b util.IBytes)
| 37 | } |
| 38 | |
| 39 | func (aac *AAC) WriteADTS(ts uint32, b util.IBytes) { |
| 40 | adts := b.Bytes() |
| 41 | if aac.SequenceHead == nil { |
| 42 | profile := ((adts[2] & 0xc0) >> 6) + 1 |
| 43 | sampleRate := (adts[2] & 0x3c) >> 2 |
| 44 | channel := ((adts[2] & 0x1) << 2) | ((adts[3] & 0xc0) >> 6) |
| 45 | config1 := (profile << 3) | ((sampleRate & 0xe) >> 1) |
| 46 | config2 := ((sampleRate & 0x1) << 7) | (channel << 3) |
| 47 | aac.Media.WriteSequenceHead([]byte{0xAF, 0x00, config1, config2}) |
| 48 | aac.SampleRate = uint32(codec.SamplingFrequencies[sampleRate]) |
| 49 | aac.Channels = channel |
| 50 | aac.Parse(aac.SequenceHead[2:]) |
| 51 | aac.iframeReceived = true |
| 52 | aac.Attach() |
| 53 | } |
| 54 | aac.generateTimestamp(ts) |
| 55 | frameLen := (int(adts[3]&3) << 11) | (int(adts[4]) << 3) | (int(adts[5]) >> 5) |
| 56 | for len(adts) >= frameLen { |
| 57 | aac.Value.AUList.Push(aac.BytesPool.GetShell(adts[7:frameLen])) |
| 58 | adts = adts[frameLen:] |
| 59 | if len(adts) < 7 { |
| 60 | break |
| 61 | } |
| 62 | frameLen = (int(adts[3]&3) << 11) | (int(adts[4]) << 3) | (int(adts[5]) >> 5) |
| 63 | } |
| 64 | aac.Value.ADTS = aac.GetFromPool(b) |
| 65 | aac.Flush() |
| 66 | } |
| 67 | |
| 68 | // https://datatracker.ietf.org/doc/html/rfc3640#section-3.2.1 |
| 69 | func (aac *AAC) WriteRTPFrame(rtpItem *LIRTP) { |
nothing calls this directly
no test coverage detected