Exemple #1
0
 private void OnDisposed(object sender, EventArgs e)
 {
     //清理资源
     if (mCameraDevice != null)
     {
         mCameraDevice.release();
     }
     if (mCameraDevice != null)
     {
         mMicDevice.release();
     }
     if (mSpeakerDevice != null)
     {
         mSpeakerDevice.release();
     }
     if (mCameraDeviceList != null)
     {
         mCameraDeviceList.release();
     }
     if (mMicDeviceList != null)
     {
         mMicDeviceList.release();
     }
     if (mSpeakerDevice != null)
     {
         mSpeakerDeviceList.release();
     }
     mCameraDevice      = null;
     mMicDevice         = null;
     mSpeakerDevice     = null;
     mCameraDeviceList  = null;
     mMicDeviceList     = null;
     mSpeakerDeviceList = null;
     mTRTCCloud         = null;
 }
Exemple #2
0
 private void OnDisposed(object sender, EventArgs e)
 {
     //清理资源
     if (mTRTCCloud != null && mMainForm != null)
     {
         mTRTCCloud.enableCustomAudioCapture(false);
         mTRTCCloud.enableCustomVideoCapture(false);
         mMainForm.OnCustomCaptureAudioCallback(true);
         mMainForm.OnCustomCaptureVideoCallback(true);
         mStartCustomCaptureAudio = false;
         mStartCustomCaptureVideo = false;
         if (mAudioCustomThread != null)
         {
             mAudioCustomThread.Join();
             mAudioCustomThread.DisableComObjectEagerCleanup();
             mAudioCustomThread = null;
         }
         if (mVideoCustomThread != null)
         {
             mVideoCustomThread.Join();
             mVideoCustomThread.DisableComObjectEagerCleanup();
             mVideoCustomThread = null;
         }
     }
     mMainForm  = null;
     mTRTCCloud = null;
 }
Exemple #3
0
        public TRTCSettingForm(ITRTCCloud cloud)
        {
            InitializeComponent();

            this.Disposed += new EventHandler(OnDisposed);

            this.mTRTCCloud = cloud;

            this.resolutionComboBox.Items.Add("320 x 180");
            this.resolutionComboBox.Items.Add("320 x 240");
            this.resolutionComboBox.Items.Add("640 x 360");
            this.resolutionComboBox.Items.Add("640 x 480");
            this.resolutionComboBox.Items.Add("960 x 540");
            this.resolutionComboBox.Items.Add("1280 x 720");

            this.fpsComboBox.Items.Add("15 fps");
            this.fpsComboBox.Items.Add("20 fps");
            this.fpsComboBox.Items.Add("24 fps");

            this.qosComboBox.Items.Add("优先流畅");
            this.qosComboBox.Items.Add("优先清晰");

            this.sceneComboBox.Items.Add("在线直播");
            this.sceneComboBox.Items.Add("视频通话");

            this.controlComboBox.Items.Add("客户端控");
            this.controlComboBox.Items.Add("云端流控");
        }
Exemple #4
0
        /// <summary>
        /// 移除 View 绑定参数
        /// </summary>
        /// <param name="engine">TRTCCloud 实例,用户注册视频数据回调。</param>
        public void RemoveEngine(ITRTCCloud engine)
        {
            if (mLocalView)
            {
                TXLiteAVVideoViewManager.GetInstance().RemoveView("", mStreamType, this);
            }
            else
            {
                TXLiteAVVideoViewManager.GetInstance().RemoveView(mUserId, mStreamType, this);
            }
            int count = TXLiteAVVideoViewManager.GetInstance().Count;

            if (engine != null)
            {
                if (count == 0)
                {
                    engine.setLocalVideoRenderCallback(TRTCVideoPixelFormat.TRTCVideoPixelFormat_Unknown,
                                                       TRTCVideoBufferType.TRTCVideoBufferType_Unknown, null);
                }
                if (!mLocalView && !TXLiteAVVideoViewManager.GetInstance().HasUserId(mUserId))
                {
                    engine.setRemoteVideoRenderCallback(mUserId, TRTCVideoPixelFormat.TRTCVideoPixelFormat_Unknown,
                                                        TRTCVideoBufferType.TRTCVideoBufferType_Unknown, null);
                }
            }
            lock (mArgbFrame)
                ReleaseBuffer(mArgbFrame);
            mUserId     = "";
            mOccupy     = false;
            mLocalView  = false;
            mFirstFrame = false;
            mRenderMode = TRTCVideoFillMode.TRTCVideoFillMode_Fit;
            this.Refresh();
        }
Exemple #5
0
        private void EnterSelfRoom()
        {
            if (trtcCloud == null)
            {
                trtcCloud = ITRTCCloud.getTRTCShareInstance();
                Log.I(String.Format(" SDKVersion : {0}", trtcCloud.getSDKVersion()));
                trtcCloud.addCallback(this);

                TRTCParams trtcParams = new TRTCParams();
                trtcParams.sdkAppId      = GenerateTestUserSig.SDKAPPID;
                trtcParams.roomId        = (uint)m_nMachineGUID;
                trtcParams.userId        = "source";
                trtcParams.userSig       = GenerateTestUserSig.GetInstance().GenTestUserSig(trtcParams.userId);
                trtcParams.privateMapKey = "";
                trtcParams.businessInfo  = "";
                trtcParams.role          = TRTCRoleType.TRTCRoleAnchor;

                //trtcCloud.setVideoEncoderParam();

                // 用户进房
                TRTCVideoEncParam   encParams = DataManager.GetInstance().videoEncParams; // 视频编码参数设置
                TRTCNetworkQosParam qosParams = DataManager.GetInstance().qosParams;      // 网络流控相关参数设置
                trtcCloud.setVideoEncoderParam(ref encParams);
                trtcCloud.setSubStreamEncoderParam(ref encParams);
                trtcCloud.setNetworkQosParam(ref qosParams);

                trtcCloud.enterRoom(ref trtcParams, TRTCAppScene.TRTCAppSceneVideoCall);
            }
        }
 private void OnDisposed(object sender, EventArgs e)
 {
     //清理资源
     if (mTRTCCloud == null)
     {
         return;
     }
     if (this.micTestBtn.Text.Equals("停止"))
     {
         mTRTCCloud.stopMicDeviceTest();
     }
     if (this.speakerTestBtn.Text.Equals("停止"))
     {
         mTRTCCloud.stopSpeakerDeviceTest();
     }
     if (this.bgmTestBtn.Text.Equals("停止BGM测试"))
     {
         mTRTCCloud.stopBGM();
     }
     if (this.audioEffectTestBtn.Text.Equals("停止音效测试"))
     {
         mTRTCCloud.stopAllAudioEffects();
     }
     if (this.audioRecordBtn.Text.Equals("停止录音"))
     {
         mTRTCCloud.stopAudioRecording();
     }
     mTRTCCloud = null;
 }
        private void Screen_Loaded(object sender, RoutedEventArgs e)
        {
            trtcCloud = ITRTCCloud.getTRTCShareInstance();
            Log.I(String.Format(" SDKVersion : {0}", trtcCloud.getSDKVersion()));
            trtcCloud.addCallback(this);

            TRTCParams trtcParams = new TRTCParams();

            trtcParams.sdkAppId      = GenerateTestUserSig.SDKAPPID;
            trtcParams.roomId        = (uint)m_nPeerMachineGUID;
            trtcParams.userId        = $"ctrl_{m_nMachineGUID}";
            trtcParams.userSig       = GenerateTestUserSig.GetInstance().GenTestUserSig(trtcParams.userId);
            trtcParams.privateMapKey = "";
            trtcParams.businessInfo  = "";
            trtcParams.role          = TRTCRoleType.TRTCRoleAnchor;

            TRTCVideoEncParam   encParams = DataManager.GetInstance().videoEncParams; // 视频编码参数设置
            TRTCNetworkQosParam qosParams = DataManager.GetInstance().qosParams;      // 网络流控相关参数设置

            trtcCloud.setVideoEncoderParam(ref encParams);
            trtcCloud.setNetworkQosParam(ref qosParams);

            // 用户进房
            trtcCloud.enterRoom(ref trtcParams, TRTCAppScene.TRTCAppSceneVideoCall);
        }
Exemple #8
0
 private void OnDisposed(object sender, EventArgs e)
 {
     //清理资源
     mScreenList.release();
     mScreenList = null;
     mTRTCCloud  = null;
     mMainForm   = null;
 }
        public AudioEffectOldForm()
        {
            InitializeComponent();

            this.Disposed += new EventHandler(OnDisposed);

            mTRTCCloud = DataManager.GetInstance().trtcCloud;
        }
        public TRTCDeviceTestForm()
        {
            InitializeComponent();

            this.Disposed += new EventHandler(OnDisposed);

            mTRTCCloud = DataManager.GetInstance().trtcCloud;
        }
Exemple #11
0
        public TRTCDeviceTestForm(ITRTCCloud cloud)
        {
            InitializeComponent();

            this.Disposed += new EventHandler(OnDisposed);

            mTRTCCloud = cloud;
        }
Exemple #12
0
        public TRTCScreenForm(ITRTCCloud cloud, TRTCMainForm form)
        {
            InitializeComponent();

            this.Disposed += new EventHandler(OnDisposed);

            mTRTCCloud = cloud;
            mMainForm  = form;
        }
        private DataManager()
        {
            trtcCloud = ITRTCCloud.getTRTCShareInstance();

            storage = new IniStorage(".\\TRTCDemo.ini");

            videoEncParams = new TRTCVideoEncParam();
            qosParams      = new TRTCNetworkQosParam();
        }
Exemple #14
0
        public TRTCDeviceForm(TRTCMainForm mainform)
        {
            InitializeComponent();

            this.Disposed += new EventHandler(OnDisposed);

            mTRTCCloud = DataManager.GetInstance().trtcCloud;
            mMainForm  = mainform;
        }
        public void onExitRoom(int reason)
        {
            Log.I($"onExitRoom reason = {reason}");

            trtcCloud?.stopAllRemoteView();
            trtcCloud?.removeCallback(this);
            trtcCloud = null;

            this.Close();
        }
Exemple #16
0
 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 OnDisposed(object sender, EventArgs e)
        {
            //清理资源
            if (mTRTCCloud == null)
            {
                return;
            }

            mTRTCCloud         = null;
            AudioEffectManager = null;
        }
Exemple #18
0
        private uint mRuddiness = 0;  // 红润级别暂未生效

        public TRTCBeautyForm(ITRTCCloud cloud)
        {
            InitializeComponent();

            this.Disposed += new EventHandler(OnDisposed);

            mTRTCCloud = cloud;

            this.smoothRadioButton.Checked = true;
            UpdateBeauty();
        }
Exemple #19
0
        public MainWindow()
        {
            InitializeComponent();
            this.Closed += MainWindow_Closed;

            mTRTCCloud  = DataManager.GetInstance().trtcCloud;
            mVideoViews = new Dictionary <string, TXLiteAVVideoView>();

            // 初始化 SDK 配置并设置回调
            Log.I(String.Format(" SDKVersion : {0}", mTRTCCloud.getSDKVersion()));
            mTRTCCloud.addCallback(this);
        }
Exemple #20
0
        public TRTCScreenForm(TRTCMainForm form)
        {
            InitializeComponent();

            this.Disposed += new EventHandler(OnDisposed);

            mTRTCCloud = DataManager.GetInstance().trtcCloud;
            mMainForm  = form;

            mImageList           = new ImageList();
            mImageList.ImageSize = new Size(120, 70);
        }
        public TRTCCustomCaptureForm(TRTCMainForm mainForm)
        {
            InitializeComponent();

            this.Disposed += new EventHandler(OnDisposed);

            mTRTCCloud = DataManager.GetInstance().trtcCloud;
            mMainForm  = mainForm;

            this.customAudioComboBox.Items.Add("48_1_audio.pcm");
            this.customAudioComboBox.Items.Add("16_1_audio.pcm");
            this.customVideoComboBox.Items.Add("320x240_video.yuv");
        }
 private void OnDisposed(object sender, EventArgs e)
 {
     //清理资源
     if (mTRTCCloud != null && mMainForm != null)
     {
         mTRTCCloud.enableCustomAudioCapture(false);
         mTRTCCloud.enableCustomVideoCapture(false);
         mMainForm.OnCustomCaptureAudioCallback(true);
         mMainForm.OnCustomCaptureVideoCallback(true);
     }
     mMainForm  = null;
     mTRTCCloud = null;
 }
        public AudioSettingForm(TRTCMainForm mainform)
        {
            InitializeComponent();
            this.Disposed += new EventHandler(OnDisposed);

            mTRTCCloud = DataManager.GetInstance().trtcCloud;

            if (Util.IsSys64bit())
            {
                this.systemAudioCheckBox.Visible = false;
            }

            mMainForm = mainform;
        }
Exemple #24
0
        public void onExitRoom(int reason)
        {
            Log.I($"onExitRoom reason = {reason}");
            trtcCloud?.removeCallback(this);
            trtcCloud = null;

            if (nUseTrtcNumber > 0) //当前还有人观看,重新加入房间。
            {
                this.Dispatcher.BeginInvoke(new Action(() =>
                {
                    EnterSelfRoom();
                }));
            }
        }
 protected virtual void Dispose(bool disposing)
 {
     if (disposed)
     {
         return;
     }
     if (trtcCloud != null)
     {
         ITRTCCloud.destroyTRTCShareInstance();
         trtcCloud.Dispose();
         trtcCloud = null;
     }
     disposed = true;
 }
        private void OnDisposed(object sender, EventArgs e)
        {
            //清理资源
            if (mTRTCCloud == null)
            {
                return;
            }
            if (this.micTestBtn.Text.Equals("停止"))
            {
                mTRTCCloud.stopMicDeviceTest();
            }
            if (this.speakerTestBtn.Text.Equals("停止"))
            {
                mTRTCCloud.stopSpeakerDeviceTest();
            }

            // 注意:系统混音功能暂时不支持64位系统
            if (!Util.IsSys64bit())
            {
                if (this.systemAudioCheckBox.Checked)
                {
                    mTRTCCloud.stopSystemAudioLoopback();
                }
            }
            if (mMicDevice != null)
            {
                mMicDevice.release();
            }
            if (mSpeakerDevice != null)
            {
                mSpeakerDevice.release();
            }

            if (mMicDeviceList != null)
            {
                mMicDeviceList.release();
            }
            if (mSpeakerDeviceList != null)
            {
                mSpeakerDeviceList.release();
            }

            mMicDevice         = null;
            mSpeakerDevice     = null;
            mMicDeviceList     = null;
            mSpeakerDeviceList = null;
            mTRTCCloud         = null;
        }
        public OtherSettingForm(TRTCMainForm mainform)
        {
            InitializeComponent();

            this.Disposed += new EventHandler(OnDisposed);

            mTRTCCloud = DataManager.GetInstance().trtcCloud;
            mMainForm  = mainform;
            this.voiceCheckBox.Checked = DataManager.GetInstance().isShowVolume;

            this.mirrorCheckBox.Checked = DataManager.GetInstance().isLocalVideoMirror&& DataManager.GetInstance().isRemoteVideoMirror;

            this.customAudioComboBox.Items.Add("48_1_audio.pcm");
            this.customAudioComboBox.Items.Add("16_1_audio.pcm");
            this.customVideoComboBox.Items.Add("320x240_video.yuv");
        }
        private void OnDisposed(object sender, EventArgs e)
        {
            //清理资源
            if (mTRTCCloud == null)
            {
                return;
            }

            if (mCameraDeviceList != null)
            {
                mCameraDeviceList.release();
            }
            mCameraDeviceList = null;

            mTRTCCloud = null;
        }
        private void OnDisposed(object sender, EventArgs e)
        {
            //清理资源
            if (mTRTCCloud == null || mDeviceManager == null)
            {
                return;
            }
            if (this.micTestBtn.Text.Equals("停止"))
            {
                mDeviceManager.stopMicDeviceTest();
            }
            if (this.speakerTestBtn.Text.Equals("停止"))
            {
                mDeviceManager.stopSpeakerDeviceTest();
            }

            if (this.systemAudioCheckBox.Checked)
            {
                mTRTCCloud.stopSystemAudioLoopback();
            }

            if (mMicDevice != null)
            {
                mMicDevice.release();
            }
            if (mSpeakerDevice != null)
            {
                mSpeakerDevice.release();
            }

            if (mMicDeviceList != null)
            {
                mMicDeviceList.release();
            }
            if (mSpeakerDeviceList != null)
            {
                mSpeakerDeviceList.release();
            }

            mMicDevice         = null;
            mSpeakerDevice     = null;
            mMicDeviceList     = null;
            mSpeakerDeviceList = null;
            mTRTCCloud         = null;
            mDeviceManager     = null;
        }
Exemple #30
0
        public TRTCSettingForm()
        {
            InitializeComponent();

            this.Disposed += new EventHandler(OnDisposed);

            this.mTRTCCloud = DataManager.GetInstance().trtcCloud;

            this.qosComboBox.Items.Add("优先流畅");
            this.qosComboBox.Items.Add("优先清晰");

            this.sceneComboBox.Items.Add("在线直播");
            this.sceneComboBox.Items.Add("视频通话");

            this.controlComboBox.Items.Add("客户端控");
            this.controlComboBox.Items.Add("云端流控");
        }