@@ -253,10 +253,12 @@ void CAgoraCaptureVideoDlg::ResumeStatus()
253253void CAgoraCaptureVideoDlg::EnableCaputre (BOOL bEnable)
254254{
255255 if (bEnable == (BOOL)m_extenalCaptureVideo)return ;
256+
257+ int nIndex = m_cmbVideoType.GetCurSel ();
256258 if (bEnable)
257259 {
258260 // select video capture type.
259- m_agVideoCaptureDevice.SelectMediaCap (m_cmbVideoType. GetCurSel () );
261+ m_agVideoCaptureDevice.SelectMediaCap (nIndex==- 1 ? 0 :nIndex );
260262 VIDEOINFOHEADER videoInfo;
261263 VideoEncoderConfiguration config;
262264 // create video capture filter.
@@ -330,6 +332,11 @@ void CAgoraCaptureVideoDlg::OnClickedButtonStartCaputre()
330332{
331333 if (!m_extenalCaptureVideo)
332334 {
335+ if (m_cmbVideoType.GetCurSel () == -1 )
336+ {
337+ m_lstInfo.InsertString (m_lstInfo.GetCount (), _T (" can not set vitrual video capture" ));
338+ return ;
339+ }
333340 EnableExtendVideoCapture (TRUE );
334341 // register agora video frame observer.
335342 EnableCaputre (TRUE );
@@ -499,19 +506,23 @@ void CAgoraCaptureVideoDlg::OnSelchangeComboCaptureVideoDevice()
499506 VIDEOINFOHEADER vidInfoHeader;
500507 CString strInfo;
501508 CString strCompress;
502- // get current deivce name.
509+ // get current device name.
510+ m_cmbVideoType.ResetContent ();
511+
503512 BOOL bSuccess = m_agVideoCaptureDevice.GetCurrentDevice (szDevicePath, &nPathLen);
504513 if (bSuccess)
505514 m_agVideoCaptureDevice.CloseDevice ();
506515
507516 if (nSel != -1 ) {
508517 // open device.
509- m_agVideoCaptureDevice.OpenDevice (nSel);
518+ if (!m_agVideoCaptureDevice.OpenDevice (nSel))
519+ {
520+ return ;
521+ }
510522 // create capture filter.
511- m_agVideoCaptureDevice.CreateCaptureFilter ();
523+ // m_agVideoCaptureDevice.CreateCaptureFilter();
512524 }
513- m_cmbVideoType.ResetContent ();
514- // enumrate video capture device type.
525+ // enumerate video capture device type.
515526 int count = m_agVideoCaptureDevice.GetMediaCapCount ();
516527 for (int nIndex = 0 ; nIndex < count; nIndex++) {
517528 m_agVideoCaptureDevice.GetVideoCap (nIndex, &vidInfoHeader);
@@ -610,7 +621,7 @@ void CAgoraCaptureVideoDlgEngineEventHandler::onUserOffline(uid_t uid, USER_OFFL
610621 the total call time, the data traffic sent and received by THE SDK and other
611622 information. The App obtains the call duration and data statistics received
612623 or sent by the SDK through this callback.
613- parametes :
624+ parameters :
614625 stats: Call statistics.
615626*/
616627void CAgoraCaptureVideoDlgEngineEventHandler::onLeaveChannel (const RtcStats& stats)
0 commit comments