LiveKit C++ SDK Version
v1.2.0
Platform
Linux x86_64
OS Version
OpenSUSE 15.6 LEAP
Compiler & Version
gcc 15.2
CMake Version
3.28.3
How are you using the SDK?
Vendoring the SDK and building from source as a CMake subdirectory
Issue Description
Calling setOnAudio/VideoFrameCallback correctly adds the frame handler to the relevant video/audio_callbacks, but doing so outside of the onTrackSubscribed delegate callback never starts a reader thread, resulting in the corresponding frame callback never being called.
This happens because SubscriberThreadDispatcher::handleTrackSubscribed only gets called synchronously right after the delegate callback from the Room event handler @ room.cpp:703, which no-ops if the frame callback key has not been added to the callback map yet.
A potential fix could be to call SubscriberThreadDispatcher::handleTrackSubscribed if setOnAudio/VideoFrameCallback is called when the mappings are empty.
Steps to Reproduce
- Handle the
onTrackSubscribed room delegate event
- Call
Room::setOnVideoFrameCallback from the context of another thread (ex: in a Qt GUI thread) that can run after the event handler returns
- Notice no audio/video frame callbacks being called
LiveKit C++ SDK Version
v1.2.0
Platform
Linux x86_64
OS Version
OpenSUSE 15.6 LEAP
Compiler & Version
gcc 15.2
CMake Version
3.28.3
How are you using the SDK?
Vendoring the SDK and building from source as a CMake subdirectory
Issue Description
Calling
setOnAudio/VideoFrameCallbackcorrectly adds the frame handler to the relevantvideo/audio_callbacks, but doing so outside of theonTrackSubscribeddelegate callback never starts a reader thread, resulting in the corresponding frame callback never being called.This happens because
SubscriberThreadDispatcher::handleTrackSubscribedonly gets called synchronously right after the delegate callback from the Room event handler @room.cpp:703, which no-ops if the frame callback key has not been added to the callback map yet.A potential fix could be to call
SubscriberThreadDispatcher::handleTrackSubscribedifsetOnAudio/VideoFrameCallbackis called when the mappings are empty.Steps to Reproduce
onTrackSubscribedroom delegate eventRoom::setOnVideoFrameCallbackfrom the context of another thread (ex: in a Qt GUI thread) that can run after the event handler returns