private void OnDispose(object sender, EventArgs e) { // 清理资源 if (isRegEngine) { mTRTCCloud.setLocalVideoRenderCallback(TRTCVideoPixelFormat.TRTCVideoPixelFormat_Unknown, TRTCVideoBufferType.TRTCVideoBufferType_Unknown, null); } mTRTCCloud = null; mArgbRenderFrame.data = null; mArgbRenderFrame = null; }
private void ReleaseBuffer(AVFrameBufferInfo info) { if (info.data != null) { info.data = null; } info.width = 0; info.height = 0; info.newFrame = false; info.rotation = TRTCVideoRotation.TRTCVideoRotation0; }
public CustomVideoPanel() { mIsStartCustomRender = false; // 默认关闭自定义渲染 mRenderMode = TRTCVideoFillMode.TRTCVideoFillMode_Fit; mArgbRenderFrame = new AVFrameBufferInfo(); // 使用双缓冲,防止绘制过程出现闪烁 SetStyle(ControlStyles.UserPaint, true); SetStyle(ControlStyles.AllPaintingInWmPaint, true); // 禁止擦除背景. SetStyle(ControlStyles.DoubleBuffer, true); // 双缓冲 this.Disposed += new EventHandler(OnDispose); }