Skip to content

Conversation

@pierre-lehnen-rc
Copy link
Contributor

@pierre-lehnen-rc pierre-lehnen-rc commented Nov 4, 2025

Proposed changes (including videos or screenshots)

Issue(s)

VGA-40

Steps to test or reproduce

Further comments

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced audio handling during call hold operations. Audio direction now updates immediately without requiring additional negotiation delays.

@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Nov 4, 2025

Looks like this PR is ready to merge! 🎉
If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link

changeset-bot bot commented Nov 4, 2025

⚠️ No Changeset found

Latest commit: 15ac394

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@pierre-lehnen-rc pierre-lehnen-rc marked this pull request as ready for review November 4, 2025 19:03
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 4, 2025

Walkthrough

Two private helper methods are added to the MediaCallWebRTCProcessor class: updateAudioDirectionWithoutNegotiation() adjusts audio transceiver directions when hold state changes, and getAudioTransceivers() filters transceivers to audio-only. The direction update is invoked immediately after hold state changes to reflect the new state without waiting for negotiation.

Changes

Cohort / File(s) Change Summary
Audio transceiver hold handling
packages/media-signaling/src/lib/services/webrtc/Processor.ts
Added updateAudioDirectionWithoutNegotiation() private method to adjust audio transceiver directions based on hold state; added getAudioTransceivers() private method to filter audio transceivers; integrated direction update call immediately after hold state change

Sequence Diagram

sequenceDiagram
    participant Caller as Call Handler
    participant Processor as MediaCallWebRTCProcessor
    participant Transceivers as RTCRtpTransceivers

    Caller->>Processor: setHeld(true/false)
    activate Processor
    Processor->>Processor: updateAudioDirectionWithoutNegotiation()
    activate Processor
    Processor->>Processor: getAudioTransceivers()
    Processor->>Transceivers: Iterate audio transceivers
    alt Direction mismatch detected
        Processor->>Transceivers: Update transceiver direction
        Note over Transceivers: sendonly (held) or sendrecv (unheld)
        Processor->>Processor: Log direction change
    end
    deactivate Processor
    Processor->>Processor: negotiationNeeded event fired
    deactivate Processor
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Review the logic in updateAudioDirectionWithoutNegotiation() to verify correct direction computation (sendonly vs. sendrecv for held state, inactive vs. recvonly for acceptable)
  • Verify transceiver iteration and direction update logic handles edge cases (e.g., multiple audio transceivers, signalingState checks)
  • Confirm the integration point after setHeld is correct and doesn't introduce timing issues

Suggested reviewers

  • gabriellsh

Poem

🐰 A rabbit hops through WebRTC streams,
Hold and unheld, negotiation dreams,
Audio directions now flow with grace,
No extra waits in this speedy place!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The implementation only addresses putting calls on hold but not the resume functionality required by VGA-40, which requires renegotiation for both hold and resume states. Add logic to handle renegotiation when calls are resumed, completing both hold and resume requirements from VGA-40.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: triggering renegotiation when a call is put on hold. It is concise, clear, and directly related to the implementation.
Out of Scope Changes check ✅ Passed All changes are directly related to the hold/unheld audio transceiver direction management objective, with no unrelated modifications detected.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/held-call-trigger-renegotiation

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 and usage tips.

Copy link
Contributor

@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

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira 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 688786a and f4fec35.

📒 Files selected for processing (1)
  • packages/media-signaling/src/lib/services/webrtc/Processor.ts (2 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: pierre-lehnen-rc
Repo: RocketChat/Rocket.Chat PR: 36718
File: packages/media-signaling/src/lib/Call.ts:633-642
Timestamp: 2025-09-23T00:27:05.438Z
Learning: In PR #36718, pierre-lehnen-rc prefers to maintain consistency with the old architecture patterns for DTMF handling rather than implementing immediate validation improvements, deferring enhancements to future work.
⏰ 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). (3)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build
🔇 Additional comments (2)
packages/media-signaling/src/lib/services/webrtc/Processor.ts (2)

151-152: Good placement of the direction update call.

The call to updateAudioDirectionWithoutNegotiation() is appropriately placed after the held state and stream enable/disable updates, ensuring the transceiver direction reflects the new hold state.


328-332: LGTM! Clean helper method.

The getAudioTransceivers() helper correctly filters transceivers to audio-only, matching the pattern used elsewhere in this file (lines 109-111, 187-189).

@pierre-lehnen-rc pierre-lehnen-rc added this to the 7.13.0 milestone Nov 4, 2025
@pierre-lehnen-rc pierre-lehnen-rc added the stat: QA assured Means it has been tested and approved by a company insider label Nov 4, 2025
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Nov 4, 2025
@codecov
Copy link

codecov bot commented Nov 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.06%. Comparing base (82eea34) to head (15ac394).
⚠️ Report is 1 commits behind head on feat/voip-sync-audio-direction.

Additional details and impacted files

Impacted file tree graph

@@                       Coverage Diff                       @@
##           feat/voip-sync-audio-direction   #37383   +/-   ##
===============================================================
  Coverage                           68.06%   68.06%           
===============================================================
  Files                                3364     3364           
  Lines                              115626   115626           
  Branches                            20869    20798   -71     
===============================================================
+ Hits                                78699    78701    +2     
+ Misses                              34250    34245    -5     
- Partials                             2677     2680    +3     
Flag Coverage Δ
e2e 57.51% <ø> (+<0.01%) ⬆️
unit 72.11% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dionisio-bot dionisio-bot bot removed the stat: ready to merge PR tested and approved waiting for merge label Nov 5, 2025
@pierre-lehnen-rc pierre-lehnen-rc merged commit a752008 into feat/voip-sync-audio-direction Nov 5, 2025
95 of 97 checks passed
@pierre-lehnen-rc pierre-lehnen-rc deleted the chore/held-call-trigger-renegotiation branch November 5, 2025 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stat: QA assured Means it has been tested and approved by a company insider

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants