Skip to content

feat(llc): Make sure the audio input device is set even when the user joins muted #1024

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jul 16, 2025

Conversation

Brazol
Copy link
Contributor

@Brazol Brazol commented Jul 15, 2025

resolves FLU-202

When the user joins the call muted, the audio track is not created. It will be created the first time he or she unmutes. If the user wants to set the audio input device during that time, it would fail. We want to make it possible by storing the chosen deviceId and applying the change when the track is created.

Summary by CodeRabbit

Summary by CodeRabbit

  • Bug Fixes
    • Resolved an issue where changing the audio input device while muted at the start of a call did not apply the new device upon unmuting; the selected device is now correctly set when unmuted.
    • Improved error handling for missing audio tracks, ensuring smoother device switching and unmuting behavior.
    • Minor update to changelog formatting for clarity.

Copy link

coderabbitai bot commented Jul 15, 2025

"""

Walkthrough

The updates address an issue where changing the audio input device while muted at the start of a call did not apply the new device upon unmuting. This is achieved by refining error handling and device application logic in the call and WebRTC management code. Changelog entries were updated to reflect these fixes.

Changes

File(s) Change Summary
packages/stream_video/CHANGELOG.md
packages/stream_video_flutter/CHANGELOG.md
Updated changelog entries to document fixes for device switching while muted and clarified existing camera toggle fix.
packages/stream_video/lib/src/call/call.dart Enhanced setMicrophoneEnabled and setAudioInputDevice to ensure audio device is set when unmuting and improved error handling.
packages/stream_video/lib/src/webrtc/rtc_manager.dart Improved error reporting for missing audio tracks, introduced TrackMissingException for more precise control flow.
packages/stream_video/test/src/call/call_test.dart
packages/stream_video/test/test_helpers.dart
packages/stream_video/test/src/call/call_test_helpers.dart
Added tests for audio input device setting behavior, a mock class for RtcLocalTrack, and a default media device constant for tests.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Call
    participant RtcManager

    User->>Call: setAudioInputDevice(device)
    Call->>RtcManager: setAudioInputDevice(device)
    RtcManager-->>Call: Result (success or TrackMissingException)
    alt TrackMissingException
        Call-->>User: Return success (device will be set on unmute)
    else Success
        Call-->>User: Return success
    else Failure
        Call-->>User: Return failure
    end

    User->>Call: setMicrophoneEnabled(enabled=true)
    alt Enabling and device in options
        Call->>Call: setAudioInputDevice(current device)
    end
    Call-->>User: Result
Loading

Assessment against linked issues

Objective Addressed Explanation
Fix issue when setting audio input devices while muted (FLU-202)

Assessment against linked issues: Out-of-scope changes

No out-of-scope changes detected.

Suggested reviewers

  • renefloor

Poem

A bunny hopped in, with ears so tall,
Fixing mics and cameras for every call.
Now when you unmute, your device is just right,
No more surprises in the middle of the night!
🐰🎤✨
"""


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1b3d0d0 and 7bc3da0.

📒 Files selected for processing (2)
  • packages/stream_video/test/src/call/call_test.dart (2 hunks)
  • packages/stream_video/test/src/call/call_test_helpers.dart (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/stream_video/test/src/call/call_test.dart
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: stream_video_push_notification
  • GitHub Check: stream_video
  • GitHub Check: analyze
  • GitHub Check: stream_video_flutter
  • GitHub Check: stream_video_screen_sharing
  • GitHub Check: stream_video_noise_cancellation
  • GitHub Check: build
  • GitHub Check: analyze_legacy_version
🔇 Additional comments (2)
packages/stream_video/test/src/call/call_test_helpers.dart (2)

39-44: LGTM! Well-defined test constant for audio input device.

The defaultMediaDevice constant is properly structured with appropriate test values for an audio input device. The properties (id, label, kind, groupId) are well-defined and will effectively support testing scenarios where audio input devices need to be mocked.


61-61: LGTM! Proper registration of fallback value.

The registration of defaultMediaDevice as a fallback value follows the established pattern in the function and will ensure consistent mocking behavior for audio device tests.


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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

codecov bot commented Jul 15, 2025

Codecov Report

Attention: Patch coverage is 58.33333% with 5 lines in your changes missing coverage. Please review.

Project coverage is 4.34%. Comparing base (650befb) to head (7bc3da0).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...kages/stream_video/lib/src/webrtc/rtc_manager.dart 16.66% 5 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##            main   #1024      +/-   ##
========================================
+ Coverage   4.24%   4.34%   +0.10%     
========================================
  Files        574     574              
  Lines      38526   38534       +8     
========================================
+ Hits        1634    1675      +41     
+ Misses     36892   36859      -33     

☔ View full report in Codecov by Sentry.
📢 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.

@Brazol Brazol changed the title feat: Make sure the audio input device is set even when the user joins muted feat(llc): Make sure the audio input device is set even when the user joins muted Jul 15, 2025
@Brazol Brazol marked this pull request as ready for review July 15, 2025 14:13
@Brazol Brazol requested a review from a team as a code owner July 15, 2025 14:13
@Brazol Brazol merged commit baf4a05 into main Jul 16, 2025
13 checks passed
@Brazol Brazol deleted the feat/allow-set-audio-input-when-muted branch July 16, 2025 13:49
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.

2 participants