/// <inheritdoc/> protected override void Receive(Shared <DepthImage> sharedDepthImage, Envelope e) { using var sharedEncodedDepthImage = EncodedDepthImagePool.GetOrCreate( sharedDepthImage.Resource.Width, sharedDepthImage.Resource.Height); sharedEncodedDepthImage.Resource.EncodeFrom(sharedDepthImage.Resource, this.encoder); this.Out.Post(sharedEncodedDepthImage, e.OriginatingTime); }
/// <inheritdoc/> public void Serialize(BufferWriter writer, DepthImage depthImage, SerializationContext context) { if (this.encoder != null) { using var sharedEncodedDepthImage = EncodedDepthImagePool.GetOrCreate(depthImage.Width, depthImage.Height); sharedEncodedDepthImage.Resource.EncodeFrom(depthImage, this.encoder); Serializer.Serialize(writer, sharedEncodedDepthImage, context); } else { Serializer.Serialize(writer, depthImage, context); } }