Skip to content

Add end-to-end tests for audio/video publish & subscribe#632

Open
cloudwebrtc wants to merge 4 commits intomainfrom
duan/e2e-test-for-audio-video-pub-and-sub
Open

Add end-to-end tests for audio/video publish & subscribe#632
cloudwebrtc wants to merge 4 commits intomainfrom
duan/e2e-test-for-audio-video-pub-and-sub

Conversation

@cloudwebrtc
Copy link
Copy Markdown
Contributor

Summary

  • Adds two new end-to-end tests under livekit-rtc/tests/ that exercise the full publish → SFU → subscribe path for both audio and video tracks:
    • test_audio.py: publishes a 5-tone sine sweep (100/300/500/700/1000 Hz @ 48 kHz mono) and verifies each received tone via FFT peak detection + band-energy dominance (tolerates 15 Hz Opus jitter).
    • test_video.py: publishes a 640×480 @ 15 fps RGBA color cycle (red/green/blue/white/black, 1 s each) and verifies the subscriber observes the colors in order using nearest-palette classification over stable runs.
  • Both tests auto-skip when LIVEKIT_URL / LIVEKIT_API_KEY / LIVEKIT_API_SECRET are not set, so local and CI runs without credentials stay green.
  • Received media is also persisted next to the tests (subscriber_recv_freqs.wav, subscriber_recv_frame_color_*.png) to make failures easy to debug.

Motivation

We didn't have automated coverage that validated the actual media payload after it round-trips through a real SFU — unit tests only cover local-side plumbing. These tests give us a regression signal for encoder/transport/decoder behavior in the Python SDK.

Test plan

  • LIVEKIT_URL=... LIVEKIT_API_KEY=... LIVEKIT_API_SECRET=... pytest livekit-rtc/tests/test_audio.py -v
  • LIVEKIT_URL=... LIVEKIT_API_KEY=... LIVEKIT_API_SECRET=... pytest livekit-rtc/tests/test_video.py -v
  • Confirm the tests are skipped (not failed) when the env vars are absent.

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.

1 participant