Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/add_more_signaling_tests.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
livekit: patch
livekit-ffi: patch
---

add more signaling tests, and fix one corner case that users call removeTrack during reconnect - #976 (@xianshijing-lk)
16 changes: 15 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,19 @@ jobs:
LIVEKIT_CONFIG: "enable_data_tracks: true"
run: livekit-server --dev &

- name: Wait for LiveKit server
if: ${{ matrix.e2e-testing }}
run: |
# Wait for server to be ready (up to 30 seconds)
for i in {1..30}; do
if curl -s http://localhost:7880 > /dev/null 2>&1; then
echo "LiveKit server is ready"
break
fi
echo "Waiting for LiveKit server... ($i/30)"
sleep 1
done

- name: Test (no E2E)
if: ${{ !matrix.e2e-testing }}
env:
Expand All @@ -128,4 +141,5 @@ jobs:
if: ${{ matrix.e2e-testing }}
env:
RUST_LOG: info
run: cargo +nightly test --release --verbose --target ${{ matrix.target }} --features __lk-e2e-test -- --nocapture --test-threads=1
LIVEKIT_URL: ws://localhost:7880
run: cargo +nightly test --release --verbose --target ${{ matrix.target }} --features "__lk-e2e-test,native-tls" -- --nocapture --test-threads=1
10 changes: 10 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion livekit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,5 @@ base64 = "0.22"
[dev-dependencies]
anyhow = "1.0.99"
test-log = "0.2.18"
test-case = "3.3"
rlimit = "0.10"
test-case = "3.3"
20 changes: 16 additions & 4 deletions livekit/src/rtc_engine/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,10 +310,22 @@ impl RtcEngine {

pub fn remove_track(&self, sender: RtpSender) -> EngineResult<()> {
// We don't need to wait for the reconnection
let session = self.inner.running_handle.read().session.clone();
session.remove_track(sender) // TODO(theomonnom): Ignore errors where this
// RtpSender is bound to the old session. (Can
// happen on bad timing and it is safe to ignore)
let handle = self.inner.running_handle.read();
let session = handle.session.clone();
let is_reconnecting = handle.reconnecting;
drop(handle); // Release the lock before calling remove_track

match session.remove_track(sender) {
Ok(()) => Ok(()),
Err(e) if is_reconnecting => {
// During reconnection, the RtpSender may be bound to the old session.
// This is safe to ignore as the track will be properly cleaned up
// when the session is replaced.
log::debug!("ignoring remove_track error during reconnection: {:?}", e);
Ok(())
}
Err(e) => Err(e),
}
}

pub async fn mute_track(&self, req: proto::MuteTrackRequest) -> EngineResult<()> {
Expand Down
Loading
Loading