using System; namespace Vinno.FIS.TRTCClient.ImageSender { internal class TRTCVideoFrameData : IDisposable { private readonly Action _dispose; private bool _disposed; /// /// Gets the width of image. /// public int Width { get; set; } /// /// Gets the height of the image. /// public int Height { get; set; } /// /// Gets the data of the image, which is in Bgr32 format. /// public byte[] Data { get; set; } /// /// It's a bitmap on android and uiimage on IOS /// public object ImageData { get; set; } public string Key { get; set; } public TRTCVideoFrameData(int width, int height, byte[] data, Action dispose = null) { Width = width; Height = height; Data = data; _dispose = dispose; } ~TRTCVideoFrameData() { Dispose(); } public void Dispose() { if (!_disposed) { _dispose?.Invoke(ImageData); _disposed = true; } } } }