Skip to content

Calling setOnVideo/AudioFrameCallback outside of the onTrackSubscribed handler never starts a frame thread handler #235

Description

@Soralsei

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

  1. Handle the onTrackSubscribed room delegate event
  2. Call Room::setOnVideoFrameCallback from the context of another thread (ex: in a Qt GUI thread) that can run after the event handler returns
  3. Notice no audio/video frame callbacks being called

Activity

  1. stephen-derosa commented on Sep 8, 2026

    @stephen-derosa
    Collaborator

    @Soralsei the SubscriptionThreadDispatcher is improperly marked as public api -- it is not intended for use outside of the room. Please do not use this in your application. In a future release we will mark it as private/internal.

  2. Soralsei commented on Sep 8, 2026

    @Soralsei
    ContributorAuthor

    @stephen-derosa I know it isn’t public API. This is a report for a quirk I discovered while using the SDK. If one registers an audio/video callback outside of the onTrackSubscribed context, the receiver thread is never started and no audio and vidéo callbacks ever get called. What I said at the end of the report was a potential fix for this quirk in the SDK

  3. stephen-derosa commented on Sep 14, 2026

    @stephen-derosa
    Collaborator

    @Soralsei thanks for the clarification -- I think I understand now. We should have a fix in for this in soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions