Skip to content

Fix/guard connection state#114

Merged
alan-george-lk merged 11 commits into
livekit:mainfrom
siddimore:fix/guard-connection-state
May 12, 2026
Merged

Fix/guard connection state#114
alan-george-lk merged 11 commits into
livekit:mainfrom
siddimore:fix/guard-connection-state

Conversation

@siddimore
Copy link
Copy Markdown
Contributor

@siddimore siddimore commented May 3, 2026

Summary

Three independent improvements bundled together as non-breaking maintenance work: include guard consistency, a missing read-only accessor, and test gaps filled.

Changes

  • Four public headers used #ifndef/#define/#endif guards while every other header in livekit already used #pragma once. Converted for consistency. No functional change.
  • (AG edit) Also updated private includes for consistency, and to match new AGENTS.md rule around this.

Room::connectionState() accessor
connection_state_ was private with no public getter. Callers who need the current state had to track it themselves via RoomDelegate::onConnectionStateChanged.

Fix VideoStream class-level doc comment
The class description block was copy-pasted from AudioStream and still referred to PCM audio, AudioFrameEvent, and int16 samples. Updated to describe video correctly.

Tests

  • test_room_callbacks.cpp — 3 new cases for connectionState()

siddimore added 2 commits May 2, 2026 21:51
- Convert #ifndef include guards to #pragma once in result.h,
  data_track_error.h, room.h, and subscription_thread_dispatcher.h
  for consistency with the rest of the public headers
- Add Room::connectionState() public accessor (lock-guarded, purely
  additive — no existing API changed)
- Fix VideoStream class-level doc comment (was copy-pasted from
  AudioStream: wrong class name and example types)
- Add unit tests for Room::connectionState() in test_room_callbacks.cpp
- Add unit tests for Result<T,E> and Result<void,E> in test_result.cpp
  (addresses TODO in result.h requesting invariant test coverage)
@siddimore siddimore marked this pull request as ready for review May 4, 2026 03:33
Copy link
Copy Markdown
Collaborator

@stephen-derosa stephen-derosa left a comment

Choose a reason for hiding this comment

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

awesome thanks for the fixes/tests!

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.

Approved with nitpick on grammar -- thanks for the contribution!

Comment thread include/livekit/local_audio_track.h Outdated
@alan-george-lk
Copy link
Copy Markdown
Collaborator

alan-george-lk commented May 11, 2026

@siddimore There have been a few big PRs merged since this. We're super close to getting this in, please pull locally and run

./scripts/clang-format.sh

Or if you're on Windows run clang-format manually, then this should be good to go!

Edit: given we're trying to wrap up open PRs this week, I went ahead and checked it out locally to apply some remaining items.

@alan-george-lk alan-george-lk merged commit 1ee53a6 into livekit:main May 12, 2026
20 checks passed
@alan-george-lk
Copy link
Copy Markdown
Collaborator

@siddimore merged after some cleanup on my end, thanks again for the contribution!

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.

3 participants