SDKERR_WRONG_USAGE using startRawRecording()

Description
After updating previous version of SDK with new one, I started to face exception when starting raw recoding.

Which Windows Meeting SDK version?
Updating v5.13.1 to v5.13.5

To Reproduce(If applicable)
When ZOOM_SDK_NAMESPACE::SDKError rtn = m_pRecordController->StartRawRecording(); is invoked it returns SDKERR_WRONG_USAGE in zoom-sdk-windows\demo\sdk_demo_v2\CustomizedUIRecordMgr.cpp

It was working for my fine in previous version. Does it have something to do with newly added functions to IMeetingRecordingController?

New functions from the 3.15 SDK:

  • virtual SDKError IsSupportRequestLocalRecordingPrivilege() = 0;
  • virtual SDKError RequestLocalRecordingPrivilege() = 0;

I am using this function from 13.1 before starting raw recoding:

  • onRecordPriviligeChanged

The code where error occurs:

void CustomizedUIRecordMgr::onRecordPriviligeChanged(bool bCanRec)
{
	if (g.zoomInfo.meeting.localRecordingToken.empty()) {
		dprintf("Start local recording attempted with empty token, ignored");
		return;
	}
	if (bCanRec) {
		//::MessageBox(NULL, _T("you can record now."),     _T("winsdk demo"), MB_OK);
		dprintf_nsu("Calling StartRawRecording().\n");
		const auto now = system_clock::now();
		auto c_now = system_clock::to_time_t(now);
		StartRecording(c_now);
	} else {
		dprintf_nsu("Zoom cannot RAW record now.\n");
		//::MessageBox(NULL, _T("you can not record now."), _T("winsdk demo"), MB_OK);
	}
}
bool CustomizedUIRecordMgr::StartRecording(time_t& startTimestamp)
{
	GetRecordController();
	if (!m_pRecordController) {
		dprintf_nsu("m_pRecordController could not be acquired\n");
		return false;
	}


	ZOOM_SDK_NAMESPACE::SDKError rtn = m_pRecordController->StartRawRecording();
	if (rtn == ZOOM_SDK_NAMESPACE::SDKERR_SUCCESS) {
		dprintf_nsu("m_pRecordController->StartRawRecording() called.\n");
		return true;
	}

Device (please complete the following information):

  • Device: AWS EC2 instance c5.xlarge
  • OS: Windows Server 2019

I am certainly sure I haven’t changed anything, just copied everything from /bin directory during debugging one more time, but now I am getting EXCEPTION ACCESS VIOLATION when app should perform shutdown. It occurs on calling DestroyMeetingService and refers to sdk.dll. I cannot debug dll files from /bin since there are no .pdb files (I guess this is normal state of things in the 3rd paty c++ desktop applications). Appreciate any help on this.

@filip.hunkevych I’m on 5.16.x but these flow should apply.

  1. When the bot is in inmeeting status, check CanIStartLocalRecording
    1.1 If bot doesn’t have permission yet, request for permission via m_pRecordController->RequestLocalRecordingPrivilege();
    Use the callback onCoHostChangeNotification , onHostChangeNotification or onRecordPrivilegeChanged to check if Host has given the bot permission for recording. Assuming the host did give the bot permission, Go to Step 2.
    1.2 If bot already has permission, Go to Step 2.

2.attemptToStartRawRecording by calling StartRawRecording.

void attemptToStartRawRecording() {

	m_pRecordController = meetingService->GetMeetingRecordingController();

	SDKError err1 = m_pRecordController->StartRawRecording();
	if (err1 != SDKERR_SUCCESS) {
		std::cout << "Error occurred";
	}

	SDKError err = createRenderer(&videoHelper, videoSource);
	if (err != SDKERR_SUCCESS) {
		std::cout << "Error occurred";
		//handle error
	}
	else {
		videoHelper->setRawDataResolution(ZoomSDKResolution_720P);
		videoHelper->subscribe(getUserID(), RAW_DATA_TYPE_VIDEO);
	}

}

bool CanIStartLocalRecording()
{
	
	IMeetingRecordingController* m_pRecordController = meetingService->GetMeetingRecordingController();
	if (m_pRecordController)
	{


		SDKError err = m_pRecordController->CanStartRecording(false, 0); //0 refers to current user
		if (err != SDKERR_SUCCESS) {
			std::cout << "Cannot start local recording...\n";

			std::cout << "Requesting...\n";
			m_pRecordController->RequestLocalRecordingPrivilege();
			//handle error
			return false;
		}
		else {
			std::cout << "Can start local recording...\n";
			return true;
		}

	}
}

Thank you so much. Chun Siong. Could you also help me figure out possible reasons for exception access violation when zoom sdk is performing CleanUp? Specifically when calling DestroyMeetingService() in sdk_util.cpp. Exception refers to sdk.dll and that is everything I have.

I can see similar thread with no answer CleanUpSDK leads to eventual crash

@philip2 ,

I’m doing this, and have no issues calling cleanup.
This cleanup is invoked when the meeting ends.

void cleanup() {
	if (meetingService) DestroyMeetingService(meetingService);
	if (authService) DestroyAuthService(authService);
	if (network_connection_helper) DestroyNetworkConnectionHelper(network_connection_helper);
	CleanUPSDK(); // must do this, or it will crash. 
}
/// <summary>
/// main method for entry point
/// </summary>
/// <returns></returns>
int main()
{
	LoadConfig();
	InitSDK();

	int bRet = false;
	MSG msg;
	while (!g_exit && (bRet = GetMessage(&msg, nullptr, 0, 0)) != 0)
	{
		if (bRet == -1)
		{
			// handle the error and possibly exit
		}
		else
		{
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		}
	}
	cleanup();
	return 0;
}

@chunsiong.zoom thank you for showing me that minimalistic example is working (I didn’t have doubts about this), but just to give more context: I updated zoom from 13.1 to 13.5. I am using zoom sdk as it is (demo code) with a couple of tweeks. In 13.5 it throws exceptions either when destroying meeting service or on CleanUPSDK (if destroy meeting service is commented out). Since no files that related to creating meeting service and destroying meeting service were changed in 13.5 comparing to 13.1, it looks odd. Also, changelog of 13.5 doesn’t include any mentions regarding creating or destroying meeting service. Though, in this version it started to break. Is there any info on what exactly needs to be initialized in meeting service in order for it to be destroyed correctly? Maybe, some method that needs to be callled before destroying meeting service?

ZOOM_SDK_NAMESPACE::IMeetingService* _meeting_service;

ZOOM_SDK_NAMESPACE::IMeetingService* SDKInterfaceWrap::GetMeetingService()
{
	if (_inited && NULL == _meeting_service)
	{
		ZOOM_SDK_NAMESPACE::SDKError meetingServiceInitReturnVal = ZOOM_SDK_NAMESPACE::CreateMeetingService(&_meeting_service);
		if (meetingServiceInitReturnVal != ZOOM_SDK_NAMESPACE::SDKERR_SUCCESS) {
			dprintf_nsu("failed to initialize meeting service\n");
		} else {
			_meeting_service->SetEvent(this);
			GetMeetingParticipantsController();
			GetMeetingChatController();
		}
	}

	return _meeting_service;
}

ZOOM_SDK_NAMESPACE::SDKError SDKInterfaceWrap::Cleanup()
{
	if (_inited)
	{
		_customiezed_ui_mode = false;
		if (_auth_service)
		{
			ZOOM_SDK_NAMESPACE::DestroyAuthService(_auth_service);
			_auth_service = NULL;
		}

		if(_setting_service)
		{
			ZOOM_SDK_NAMESPACE::DestroySettingService(_setting_service);
			_setting_service = NULL;
		}

		if (_meeting_service)
		{
			ZOOM_SDK_NAMESPACE::DestroyMeetingService(_meeting_service); // here's the exception
			_meeting_service = NULL;
		}

		if (_network_connection_helper)
		{
			ZOOM_SDK_NAMESPACE::DestroyNetworkConnectionHelper(_network_connection_helper);
			_network_connection_helper = NULL;
		}
		
		if (_last_error)
		{
			_last_error = NULL;
		}
	
		ZOOM_SDK_NAMESPACE::CleanUPSDK();

		_inited = false;
		return ZOOM_SDK_NAMESPACE::SDKERR_SUCCESS;
	}
	return ZOOM_SDK_NAMESPACE::SDKERR_WRONG_USAGE;
}

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.