Add enableTranscoding ingress option for WHIP

pull/850/merge
pabloFuente 2024-11-21 16:11:33 +01:00
parent 18343fa47d
commit a4b010faba
4 changed files with 53 additions and 43 deletions

View File

@ -126,8 +126,8 @@ mat-chip-row {
margin-bottom: 7px;
}
#ingress-simulcast {
margin-right: 6px;
#ingress-video-codec-select {
margin-left: 6px;
}
#ingress-video-codec-select {

View File

@ -194,6 +194,9 @@
<mat-checkbox id="ingress-simulcast" [(ngModel)]="ingressSimulcast"
[disabled]="!ingressWithVideo || ingressVideoEncodingPresetSelected != undefined">Simulcast</mat-checkbox>
</span>
<span style="display: inline-block" matTooltip="Only for WHIP" [matTooltipDisabled]="inputTypeSelected === 1">
<mat-checkbox id="ingress-transcoding" [(ngModel)]="ingressEnableTranscoding" [disabled]="inputTypeSelected !== 1">Transcoding</mat-checkbox>
</span>
<span style="display: inline-block" [matTooltip]="!ingressWithVideo ? 'Only with video' : 'Preset overrides this value'"
[matTooltipDisabled]="!!ingressWithVideo && ingressVideoEncodingPresetSelected == undefined">
<mat-form-field id="ingress-video-codec-select">

View File

@ -65,6 +65,7 @@ export class RoomApiDialogComponent {
ingressWithAudio: boolean = false;
ingressVideoCodecSelected: VideoCodec = VideoCodec.H264_BASELINE;
ingressSimulcast: boolean = true;
ingressEnableTranscoding: boolean = false;
ingressVideoEncodingPresetSelected?: IngressVideoEncodingPreset = undefined;
response: string;
@ -306,6 +307,7 @@ export class RoomApiDialogComponent {
this.ingressWithVideo,
this.ingressVideoCodecSelected,
this.ingressSimulcast,
this.ingressEnableTranscoding,
this.ingressVideoEncodingPresetSelected
);
this.response = JSON.stringify(ingress, null, 4);

View File

@ -207,11 +207,12 @@ export class RoomApiService {
async createIngress(
room_name: string,
input_type: IngressInput,
inputType: IngressInput,
withAudio: boolean,
withVideo: boolean,
codec: VideoCodec,
simulcast: boolean,
enableTranscoding: boolean,
preset?: IngressVideoEncodingPreset
): Promise<IngressInfo> {
let url;
@ -224,19 +225,23 @@ export class RoomApiService {
: 'https://s3.eu-west-1.amazonaws.com/public.openvidu.io/bbb_sunflower_1080p_60fps_normal_noaudio.mp4';
}
let options: CreateIngressOptions = {
name: input_type + '-' + room_name,
name: inputType + '-' + room_name,
roomName: room_name,
participantIdentity: 'IngressParticipantIdentity',
participantName: 'MyIngress',
participantMetadata: 'IngressParticipantMetadata',
url,
video: {
};
if (inputType === IngressInput.WHIP_INPUT) {
options.enableTranscoding = enableTranscoding;
}
if (inputType != IngressInput.WHIP_INPUT || enableTranscoding) {
options.video = {
encodingOptions: {
case: preset != undefined ? 'preset' : 'options',
value: {},
},
} as any,
};
} as any;
if (preset != undefined) {
options.video!.encodingOptions.value = preset;
} else {
@ -274,9 +279,9 @@ export class RoomApiService {
}
encodingOptions.layers = layers;
}
}
const ingressInfo = await this.ingressClient.createIngress(
input_type,
inputType,
options
);
return ingressInfo;