예제 #1
0
        public override void Dispose()
        {
            if (this.disposed)
            {
                return;
            }

            if (self != IntPtr.Zero && !WebRTC.Context.IsNull)
            {
                if (IsEncoderInitialized)
                {
                    WebRTC.Context.FinalizeEncoder(self);
                    if (RenderTexture.active == m_destTexture)
                    {
                        RenderTexture.active = null;
                    }

                    // Unity API must be called from main thread.
                    WebRTC.DestroyOnMainThread(m_destTexture);
                }

                if (IsDecoderInitialized)
                {
                    m_renderer.Dispose();

                    // Unity API must be called from main thread.
                    WebRTC.DestroyOnMainThread(m_destTexture);
                }

                _source?.Dispose();

                s_tracks.TryRemove(self, out var value);
            }
            base.Dispose();
        }
예제 #2
0
        /// <summary>
        ///
        /// </summary>
        public override void Dispose()
        {
            if (this.disposed)
            {
                return;
            }

            if (self != IntPtr.Zero && !WebRTC.Context.IsNull)
            {
                if (m_source != null)
                {
                    if (RenderTexture.active == m_source.destTexture_)
                    {
                        RenderTexture.active = null;
                    }
                }
                m_renderer?.Dispose();
                m_source?.Dispose();

                s_tracks.TryRemove(self, out var value);
            }
            base.Dispose();
        }