Skip to content

Conversation

@Brazol
Copy link
Contributor

@Brazol Brazol commented Aug 19, 2025

Summary by CodeRabbit

  • Bug Fixes
    • Improved microphone enabling on Android by applying audio settings before activation, reducing cases of no audio, delays, or unexpected mute states.
    • Increased reliability when toggling the microphone during calls, resulting in more consistent audio behavior on Android devices.

@Brazol Brazol requested a review from a team as a code owner August 19, 2025 12:15
@coderabbitai
Copy link

coderabbitai bot commented Aug 19, 2025

Walkthrough

Moves Android audio configuration to occur before enabling the microphone in setMicrophoneEnabled on Android, removes the post-enable configuration path, and retains error handling and logging. No public API changes.

Changes

Cohort / File(s) Summary
Android audio configuration timing change
packages/stream_video/lib/src/call/call.dart
Applies Android audio configuration (if provided via _streamVideo.options.androidAudioConfiguration) before calling _session?.setMicrophoneEnabled; removes the duplicate post-enable configuration block; preserves error handling/logging.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor App
  participant Call as Call.setMicrophoneEnabled(...)
  participant AndroidCfg as AndroidAudioConfig (if Android)
  participant Session as _session

  App->>Call: enable microphone (true)
  alt Android & enabling
    Call->>AndroidCfg: apply(_streamVideo.options.androidAudioConfiguration)
    note right of AndroidCfg: Pre-enable configuration
  end
  Call->>Session: setMicrophoneEnabled(true)
  Session-->>Call: result
  Call-->>App: completion / error

  rect rgb(245,248,255)
  note over Call,Session: Post-enable Android config path removed
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • xsahil03x

Poem

A twitch of whiskers, toggle the mic,
I nudge the config first—just right.
No echoes after, paths made light,
Hop-hop, the flow is clean and tight.
Carrot logs nibble through the night. 🥕🎤

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/fixed-android-configuration-sequence

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.
    • 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.
  • 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 the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

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

CodeRabbit Commands (Invoked using PR/Issue comments)

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

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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
packages/stream_video/lib/src/call/call.dart (2)

2631-2645: Log stacktrace and add a verbose log around Android audio config

Minor ergonomics:

  • Emit a verbose log before applying the Android audio config to aid field diagnostics.
  • Capture and log the stacktrace in the catch block to speed up root-causing device-specific failures.

Apply this diff within this block:

-    if (enabled && CurrentPlatform.isAndroid) {
-      try {
+    if (enabled && CurrentPlatform.isAndroid) {
+      try {
+        _logger.v(
+          () => '[setMicrophoneEnabled] Applying Android audio configuration',
+        );
         if (_streamVideo.options.androidAudioConfiguration != null) {
           await rtc.Helper.setAndroidAudioConfiguration(
             _streamVideo.options.androidAudioConfiguration!,
           );
         }
-      } catch (e) {
-        _logger.w(
-          () =>
-              '[setMicrophoneEnabled] Failed to set Android audio configuration: $e',
-        );
+      } catch (e, stk) {
+        _logger.w(
+          () =>
+              '[setMicrophoneEnabled] Failed to set Android audio configuration: $e\n$stk',
+        );
       }
     }

2627-2629: Fix permission error message (“audio” vs “video”)

This path checks for sendAudio but returns an error saying “send video”. Please correct the message.

-      return Result.error('Missing permission to send video');
+      return Result.error('Missing permission to send audio');
📜 Review details

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

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 2a65574 and 6404d84.

📒 Files selected for processing (1)
  • packages/stream_video/lib/src/call/call.dart (1 hunks)
🔇 Additional comments (1)
packages/stream_video/lib/src/call/call.dart (1)

2631-2645: Applying Android audio config before enabling mic is the right sequencing

This change aligns the configuration order correctly on Android (configure first, then enable the mic). Good defensive try/catch with non-fatal logging.

@codecov
Copy link

codecov bot commented Aug 19, 2025

Codecov Report

❌ Patch coverage is 14.28571% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 4.83%. Comparing base (2a65574) to head (35218f7).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
packages/stream_video/lib/src/call/call.dart 14.28% 6 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##            main   #1052   +/-   ##
=====================================
  Coverage   4.83%   4.83%           
=====================================
  Files        577     577           
  Lines      38830   38830           
=====================================
  Hits        1877    1877           
  Misses     36953   36953           

☔ 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 merged commit b8214d8 into main Aug 20, 2025
12 of 13 checks passed
@Brazol Brazol deleted the fix/fixed-android-configuration-sequence branch August 20, 2025 11:37
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