Skip to content

BugFix: Bot-343, DataTracks return from subscribe() and read() from rust sdk#119

Open
stephen-derosa wants to merge 3 commits intolivekit:mainfrom
stephen-derosa:sderosa/BOT-343-float-up-DT-error
Open

BugFix: Bot-343, DataTracks return from subscribe() and read() from rust sdk#119
stephen-derosa wants to merge 3 commits intolivekit:mainfrom
stephen-derosa:sderosa/BOT-343-float-up-DT-error

Conversation

@stephen-derosa
Copy link
Copy Markdown
Collaborator

@stephen-derosa stephen-derosa commented May 6, 2026

aligns with changes here:
livekit/rust-sdks#1057

Depends on:

Copy link
Copy Markdown
Collaborator

@alan-george-lk alan-george-lk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, love the bundled unit test

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aligns the C++ SDK’s remote DataTrack streaming behavior with the Rust SDK update (rust-sdks#1057) by preserving and surfacing terminal subscription errors delivered via the FFI stream EOS, and by exercising that behavior in unit tests.

Changes:

  • Add DataTrackStream::terminalError() and store an optional terminal subscription error when EOS arrives with an error payload.
  • Log terminal subscription errors when the data reader thread exits after read() ends.
  • Add unit tests validating that normal EOS produces no terminal error, while subscribe-failure EOS records a typed error.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
include/livekit/data_track_stream.h Exposes terminalError() and stores an optional terminal subscription error; adds test-only friend access.
src/data_track_stream.cpp Parses EOS error payload from FFI events and persists it as a terminal error; clears it on local close before EOS.
src/subscription_thread_dispatcher.cpp Logs terminal subscription errors after the data read loop ends.
src/tests/unit/test_data_track_stream.cpp New unit tests covering terminal error behavior for normal EOS vs subscribe-failure EOS.
src/tests/CMakeLists.txt Links protobuf for unit tests across platforms (supports protobuf usage in new unit test and static-link scenarios).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

@ladvoc ladvoc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just the one question. Also, have you tested this against the Rust branch?

Comment thread src/subscription_thread_dispatcher.cpp Outdated
Comment thread src/data_track_stream.cpp Outdated
Comment thread src/data_track_stream.cpp
Copy link
Copy Markdown
Collaborator

@xianshijing-lk xianshijing-lk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm if you address the comments

Comment thread src/tests/unit/test_data_track_stream.cpp
Comment thread src/tests/CMakeLists.txt
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Comment thread src/subscription_thread_dispatcher.cpp Outdated
Comment thread src/data_track_stream.cpp
@stephen-derosa stephen-derosa changed the title fix DataTracks return from subscribe() and read() from rust sdk BugFix: Bot-343, DataTracks return from subscribe() and read() from rust sdk May 7, 2026
@stephen-derosa stephen-derosa force-pushed the sderosa/BOT-343-float-up-DT-error branch from b781eda to 03dfe13 Compare May 7, 2026 17:07
integration test: publishes a data track, waits for the remote track, unpublishes before subscribing, then asserts the stream ends via read() == false with terminalError().code
update rust hash
@stephen-derosa stephen-derosa force-pushed the sderosa/BOT-343-float-up-DT-error branch from 3d966d6 to 10a809d Compare May 8, 2026 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants