public void AddFrame(byte[] colorData, ushort[] depthData, byte[] indexData) { var colorCount = Convert.ToInt32(SaveColor) + Convert.ToInt32(SaveTracked); var depthCount = Convert.ToInt32(SaveDepth) + Convert.ToInt32(SaveTracked); PoolEntry <byte> _color = null; PoolEntry <ushort> _depth = null; if (SaveColor || SaveTracked) { _color = colorPool.RequestResource(colorCount); colorData.CopyTo(_color.Resource, 0); if (SaveColor) { color.Frames.Enqueue(_color); } } if (SaveDepth || SaveTracked) { _depth = depthPool.RequestResource(depthCount); depthData.CopyTo(_depth.Resource, 0); if (SaveDepth) { depth.Frames.Enqueue(_depth); } } if (SaveTracked) { tracked.AddFrame(_depth, _color); } if (SaveIndex) { var _index = indexPool.RequestResource(1); indexData.CopyTo(_index.Resource, 0); index.Frames.Enqueue(_index); } }