Ejemplo n.º 1
0
        public override void Dispose()
        {
            if (this.disposed)
            {
                return;
            }

            sourceTexture_ = null;

            // Unity API must be called from main thread.
            // This texture is referred from the rendering thread,
            // so set the delay 100ms to wait the task of another thread.
            WebRTC.DestroyOnMainThread(destTexture_, 0.1f);

            if (ptr_ != IntPtr.Zero)
            {
                // This buffer is referred from the rendering thread,
                // so set the delay 100ms to wait the task of another thread.
                WebRTC.DelayActionOnMainThread(() =>
                {
                    Marshal.FreeHGlobal(ptr_);
                }, 0.1f);
            }

            if (self != IntPtr.Zero && !WebRTC.Context.IsNull)
            {
                WebRTC.Table.Remove(self);
            }
            base.Dispose();
        }