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; margin-bottom: 7px;
} }
#ingress-simulcast { #ingress-video-codec-select {
margin-right: 6px; margin-left: 6px;
} }
#ingress-video-codec-select { #ingress-video-codec-select {

View File

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

View File

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

View File

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