Skip to content
Open
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.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2074,7 +2074,7 @@ export default class JitsiConference extends Listenable {
videoType = BridgeVideoType.DESKTOP_HIGH_FPS;
}

localtrack && this.rtc.sendSourceVideoType(localtrack.getSourceName(), videoType);
localtrack && this.rtc.sendSourceVideoType(localtrack.getSourceName(), videoType as BridgeVideoType);
}

/**
Expand Down
5 changes: 3 additions & 2 deletions JitsiMediaDevices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export default class JitsiMediaDevices extends Listenable {
private _initialized: boolean;
private _permissions: { [key: string]: boolean; };
private _permissionsApiSupported: Promise<boolean>;
private _rtc: RTC;

/**
* Initializes a `JitsiMediaDevices` object. There will be a single
Expand Down Expand Up @@ -85,15 +86,15 @@ export default class JitsiMediaDevices extends Listenable {
}
this._initialized = true;

RTC.addListener(
this._rtc.addListener(
RTCEvents.DEVICE_LIST_CHANGED,
devices =>
this.eventEmitter.emit(
JitsiMediaDevicesEvents.DEVICE_LIST_CHANGED,
devices));

// We would still want to update the permissions cache in case the permissions API is not supported.
RTC.addListener(
this._rtc.addListener(
RTCEvents.PERMISSIONS_CHANGED,
permissions => this._handlePermissionsChange(permissions));

Expand Down
6 changes: 3 additions & 3 deletions modules/RTC/BridgeChannel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { RTCEvents } from '../../service/RTC/RTCEvents';
import { IReceiverAudioSubscriptionMessage } from '../../service/RTC/ReceiverAudioSubscription';
import { SourceName } from '../../service/RTC/SignalingLayer';
import { createBridgeChannelClosedEvent } from '../../service/statistics/AnalyticsEvents';
import ReceiverVideoConstraints from '../qualitycontrol/ReceiveVideoController';
import { IReceiverVideoConstraints } from '../qualitycontrol/ReceiveVideoController';
import Statistics from '../statistics/statistics';


Expand Down Expand Up @@ -277,9 +277,9 @@ export default class BridgeChannel {
/**
* Sends a 'ReceiverVideoConstraints' message via the bridge channel.
*
* @param {ReceiverVideoConstraints} constraints video constraints.
* @param {IReceiverVideoConstraints} constraints video constraints.
*/
sendReceiverVideoConstraintsMessage(constraints: ReceiverVideoConstraints): void {
sendReceiverVideoConstraintsMessage(constraints: IReceiverVideoConstraints): void {
logger.info(`Sending ReceiverVideoConstraints with ${JSON.stringify(constraints)}`);
this._send({
colibriClass: 'ReceiverVideoConstraints',
Expand Down
62 changes: 31 additions & 31 deletions modules/RTC/JitsiLocalTrack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -549,37 +549,6 @@ export default class JitsiLocalTrack extends JitsiTrack {
});
}

/**
* Sets real device ID by comparing track information with device information. This is temporary solution until
* getConstraints() method will be implemented in browsers.
*
* @param {MediaDeviceInfo[]} devices - The list of devices obtained from enumerateDevices() call.
* @private
* @returns {void}
*/
private _setRealDeviceIdFromDeviceList(devices: MediaDeviceInfo[]): void {
const track = this.getTrack();
const kind = `${track.kind}input`;

// We need to match by deviceId as well, in case of multiple devices with the same label.
let device = devices.find(d => d.kind === kind && d.label === track.label && d.deviceId === this.deviceId);

if (!device && this._realDeviceId === 'default') { // the default device has been changed.
// If the default device was 'A' and the default device is changed to 'B' the label for the track will
// remain 'Default - A' but the label for the device in the device list will be updated to 'A'. That's
// why in order to match it we need to remove the 'Default - ' part.
const label = (track.label || '').replace('Default - ', '');

device = devices.find(d => d.kind === kind && d.label === label);
}

if (device) {
this._realDeviceId = device.deviceId;
} else {
this._realDeviceId = undefined;
}
}

/**
* Starts the effect process and returns the modified stream.
*
Expand Down Expand Up @@ -686,6 +655,37 @@ export default class JitsiLocalTrack extends JitsiTrack {
return super.dispose();
}

/**
* Sets real device ID by comparing track information with device information. This is temporary solution until
* getConstraints() method will be implemented in browsers.
*
* @param {MediaDeviceInfo[]} devices - The list of devices obtained from enumerateDevices() call.
* @internal
* @returns {void}
*/
_setRealDeviceIdFromDeviceList(devices: MediaDeviceInfo[]): void {
const track = this.getTrack();
const kind = `${track.kind}input`;

// We need to match by deviceId as well, in case of multiple devices with the same label.
let device = devices.find(d => d.kind === kind && d.label === track.label && d.deviceId === this.deviceId);

if (!device && this._realDeviceId === 'default') { // the default device has been changed.
// If the default device was 'A' and the default device is changed to 'B' the label for the track will
// remain 'Default - A' but the label for the device in the device list will be updated to 'A'. That's
// why in order to match it we need to remove the 'Default - ' part.
const label = (track.label || '').replace('Default - ', '');

device = devices.find(d => d.kind === kind && d.label === label);
}

if (device) {
this._realDeviceId = device.deviceId;
} else {
this._realDeviceId = undefined;
}
}

/**
* Sends mute status for a track to conference if any.
*
Expand Down
Loading