onInitialize(…) callback intermittently not firing in raw-recording sample

@amanda-recallai @chunsiong.zoom

I’ve been running a Zoom Meeting bot that streams audio and video into a meeting based on “meetingsdk-linux-raw-recording-sample” (GitHub - zoom/meetingsdk-linux-raw-recording-sample) unchanged for ~6 months.

Recently, about~20% of the time my IZoomSDKVideoSource::onInitialize(...) never fires, even though setExternalVideoSource(...) returns SDKERR_SUCCESS. Because of this the video streaming fails.

I’m upgraded Zoom SDK to the latest as well v6.5.0.3211, on Ubuntu 22.04 with GStreamer 1.18.
I downgraded/re-upgraded the SDK and still see the same intermittent behavior.

Below are the two key pieces of code:

### 1) My override in `ZoomSDKVideoSource.h`  

class ZoomSDKVideoSource : public IZoomSDKVideoSource {
public:
    // …

    // SDK calls this when your external source is bound
    void onInitialize(IZoomSDKVideoSender* sender,
                      IList<VideoSourceCapability>* support_cap_list,
                      VideoSourceCapability& suggest_cap) override
    {
        std::cout << "[VS] onInitialize – sender ready\n";
        video_sender_ = sender;
        initialized_.store(true);
    }

    // …
private:
    std::atomic<bool> initialized_{false};
    IZoomSDKVideoSender* video_sender_ = nullptr;
};
void CheckAndStartRawSending(bool isVideo, bool isAudio,
                             bool skipState, bool isIntro = false) {
    if (!isIntro && isVideo && isAudio) {
        determineDefaultMediaSource(...);
        std::cout << "Video Source: " << DEFAULT_VIDEO_SOURCE << "\n";

        // create new source each time
        ZoomSDKVideoSource* virtual_camera_video_source =
            new ZoomSDKVideoSource(DEFAULT_VIDEO_SOURCE);
        IZoomSDKVideoSourceHelper* vsHelper = GetRawdataVideoSourceHelper();
        IZoomSDKAudioRawDataHelper* audioHelper = GetAudioRawdataHelper();

        SDKError errvid =
            vsHelper->setExternalVideoSource(virtual_camera_video_source);
        SDKError erraud =
            audioHelper->setExternalAudioSource(
                new ZoomSDKVirtualAudioMicEvent(DEFAULT_AUDIO_SOURCE));

        if (errvid == SDKERR_SUCCESS && erraud == SDKERR_SUCCESS) {
            std::cout << "setExternalVideoSource(): Success\n";
            // unmute & join VOIP…
            m_pMeetingService->GetMeetingVideoController()->UnmuteVideo();
            m_pMeetingService->GetMeetingAudioController()->JoinVoip();
        } else {
            std::cerr << "Failed to bind video or audio source: "
                      << errvid << " / " << erraud << "\n";
        }
    }
}

I ve been struggling to figure out why onInitialize does not fire. Because without it my video_sender is null and the video does not stream.

Any pointers or workarounds would be hugely appreciated!

Hey @surya!

Thanks for providing such detailed context!

Just to clarify, had you made any changes to the application at all before this started failing? Was the problem introduced after you changed to a newer Zoom SDK, or does that seem unrelated?

If so, it might be worth changing your environment to use the exact same configuration it had before you started noticing the issues. There might be a difference in behavior between different SDK versions that’s causing this to happen.

Let me know how that goes!

@purnam-admin Did you get to the bottom of this? I am seeing the same thing in the android sdk for a new app. I’ve worked back through a few older SDK releases but haven’t had better results. For me the onInititalize seems to only be called rarely.