UnmuteVideo and videoHelper->subscribe() Not working together from the same main thread

Meeting SDK Type and Version
MeetingSDK for linux version: v6.2.3.2095

Description
I have a zoom bot that successfully join a meeting. it requests for recording permissions from the host, and starts raw recording with the “subscribe” method.
I want also to send raw video to the bot’s stream.
The raw recording and the raw sending works great separately, but they don’t work together at all.

Here is what I do: (based on the sample repo)

void onInMeeting() {
	printf("onInMeeting Invoked\n");

	//double check if you are in a meeting
	if (m_pMeetingService->GetMeetingStatus() == ZOOM_SDK_NAMESPACE::MEETING_STATUS_INMEETING) {
		printf("In Meeting Now...\n");

		//print all list of participants
		IList<unsigned int>* participants = m_pMeetingService->GetMeetingParticipantsController()->GetParticipantsList();
		printf("Participants count: %d\n", participants->GetCount());
	}
    printf("Requesting local recording permissions\n");

    SDKError aisSupported = m_pRecordController->IsSupportRequestLocalRecordingPrivilege();
    std::cout << "IsSupportRequestLocalRecordingPrivilege : = " << aisSupported << std::endl;

    m_pRecordController->RequestLocalRecordingPrivilege();
}

//callback when given recording permission
void onIsGivenRecordingPermission() {
    std::cout << "Is given recording permissions now..." << std::endl;
   RawSendingBotVideo();
    SDKError CanStartRawRecording = m_pRecordController->CanStartRawRecording();
    std::cout << "CanStartRawRecording : = " << CanStartRawRecording << std::endl;
    while(CanStartRawRecording != 0){
        CanStartRawRecording = m_pRecordController->CanStartRawRecording();
        std::cout << "CanStartRawRecording : = " << CanStartRawRecording << std::endl;
        std::this_thread::sleep_for(std::chrono::seconds(1));
    }
    std::cout << "Calling  SetupRawRecording() " << std::endl;

    m_pRecordController = m_pMeetingService->GetMeetingRecordingController();
    SDKError err2 = m_pMeetingService->GetMeetingRecordingController()->CanStartRawRecording();

    if (err2 != SDKERR_SUCCESS) {
        std::cout << "Error occurred starting raw recording" << std::endl;
        my_handler(0);
    }

    SDKError err1 = m_pRecordController->StartRawRecording();
}

void RawSendingBotVideo(){
    ZoomSDKVideoSource* virtual_camera_video_source = new ZoomSDKVideoSource(DEFAULT_VIDEO_SOURCE);
    IZoomSDKVideoSourceHelper* p_videoSourceHelper = GetRawdataVideoSourceHelper();

    SDKError err = p_videoSourceHelper->setExternalVideoSource(virtual_camera_video_source);

    IMeetingVideoController* meetingController = m_pMeetingService->GetMeetingVideoController();
    SDKError err = meetingController->UnmuteVideo();
    while(err != SDKERR_SUCCESS){
        printf(" meetingController->UnmuteVideo(): Failed, error code: %d\n", err);
        std::this_thread::sleep_for(std::chrono::seconds(5));

        err = meetingController->UnmuteVideo();
        if (err != SDKERR_SUCCESS) {
            printf(" meetingController->UnmuteVideo(): Failed, error code: %d\n", err);
        }else{
            printf("meetingController->UnmuteVideo() success \n");
        }
    }
}

// Set the event listener for recording privilege status
	m_pRecordController = m_pMeetingService->GetMeetingRecordingController();
	m_pRecordController->SetEvent(new MeetingRecordingCtrlEventListener(&onIsGivenRecordingPermission));

I notied that only once the code hit m_pRecordController->StartRawRecording(); The bot video stream really starts.

This code works great, I’m getting the video sending capabilities, and I’m sending raw video frames with Libav.

Once I change the callback code a little bit and want to subscribe to a participant’s video stream, the bot not sending video anymore, just a black screen, the video source class ZoomSDKVideoSource::onInitialize method not called.

Error?
The bot sending video is black with participant’s video stream subscribe.

cc @chunsiong.zoom @donte.zoom

Solved by not blocking the main loop.