Skip to content
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

Gh/ts/patch 013 service rtc video type #1916

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion JitsiConference.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ import CodecMimeType from './service/RTC/CodecMimeType';
import { MediaType } from './service/RTC/MediaType';
import RTCEvents from './service/RTC/RTCEvents';
import { getSourceNameForJitsiTrack } from './service/RTC/SignalingLayer';
import VideoType from './service/RTC/VideoType';
import { VideoType } from './service/RTC/VideoType';
import {
ACTION_JINGLE_RESTART,
ACTION_JINGLE_SI_RECEIVED,
Expand Down
2 changes: 1 addition & 1 deletion JitsiConferenceEventManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Statistics from './modules/statistics/statistics';
import EventEmitterForwarder from './modules/util/EventEmitterForwarder';
import { MediaType } from './service/RTC/MediaType';
import RTCEvents from './service/RTC/RTCEvents';
import VideoType from './service/RTC/VideoType';
import { VideoType } from './service/RTC/VideoType';
import AuthenticationEvents
from './service/authentication/AuthenticationEvents';
import {
Expand Down
2 changes: 1 addition & 1 deletion modules/RTC/JitsiLocalTrack.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
import CameraFacingMode from '../../service/RTC/CameraFacingMode';
import { MediaType } from '../../service/RTC/MediaType';
import RTCEvents from '../../service/RTC/RTCEvents';
import VideoType from '../../service/RTC/VideoType';
import { VideoType } from '../../service/RTC/VideoType';
import {
NO_BYTES_SENT,
TRACK_UNMUTED,
Expand Down
2 changes: 1 addition & 1 deletion modules/RTC/RTCUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as JitsiTrackErrors from '../../JitsiTrackErrors';
import CameraFacingMode from '../../service/RTC/CameraFacingMode';
import RTCEvents from '../../service/RTC/RTCEvents';
import Resolutions from '../../service/RTC/Resolutions';
import VideoType from '../../service/RTC/VideoType';
import { VideoType } from '../../service/RTC/VideoType';
import { AVAILABLE_DEVICE } from '../../service/statistics/AnalyticsEvents';
import browser from '../browser';
import SDPUtil from '../sdp/SDPUtil';
Expand Down
2 changes: 1 addition & 1 deletion modules/RTC/TPCUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import transform from 'sdp-transform';

import MediaDirection from '../../service/RTC/MediaDirection';
import { MediaType } from '../../service/RTC/MediaType';
import VideoType from '../../service/RTC/VideoType';
import { VideoType } from '../../service/RTC/VideoType';
import browser from '../browser';
import FeatureFlags from '../flags/FeatureFlags';

Expand Down
2 changes: 1 addition & 1 deletion modules/RTC/TraceablePeerConnection.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { MediaType } from '../../service/RTC/MediaType';
import RTCEvents from '../../service/RTC/RTCEvents';
import * as SignalingEvents from '../../service/RTC/SignalingEvents';
import { getSourceNameForJitsiTrack } from '../../service/RTC/SignalingLayer';
import * as VideoType from '../../service/RTC/VideoType';
import { VideoType } from '../../service/RTC/VideoType';
import { SS_DEFAULT_FRAME_RATE } from '../RTC/ScreenObtainer';
import browser from '../browser';
import FeatureFlags from '../flags/FeatureFlags';
Expand Down
2 changes: 1 addition & 1 deletion modules/connectivity/ConnectionQuality.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as ConnectionQualityEvents from '../../service/connectivity/ConnectionQ
import browser from '../browser';

const Resolutions = require('../../service/RTC/Resolutions');
const VideoType = require('../../service/RTC/VideoType');
const { VideoType } = require('../../service/RTC/VideoType');
const { XMPPEvents } = require('../../service/xmpp/XMPPEvents');

const logger = getLogger(__filename);
Expand Down
2 changes: 1 addition & 1 deletion modules/proxyconnection/ProxyConnectionService.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { getLogger } from '@jitsi/logger';
import { $iq } from 'strophe.js';

import { MediaType } from '../../service/RTC/MediaType';
import VideoType from '../../service/RTC/VideoType';
import { VideoType } from '../../service/RTC/VideoType';
import RTC from '../RTC/RTC';

import ProxyConnectionPC from './ProxyConnectionPC';
Expand Down
2 changes: 1 addition & 1 deletion modules/sdp/LocalSdpMunger.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { getLogger } from '@jitsi/logger';
import MediaDirection from '../../service/RTC/MediaDirection';
import { MediaType } from '../../service/RTC/MediaType';
import { getSourceNameForJitsiTrack } from '../../service/RTC/SignalingLayer';
import VideoType from '../../service/RTC/VideoType';
import { VideoType } from '../../service/RTC/VideoType';
import FeatureFlags from '../flags/FeatureFlags';

import { SdpTransformWrap } from './SdpTransformUtil';
Expand Down
2 changes: 1 addition & 1 deletion modules/statistics/AvgRTPStatsReporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import isEqual from 'lodash.isequal';

import * as ConferenceEvents from '../../JitsiConferenceEvents';
import { MediaType } from '../../service/RTC/MediaType';
import * as VideoType from '../../service/RTC/VideoType';
import { VideoType } from '../../service/RTC/VideoType';
import * as ConnectionQualityEvents
from '../../service/connectivity/ConnectionQualityEvents';
import {
Expand Down
2 changes: 1 addition & 1 deletion modules/xmpp/ChatRoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { $iq, $msg, $pres, Strophe } from 'strophe.js';

import * as JitsiTranscriptionStatus from '../../JitsiTranscriptionStatus';
import { MediaType } from '../../service/RTC/MediaType';
import VideoType from '../../service/RTC/VideoType';
import { VideoType } from '../../service/RTC/VideoType';
import { XMPPEvents } from '../../service/xmpp/XMPPEvents';
import GlobalOnErrorHandler from '../util/GlobalOnErrorHandler';
import Listenable from '../util/Listenable';
Expand Down
2 changes: 1 addition & 1 deletion modules/xmpp/SignalingLayerImpl.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Strophe } from 'strophe.js';
import { MediaType } from '../../service/RTC/MediaType';
import * as SignalingEvents from '../../service/RTC/SignalingEvents';
import SignalingLayer, { getMediaTypeFromSourceName } from '../../service/RTC/SignalingLayer';
import VideoType from '../../service/RTC/VideoType';
import { VideoType } from '../../service/RTC/VideoType';
import { XMPPEvents } from '../../service/xmpp/XMPPEvents';
import FeatureFlags from '../flags/FeatureFlags';

Expand Down
2 changes: 1 addition & 1 deletion modules/xmpp/SignalingLayerImpl.spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { MediaType } from '../../service/RTC/MediaType';
import * as SignalingEvents from '../../service/RTC/SignalingEvents';
import { getSourceNameForJitsiTrack } from '../../service/RTC/SignalingLayer';
import VideoType from '../../service/RTC/VideoType';
import { VideoType } from '../../service/RTC/VideoType';
import { XMPPEvents } from '../../service/xmpp/XMPPEvents';
import FeatureFlags from '../flags/FeatureFlags';
import Listenable from '../util/Listenable';
Expand Down
14 changes: 5 additions & 9 deletions service/RTC/VideoType.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,15 @@ import * as exported from "./VideoType";

describe( "/service/RTC/VideoType members", () => {
const {
CAMERA,
DESKTOP,
VideoType,
...others
} = exported as any; // TODO: remove cast after typescript conversion
} = exported;

it( "known members", () => {
expect( CAMERA ).toBe( 'camera' );
expect( DESKTOP ).toBe( 'desktop' );
if ( VideoType ) {
expect( VideoType.CAMERA ).toBe( 'camera' );
expect( VideoType.DESKTOP ).toBe( 'desktop' );
}
expect( VideoType ).toBeDefined();

expect( VideoType.CAMERA ).toBe( 'camera' );
expect( VideoType.DESKTOP ).toBe( 'desktop' );
} );

it( "unknown members", () => {
Expand Down
9 changes: 3 additions & 6 deletions service/RTC/VideoType.js → service/RTC/VideoType.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
/**
* Enumeration of the video types
* @type {{CAMERA: string, DESKTOP: string}}
*/
const VideoType = {
export enum VideoType {
/**
* The camera video type.
*/
CAMERA: 'camera',
CAMERA = 'camera',

/**
* The desktop video type.
*/
DESKTOP: 'desktop'
DESKTOP = 'desktop'
};

module.exports = VideoType;
6 changes: 2 additions & 4 deletions types/auto/modules/RTC/TraceablePeerConnection.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -386,10 +386,7 @@ export default class TraceablePeerConnection {
* @param {boolean} muted the initial muted status
* @param {String} sourceName the track's source name
*/
_createRemoteTrack(ownerEndpointId: string, stream: MediaStream, track: MediaStreamTrack, mediaType: MediaType, videoType?: {
CAMERA: string;
DESKTOP: string;
}, ssrc: number, muted: boolean, sourceName: string): void;
_createRemoteTrack(ownerEndpointId: string, stream: MediaStream, track: MediaStreamTrack, mediaType: MediaType, videoType?: VideoType, ssrc: number, muted: boolean, sourceName: string): void;
/**
* Handles remote stream removal.
* @param stream the WebRTC MediaStream object which is being removed from the
Expand Down Expand Up @@ -778,3 +775,4 @@ import { TPCUtils } from "./TPCUtils";
import SdpConsistency from "../sdp/SdpConsistency";
import LocalSdpMunger from "../sdp/LocalSdpMunger";
import RtxModifier from "../sdp/RtxModifier";
import { VideoType } from "../../service/RTC/VideoType";
6 changes: 2 additions & 4 deletions types/auto/modules/connectivity/ConnectionQuality.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,7 @@ export default class ConnectionQuality {
* @param resolutionName {Resolution} the input resolution used by the camera.
* @returns {*} the newly calculated connection quality.
*/
_calculateConnectionQuality(videoType: {
CAMERA: string;
DESKTOP: string;
}, isMuted: boolean, resolutionName: any): any;
_calculateConnectionQuality(videoType: VideoType, isMuted: boolean, resolutionName: any): any;
/**
* Updates the localConnectionQuality value
* @param values {number} the new value. Should be in [0, 100].
Expand Down Expand Up @@ -95,3 +92,4 @@ export default class ConnectionQuality {
jvbRTT: any;
};
}
import { VideoType } from "../../service/RTC/VideoType";
6 changes: 2 additions & 4 deletions types/auto/modules/xmpp/SignalingLayerImpl.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,7 @@ export default class SignalingLayerImpl extends SignalingLayer {
* @param {VideoType} videoType - the new video type.
* @returns {boolean}
*/
setTrackVideoType(sourceName: any, videoType: {
CAMERA: string;
DESKTOP: string;
}): boolean;
setTrackVideoType(sourceName: any, videoType: VideoType): boolean;
/**
* Saves the source name for a track identified by it's ssrc.
* @param {number} ssrc the ssrc of the target track.
Expand All @@ -115,3 +112,4 @@ export default class SignalingLayerImpl extends SignalingLayer {
setTrackSourceName(ssrc: number, sourceName: any): void;
}
import SignalingLayer from "../../service/RTC/SignalingLayer";
import { VideoType } from "../../service/RTC/VideoType";
16 changes: 10 additions & 6 deletions types/auto/service/RTC/VideoType.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
export = VideoType;
/**
* Enumeration of the video types
* @type {{CAMERA: string, DESKTOP: string}}
*/
declare const VideoType: {
CAMERA: string;
DESKTOP: string;
};
export declare enum VideoType {
/**
* The camera video type.
*/
CAMERA = "camera",
/**
* The desktop video type.
*/
DESKTOP = "desktop"
}