public H264VideoPayloadParser(H264CodecInfo codecInfo)
        {
            if (codecInfo == null)
            {
                throw new ArgumentNullException(nameof(codecInfo));
            }
            if (codecInfo.SpsPpsBytes == null)
            {
                throw new ArgumentException($"{nameof(codecInfo.SpsPpsBytes)} is null", nameof(codecInfo));
            }

            _h264Parser = new H264Parser {
                FrameGenerated = OnFrameGenerated
            };

            if (codecInfo.SpsPpsBytes.Length != 0)
            {
                _h264Parser.Parse(DateTime.MinValue, new ArraySegment <byte>(codecInfo.SpsPpsBytes), false, false);
            }

            _nalBuffer = new ElasticBuffer(8 * 1024, 512 * 1024);
        }
        public H264VideoPayloadParser(H264CodecInfo codecInfo)
        {
            if (codecInfo == null)
            {
                throw new ArgumentNullException(nameof(codecInfo));
            }
            if (codecInfo.SpsPpsBytes == null)
            {
                throw new ArgumentException($"{nameof(codecInfo.SpsPpsBytes)} is null", nameof(codecInfo));
            }

            _h264Parser = new H264Parser(() => GetFrameTimestamp(_timeOffset))
            {
                FrameGenerated = OnFrameGenerated
            };

            if (codecInfo.SpsPpsBytes.Length != 0)
            {
                _h264Parser.Parse(new ArraySegment <byte>(codecInfo.SpsPpsBytes), false);
            }

            _nalStream = new MemoryStream(8 * 1024);
        }