Get raw data from each user usin meetingsdx-linux-raw-recording-sample

I have a problem with getting raw data from participates of meeting
Now I can get data only from one participate, for get data from another one I ned to do like this

backend-1        | (onRawDataStatusChanged.   Status:     1
backend-1        | (onRawDataStatusChanged.   Status:     1
backend-1        | (onRawDataStatusChanged.   Status:     0
backend-1        | 40.241371% – userId: 2147487664[2024-08-01 15:28:08] [frame_header] Dispatching write containing 1 message(s) containing 6 header bytes and 40 payload bytes
backend-1        | [2024-08-01 15:28:08] [frame_header] Header Bytes:
backend-1        | [0] (6) 81 A8 9E 75 D6 73
backend-1        |

It is changed when two users off their cameras and after this one turn camera on

I try to create many threads for everyone participate, but it is doesn’t work. My code look like this

void ProcessVideo(int index) {
    ZoomSDKRenderer* videoSource = new ZoomSDKRenderer();
    IZoomSDKRenderer* videoHelper;

    SDKError err = createRenderer(&videoHelper, videoSource);
    if (err != SDKERR_SUCCESS) {
        std::cout << "Error occurred" << std::endl;
        // Handle error
    }
    else {
        std::cout << "attemptToStartRawRecording : subscribing" << std::endl;
        videoHelper->setRawDataResolution(ZoomSDKResolution_720P);
        m_pParticipantsController = m_pMeetingService->GetMeetingParticipantsController();
        int userID = m_pParticipantsController->GetParticipantsList()->GetItem(index);
        IUserInfo* returnvalue = m_pParticipantsController->GetUserByUserID(userID);
        std::cout << "UserID is : "<<userID<<"   Info: " << returnvalue->GetUserName() << std::endl;
        videoHelper->subscribe(userID, RAW_DATA_TYPE_VIDEO);
//        }

    }
}

void ProcessAudio() {
    auto audioHelper = GetAudioRawdataHelper();
    if (audioHelper) {
        SDKError err = audioHelper->subscribe(audio_source);
        if (err != SDKERR_SUCCESS) {
            std::cout << "Error occurred subscribing to audio : " << err << std::endl;
        }
    } else {
        std::cout << "Error getting audioHelper" << std::endl;
    }
}
std::thread videoThread, audioThread;
void CheckAndStartRawRecording(bool isVideo, bool isAudio) {

	if (isVideo || isAudio) {
		m_pRecordController = m_pMeetingService->GetMeetingRecordingController();
		SDKError err2 = m_pMeetingService->GetMeetingRecordingController()->CanStartRawRecording();

		if (err2 == SDKERR_SUCCESS) {
            SDKError err1 = m_pRecordController->StartRawRecording();
            if (err1 != SDKERR_SUCCESS) {
                std::cout << "Error occurred starting raw recording" << std::endl;
            } else {
                m_pParticipantsController = m_pMeetingService->GetMeetingParticipantsController();
                int participantCount = m_pParticipantsController->GetParticipantsList()->GetCount();
                std::vector<std::thread> threads;
                for (int i = 0; i < participantCount; i++) {

                    if (isVideo) {
                        threads.emplace_back([i]() {ProcessVideo(i);});
                    }

                    if (isAudio) {
                        audioThread = std::thread(ProcessAudio);
                        audioThread.detach();
                    }
                }
                for (auto& thread : threads) {
                    if (thread.joinable()) {
                        thread.join();
                    }
                }

            }
		}
		else {
			std::cout << "Cannot start raw recording: no permissionrs yet, need host, co-host, or recording privilege" << std::endl;
		}
	}
}

Maybe you know how to solve this problem? @chunsiong.zoom

I also try to create different renders for each participant, but it’s also doesn’t work

void createRender(const uint32_t& userId, bool isVideo, bool isAudio) {
    if (isVideo) {
        IZoomSDKRenderer* videoHelper;
        SDKError err = createRenderer(&videoHelper, new ZoomSDKRenderer()); // Zamenit' nullptr na vash delegat, yesli neobkhodimo
        if (err != SDKERR_SUCCESS) {
            std::cout << "Error occurred creating videoHelper" << std::endl;
            return;
        }

        videoHelper->setRawDataResolution(ZoomSDKResolution_720P);
        videoHelper->subscribe(userId, RAW_DATA_TYPE_VIDEO);
        
    }

    if (isAudio) {
        audioHelper = GetAudioRawdataHelper();
        if (audioHelper) {
            SDKError err = audioHelper->subscribe(audio_source);
            if (err != SDKERR_SUCCESS) {
                std::cout << "Error occurred subscribing to audio : " << err << std::endl;
            }
        } else {
            std::cout << "Error getting audioHelper" << std::endl;
        }
    }
}

std::mutex render_mutex;

void CheckAndStartRawRecording(bool isVideo, bool isAudio) {
    m_pRecordController = m_pMeetingService->GetMeetingRecordingController();
    SDKError err2 = m_pRecordController->CanStartRawRecording();
    if (err2 == SDKERR_SUCCESS) {
        SDKError err1 = m_pRecordController->StartRawRecording();
        if (err1 != SDKERR_SUCCESS) {
            std::cout << "Error occurred starting raw recording" << std::endl;
            return;
        }

        int count = getParticipantCount();
        std::vector<std::thread> threads;
        for (int i = 0; i < count; i++) {
            std::string name = getUserName(i);
            if (name != "EmotionIQ Bot") {
                uint32_t userId = getUserID(i);
                threads.emplace_back([=] {
                    createRender(userId, isVideo, isAudio);
                });
            }
        }

        for (auto& thread : threads) {
            thread.join();
        }
    } else {
        std::cout << "Cannot start raw recording: no permissions yet, need host, co-host, or recording privilege" << std::endl;
    }
}

@emotioniq the trick would be to have a “userID” field within the IZoomSDKRenderer.

You cannot use multi-threading for this .

@chunsiong.zoom I don’t quite understand what you mean. What should it look like?
Could you show this with an example?

@chunsiong.zoom I found solve of my issue in this post. The problem was in ZoomSDKResolution. I used ZoomSDKResolution_720P instead of ZoomSDKResolution_360P or another one. After I change this param all work good!

If someone have problem with connecting to multiply participant, you need to create loop within you create render for each user

void createRender(uint32_t userId, bool isVideo, bool isAudio) {
    if (isVideo) {
        ZoomSDKRenderer* videoSource = new ZoomSDKRenderer();
        IZoomSDKRenderer* videoHelper;
        SDKError err = createRenderer(&videoHelper, videoSource); // Zamenit' nullptr na vash delegat, yesli neobkhodimo
        if (err != SDKERR_SUCCESS) {
            std::cout << "Error occurred creating videoHelper" << std::endl;
            return;
        } else {
            videoHelper->setRawDataResolution(ZoomSDKResolution_360P);
            videoHelper->subscribe(userId, RAW_DATA_TYPE_VIDEO);
            std::cout << "Subscribe on user with id "<<videoHelper->getUserId()<<std::endl;
        }
    }
    if (isAudio) {
        audioHelper = GetAudioRawdataHelper();
        if (audioHelper) {
            SDKError err = audioHelper->subscribe(audio_source);
            if (err != SDKERR_SUCCESS) {
                std::cout << "Error occurred subscribing to audio : " << err << std::endl;
            }
        } else {
            std::cout << "Error getting audioHelper" << std::endl;
        }
    }
}

void CheckAndStartRawRecording(bool isVideo, bool isAudio) {
    m_pRecordController = m_pMeetingService->GetMeetingRecordingController();
    SDKError err2 = m_pRecordController->CanStartRawRecording();
    if (err2 == SDKERR_SUCCESS) {
        SDKError err1 = m_pRecordController->StartRawRecording();
        if (err1 != SDKERR_SUCCESS) {
            std::cout << "Error occurred starting raw recording" << std::endl;
            return;
        }

        int count = getParticipantCount();
        for (int i = 0; i < count; i++) {
            std::string name = getUserName(i);
            if (name != "EmotionIQ Bot") {
                uint32_t userId = getUserID(i);
                createRender(userId, isVideo, isAudio);
            }
        }
    } else {
        std::cout << "Cannot start raw recording: no permissions yet, need host, co-host, or recording privilege" << std::endl;
    }
}
1 Like