Skip to content

refactor(llc): give Call a CallHost interface instead of StreamVideo - #1440

Draft
renefloor wants to merge 2 commits into
feat/flu-858-app-lifecycle-controllerfrom
feat/flu-852-call-host
Draft

renefloor wants to merge 2 commits into
feat/flu-858-app-lifecycle-controllerfrom
feat/flu-852-call-host

Conversation

@renefloor

@renefloor renefloor commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Fixes FLU-852

Part of FLU-859 · 25/26, stacked on #1439

What changed

CallHost (lib/src/call/call_host.dart, exported) is the part of the client that a Call uses, and StreamVideo implements it. Call keeps it as _host instead of _streamVideo.

Members:

  • state, currentUser, options, apiKey, pushNotificationManager;
  • deviceSupportsAdvancedAudioProcessing();
  • @internal: clientEventReporter, webrtcInitializationCompleter, prepareToAccept(call), isAudioProcessorConfigured(), setAudioProcessingEnabled(bool).

What got narrower after C1, B3 and C4:

  • The ringing hooks went to ClientState (C1).
  • The cross-call accept steps went behind prepareToAccept (B3).
  • The background mute maps are gone (C4).

Call now reaches the client at 43 sites through 9 members, down from 45 sites across 25 members on v2. The session uses apiKey and webrtcInitializationCompleter on top of those.

Where CallHost replaces StreamVideo:

  • Call and its factories. The factories keep the streamVideo: parameter name, so passing a StreamVideo still compiles.
  • CallSession and CallSessionFactory, which Call hands the host to.
  • RtcManager and RtcManagerFactory, for the same reason.

Decisions to check

  • CallHost is public, with @internal members. Call's public factories take it, so it has to be exported. Its @internal members stay off the public API. It is an interface class: it can be implemented but not extended.
  • The session and the RTC manager take the host too. The ticket names Call only, but Call passes its host on to them. Leaving them on StreamVideo would keep the concrete type in Call. They use currentUser, apiKey, options, clientEventReporter and webrtcInitializationCompleter, all on CallHost.
  • prepareToAccept is on the host, not ringing. That keeps a fake host from needing a RingingCallCoordinator. StreamVideo forwards it to ringing.prepareToAccept.
  • The streamVideo: parameter keeps its name. Renaming it to host: would break every Call(...) and Call.fromRinging(...) caller for no gain; the type is what matters.

Tests

  • MockStreamVideo in stream_video's test_helpers.dart is now MockCallHost. It keeps the telemetry no-op, and prepareToAccept returns null.
  • setupMockStreamVideo is now setupMockCallHost. It no longer stubs activeCalls, which Call stopped reading in B3.
  • The fixtures and tests that built calls, sessions and RTC managers on the mock use the host type, 20 test files in all. The push package's and stream_video_flutter's MockStreamVideo stay, since they stand in for the client itself.
  • Results:
    • stream_video: 1309 passed;
    • stream_video_push_notification: 67;
    • stream_video_flutter without goldens: 729.

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Oct 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.46154% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 44.58%. Comparing base (dd8da4e) to head (c40daa4).

Files with missing lines Patch % Lines
...c/call/connection/call_connection_coordinator.dart 85.18% 4 Missing ⚠️
packages/stream_video/lib/src/call/call.dart 91.30% 2 Missing ⚠️
Additional details and impacted files
@@                            Coverage Diff                            @@
##           feat/flu-858-app-lifecycle-controller    #1440      +/-   ##
=========================================================================
- Coverage                                  44.59%   44.58%   -0.02%     
=========================================================================
  Files                                        423      423              
  Lines                                      31506    31495      -11     
=========================================================================
- Hits                                       14051    14041      -10     
+ Misses                                     17455    17454       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@renefloor
renefloor added this pull request to stack #1442 October 9, 2026 06:12
renefloor and others added 2 commits October 9, 2026 14:22
Call, its session and its RTC manager depend on CallHost, the members of
the client they use: the client state, the current user, the options,
telemetry, the push manager, audio processing and the accept hook.
StreamVideo implements it, and tests build calls on a MockCallHost.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@renefloor
renefloor force-pushed the feat/flu-852-call-host branch from c40daa4 to 7ff78bf Compare October 9, 2026 12:27

This branch has not been deployed

No deployments
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