Skip to content

feat(rtc): get active call consus intent (audio/video)#6274

Open
BillCarsonFr wants to merge 2 commits intomainfrom
valere/consensus_call_intent
Open

feat(rtc): get active call consus intent (audio/video)#6274
BillCarsonFr wants to merge 2 commits intomainfrom
valere/consensus_call_intent

Conversation

@BillCarsonFr
Copy link
Member

@BillCarsonFr BillCarsonFr commented Mar 11, 2026

Depends on: ruma/ruma#2414

Partity with web/js-sdk.
Allows to get the consus intent for the current call using the membership m.call.intent

EW use it to change the icon in the room list
image

  • I've documented the public API Changes in the appropriate CHANGELOG.md files.
  • This PR was made with the help of AI.

Signed-off-by:

@BillCarsonFr BillCarsonFr force-pushed the valere/consensus_call_intent branch from ac5927d to 3e61829 Compare March 17, 2026 07:17
@codecov
Copy link

codecov bot commented Mar 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.89%. Comparing base (109db5e) to head (1c6f1d4).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6274   +/-   ##
=======================================
  Coverage   89.89%   89.89%           
=======================================
  Files         374      374           
  Lines      102275   102358   +83     
  Branches   102275   102358   +83     
=======================================
+ Hits        91942    92019   +77     
- Misses       6776     6779    +3     
- Partials     3557     3560    +3     

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

@codspeed-hq
Copy link

codspeed-hq bot commented Mar 17, 2026

Merging this PR will improve performance by 68.54%

⚡ 1 improved benchmark
✅ 49 untouched benchmarks

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation Restore session [memory store] 280.6 ms 166.5 ms +68.54%

Comparing valere/consensus_call_intent (1c6f1d4) with main (109db5e)

Open in CodSpeed

@BillCarsonFr BillCarsonFr marked this pull request as ready for review March 17, 2026 07:49
@BillCarsonFr BillCarsonFr requested a review from a team as a code owner March 17, 2026 07:49
@BillCarsonFr BillCarsonFr requested review from Hywan and removed request for a team March 17, 2026 07:49
Copy link
Member

@Hywan Hywan left a comment

Choose a reason for hiding this comment

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

Thank you for the contribution and the tests! One note about comments, but nothing huge.

Comment on lines +38 to +44
/// Get the call intent for the current call, based on what members are
/// advertising. If one or more members disagree on the current call
/// intent, or nobody specifies one then `undefined` is returned.
///
/// If all members that specify call intent agree, that value is returned.
///
/// A call intent, or `None` if no consensus or not given.
Copy link
Member

Choose a reason for hiding this comment

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

The documentation is surprising. It says that undefined is returned if members disagree (no consensus). However, the last line seems to be about the returned value, and it says None when there is no consensus.

I think rephrasing is required here. Also, undefined doesn't exist in Rust, you may want to refer to None (if I understand the JavaScript background correctly here).

Copy link
Member Author

Choose a reason for hiding this comment

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

Thx Ivan, indeed I tried to match how js did it, but I don't like it much.
Particularly that a single person out of 10 could decide the consensus.
I will change to return a Full consensus, a Partial consensus (with the number of agreements) and no consensus. Like that it will self document it self.

The UI may use this info or not

pub enum CallIntentConsensus {
    /// All members advertise and agree
    Full(CallIntent),
    /// Some members advertise and agree (intent, agreeing_count, total_count)
    Partial(CallIntent, usize, usize),
    /// No consensus
    None,
}

Copy link
Member

Choose a reason for hiding this comment

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

I think it's a nice proposal!

Copy link
Member

@Hywan Hywan Mar 18, 2026

Choose a reason for hiding this comment

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

You can use Rust this way:

pub enum CallIntentConsensus {
    /// All members advertise and agree
    Full(CallIntent),
    /// Some members advertise and agree
    Partial {
        intent: CallIntent,
        aggreing_count: usize,
        total_count: usize
    },
    /// No consensus
    None,
}

Comment on lines +1062 to +1068
/// Get the call intent for the current call, based on what members are
/// advertising. If one or more members disagree on the current call
/// intent, or nobody specifies one then `undefined` is returned.
///
/// If all members that specify call intent agree, that value is returned.
///
/// A call intent, or `None` if no consensus or not given.
Copy link
Member

Choose a reason for hiding this comment

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

Same feedback as the other comment.

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