mirror of
https://github.com/kunkundi/crossdesk.git
synced 2026-10-28 16:54:11 +08:00
[feat] add mobile codec status and scrolling codec names
This commit is contained in:
@@ -99,10 +99,11 @@ export class VideoSettings {
|
||||
feedback(): string { return !this.supported ? '连接建立后可调整,需被控端支持。' : this.failed ? '调整失败,请重试。' : this.pending ? '等待电脑端确认…' : ''; }
|
||||
}
|
||||
export interface Traffic { inbound: number; outbound: number; loss: number; }
|
||||
export interface NetworkReport { rtt: number; mode: number; srtp: boolean; video: Traffic; audio: Traffic; data: Traffic; total: Traffic; }
|
||||
export interface NetworkReport { rtt: number; mode: number; srtp: boolean; decoder?: string; video: Traffic; audio: Traffic; data: Traffic; total: Traffic; }
|
||||
export interface FrameSample { time: number; count: number; latency: number; latencyCount: number; }
|
||||
export class NetworkStatistics {
|
||||
report?: NetworkReport;
|
||||
remoteEncoder: string = '';
|
||||
reportTime: number = -Infinity;
|
||||
rttTime: number = -Infinity;
|
||||
rtt: number = -1;
|
||||
|
||||
@@ -26,7 +26,8 @@ export interface RemoteDisplay { name: string; }
|
||||
interface HostInfo { host_name: string; platform: string; app_version: string; supports_video_settings: boolean; displays: RemoteDisplay[]; }
|
||||
interface SettingAck { quality: number; frame_rate: number; preference: number; request_id: number; accepted: boolean; }
|
||||
interface ServiceStatus { available: boolean; interactive_stage?: string; }
|
||||
interface ControlData { type: number; host_info?: HostInfo; video_settings?: SettingAck; service_status?: ServiceStatus; privacy_status?: PrivacyStatus; }
|
||||
interface VideoCodecStatus { encoder: string; }
|
||||
interface ControlData { type: number; host_info?: HostInfo; video_settings?: SettingAck; service_status?: ServiceStatus; privacy_status?: PrivacyStatus; video_codec?: VideoCodecStatus; }
|
||||
interface PresenceRequest { type: string; devices: string[]; subscribe: boolean; }
|
||||
interface SignalType { type: string; }
|
||||
|
||||
@@ -465,6 +466,7 @@ export class MobileController {
|
||||
if (this.receivedHostInfo) this.checkRemote(this.remoteVersion);
|
||||
}
|
||||
private data(message: ControlData): void {
|
||||
if (message.type === 14 && message.video_codec) { this.network.remoteEncoder = message.video_codec.encoder; return; }
|
||||
if (message.type === 10 && message.privacy_status) { this.privacyScreen.receive(message.privacy_status, this.now()); this.syncPrivacy(); return; }
|
||||
if (message.type === 5) {
|
||||
this.serviceAvailable = message.service_status?.available === true;
|
||||
|
||||
@@ -198,6 +198,15 @@ export struct MobileRemoteView {
|
||||
}.width('100%').constraintSize({ minHeight: 21 })
|
||||
}
|
||||
@Builder
|
||||
NetworkCodec(label: string, value: string) {
|
||||
Row({ space: 8 }) {
|
||||
Text(label).fontSize(12).fontColor(MobileTheme.secondary).maxLines(1)
|
||||
Text(value).fontSize(12).fontColor(MobileTheme.ink).textAlign(TextAlign.End).layoutWeight(1)
|
||||
.maxLines(1).textOverflow({ overflow: TextOverflow.MARQUEE })
|
||||
.marqueeOptions({ start: true, step: 0.5, loop: -1, fromStart: true })
|
||||
}.width('100%').constraintSize({ minHeight: 21 })
|
||||
}
|
||||
@Builder
|
||||
Menu() {
|
||||
Column({ space: 10 }) {
|
||||
Row({ space: 6 }) {
|
||||
@@ -266,7 +275,8 @@ export struct MobileRemoteView {
|
||||
this.NetworkDetail('连接延时(RTT)', NetworkStatistics.delay(this.state.networkTime - (this.controller?.network.rttTime ?? 0) < 3000 ? this.controller?.network.rtt ?? -1 : -1))
|
||||
this.NetworkDetail('连接方式', this.controller?.network.mode(this.state.networkTime) ?? '—')
|
||||
this.NetworkDetail('媒体加密', this.controller?.network.current(this.state.networkTime) === undefined ? '—' : this.controller?.network.report?.srtp ? 'SRTP 已启用' : '未启用', this.controller?.network.current(this.state.networkTime)?.srtp === true)
|
||||
|
||||
this.NetworkCodec('被控端编码器', this.controller?.network.remoteEncoder || '—')
|
||||
this.NetworkCodec('控制端解码器', this.controller?.network.report?.decoder || '—')
|
||||
}
|
||||
}.width('100%')
|
||||
}.constraintSize({ maxHeight: Math.max(48, this.viewHeight - 132) }).width('100%').scrollBar(BarState.Off)
|
||||
|
||||
Reference in New Issue
Block a user