Skip to content

Conversation

@naman9271
Copy link
Contributor

No description provided.

@jitsi-jenkins
Copy link

Hi, thanks for your contribution!
If you haven't already done so, could you please make sure you sign our CLA (https://jitsi.org/icla for individuals and https://jitsi.org/ccla for corporations)? We would unfortunately be unable to merge your patch unless we have that piece :(.

@naman9271 naman9271 force-pushed the RTC branch 2 times, most recently from 43550ea to 5ce95dd Compare August 16, 2025 11:48
@jallamsetty1 jallamsetty1 requested a review from Copilot August 28, 2025 18:55
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR migrates the modules/RTC/RTC.ts file to TypeScript by adding comprehensive type definitions and interfaces. The migration transforms JavaScript functions and class methods to TypeScript with proper type annotations while maintaining the existing functionality.

Key changes:

  • Added TypeScript interfaces for RTC options, media stream metadata, and peer connection configurations
  • Converted class methods and static functions to use explicit TypeScript typing
  • Reorganized method declarations with proper access modifiers and type safety
  • Added type annotations for parameters, return values, and class properties

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 8 comments.

File Description
modules/RTC/RTC.ts Complete TypeScript migration with comprehensive interfaces and type definitions
modules/RTC/JitsiLocalTrack.ts Changed method visibility from private to public with @internal annotation
modules/RTC/BridgeChannel.ts Updated import to use interface instead of concrete class
JitsiMediaDevices.ts Added @ts-ignore comment for type compatibility

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

this._receiverVideoConstraints = cloneDeep(constraints);

if (this._channel && this._channel.isOpen()) {
if (this?._channel.isOpen()) {
Copy link

Copilot AI Aug 28, 2025

Choose a reason for hiding this comment

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

The optional chaining operator ?. is incorrect here. Since _channel is being checked for truthiness, it should be this._channel?.isOpen() or this._channel && this._channel.isOpen() to properly handle null/undefined cases.

Copilot uses AI. Check for mistakes.
sendSourceVideoType(sourceName, videoType) {
if (this._channel && this._channel.isOpen()) {
public sendSourceVideoType(sourceName: SourceName, videoType: BridgeVideoType): void {
if (this?._channel.isOpen()) {
Copy link

Copilot AI Aug 28, 2025

Choose a reason for hiding this comment

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

The optional chaining operator ?. is incorrect here. Since _channel is being checked for truthiness, it should be this._channel?.isOpen() or this._channel && this._channel.isOpen() to properly handle null/undefined cases.

Copilot uses AI. Check for mistakes.
sendEndpointStatsMessage(payload) {
if (this._channel && this._channel.isOpen()) {
public sendEndpointStatsMessage(payload: any): void {
if (this?._channel.isOpen()) {
Copy link

Copilot AI Aug 28, 2025

Choose a reason for hiding this comment

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

The optional chaining operator ?. is incorrect here. Since _channel is being checked for truthiness, it should be this._channel?.isOpen() or this._channel && this._channel.isOpen() to properly handle null/undefined cases.

Copilot uses AI. Check for mistakes.
sendReceiverAudioSubscriptionMessage(message) {
if (this._channel && this._channel.isOpen()) {
public sendReceiverAudioSubscriptionMessage(message: any): void {
if (this?._channel.isOpen()) {
Copy link

Copilot AI Aug 28, 2025

Choose a reason for hiding this comment

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

The optional chaining operator ?. is incorrect here. Since _channel is being checked for truthiness, it should be this._channel?.isOpen() or this._channel && this._channel.isOpen() to properly handle null/undefined cases.

Copilot uses AI. Check for mistakes.
if (this._lastN !== value) {
this._lastN = value;
if (this._channel && this._channel.isOpen()) {
if (this?._channel.isOpen()) {
Copy link

Copilot AI Aug 28, 2025

Choose a reason for hiding this comment

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

The optional chaining operator ?. is incorrect here. Since _channel is being checked for truthiness, it should be this._channel?.isOpen() or this._channel && this._channel.isOpen() to properly handle null/undefined cases.

Copilot uses AI. Check for mistakes.
enteringForwardedSources = forwardedSources.filter(
sourceName => oldForwardedSources.indexOf(sourceName) === -1);

logger.debug(`Fowarded sources changed leaving=${leavingForwardedSources}, entering=`
Copy link

Copilot AI Aug 28, 2025

Choose a reason for hiding this comment

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

Typo in the debug message: 'Fowarded' should be 'Forwarded'.

Suggested change
logger.debug(`Fowarded sources changed leaving=${leavingForwardedSources}, entering=`
logger.debug(`Forwarded sources changed leaving=${leavingForwardedSources}, entering=`

Copilot uses AI. Check for mistakes.
// We would still want to update the permissions cache in case the permissions API is not supported.
RTC.addListener(
RTCEvents.PERMISSIONS_CHANGED,
// @ts-ignore
Copy link

Copilot AI Aug 28, 2025

Choose a reason for hiding this comment

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

Using @ts-ignore suppresses type checking without addressing the underlying type issue. Consider fixing the type mismatch or using a more specific TypeScript directive like @ts-expect-error with an explanation.

Suggested change
// @ts-ignore
// @ts-expect-error: The type of 'permissions' from RTCEvents.PERMISSIONS_CHANGED may not match the expected type for _handlePermissionsChange, but this is intentional due to legacy event payloads.

Copilot uses AI. Check for mistakes.
@naman9271
Copy link
Contributor Author

changes dine and rebased please take a look

* @param options
*/
constructor(conference, options = {}) {
constructor(conference: JitsiConference, options: IRTCOptions | IConferenceOptions = {}) {
Copy link
Member

Choose a reason for hiding this comment

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

Isn't it the union of both types?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah i put the union of it IRTCOptions | IConferenceOptions

public conference: JitsiConference;
public peerConnections: Map<number, TraceablePeerConnection>;
public localTracks: JitsiLocalTrack[];
public options: IRTCOptions | IConferenceOptions;
Copy link
Member

Choose a reason for hiding this comment

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

You have defined this above as static.

timestamp);
}

/* eslint-enable max-params */
Copy link
Member

Choose a reason for hiding this comment

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

why do we need this? if we do, please keep it as narrow as possible, just for the one function(s)

* @param eventType
* @param listener
*/
public static addListener(eventType: string, listener: EventListener): void {
Copy link
Member

Choose a reason for hiding this comment

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

This class already extends from Listenable, what's going on here?

audioQuality: options.audioQuality,
capScreenshareBitrate: undefined,
codecSettings: options.codecSettings,
codecSettings: options.codecSettings ? { codecList: options.codecSettings } : undefined,
Copy link
Member

Choose a reason for hiding this comment

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

Is this right?

@naman9271
Copy link
Contributor Author

updated and rebased please take a look.

@naman9271 naman9271 force-pushed the RTC branch 3 times, most recently from ee0b1ba to 3dc7f21 Compare September 5, 2025 09:29
@naman9271
Copy link
Contributor Author

ping @saghul , @jallamsetty1

@saghul
Copy link
Member

saghul commented Sep 9, 2025

Jenkins please test this please.

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