CSharpRTMP.Core.Protocols.Rtmp.OutNetRTMP4TSStream.FeedAudioData C# (CSharp) Метод

FeedAudioData() приватный Метод

private FeedAudioData ( Stream pData, uint dataLength, uint absoluteTimestamp ) : bool
pData Stream
dataLength uint
absoluteTimestamp uint
Результат bool
        private bool FeedAudioData(Stream pData, uint dataLength, uint absoluteTimestamp)
        {
            var oldPosition = pData.Position;
            if (!_videoCodecSent) return true;
            //the payload here respects this format:
            //6.2  Audio Data Transport Stream, ADTS
            //iso13818-7 page 26/206

            //1. Send the audio codec setup if necessary
            if (!_audioCodecSent)
            {
                if (Capabilities.AudioCodecId == AudioCodec.Aac)
                {
                    var codecSetup = Utils.Rms.GetStream();
                    codecSetup.WriteByte(0xaf);
                    codecSetup.WriteByte(0x00);
                    codecSetup.Write(Capabilities.Aac._pAAC,0,(int) Capabilities.Aac._aacLength);
                    codecSetup.Position = 0;
                    if (
                        !base.FeedData(codecSetup, (uint) codecSetup.Length, 0, (uint) codecSetup.Length,
                            absoluteTimestamp, true))
                    {
                        FATAL("Unable to send audio codec setup");
                        return false;
                    }
                }
                _audioCodecSent = true;
            }
            if (InStream.Type.TagKindOf(StreamTypes.ST_IN_NET_RTP))
            {
                var codec = (byte) Capabilities.AudioCodecId;
                codec = (byte) (codec << 4 | 0x0f);
                pData.Position = oldPosition;
                pData.WriteByte(codec);
                pData.WriteByte(0x01);
                pData.Position = oldPosition;
                return base.FeedData(
                    pData, //pData
                    dataLength, //dataLength
                    0, //processedLength
                    dataLength, //totalLength
                    absoluteTimestamp, //absoluteTimestamp
                    true //isAudio
                );
            }
            else
            {
                throw new NotImplementedException();
            }
        }
    }