public void Initialize(ushort height, ushort width, short maxPacketSize) { _height = height; _width = width; _referenceFrame = new ParsedFrame(_videoQualityController, new byte[height * width * VideoConstants.BytesPerPixel], height, width, 0, 0, _frameBlockPool); _decodedFrame = new DecodedFrame(height, width, _frameBlockPool); _chunkHelper = new ChunkHelper(maxPacketSize, _frameBlockPool, _videoQualityController); }
/// <summary> /// Encodes a raw video image and stores the resulting blocks in an EncodedBlocks queue. /// </summary> /// <param name="image">The raw RGBA video image to be encoded.</param> /// <param name="stride">The stride of the image, i.e., whether it's encoded upside down or not</param> public void EncodeFrame(byte[] image, int stride) { _newFrame = new ParsedFrame(_videoQualityController, image, _height, _width, _frameNumber++, stride, _frameBlockPool); if (_newFrame.IsIFrame || _nextFrameIsIFrame) { _nextFrameIsIFrame = false; EnqueueAllBlocks(); } else { EnqueueChangedBlocks(); } }