@@ -34,15 +34,11 @@ export default class ConfigDialog extends Vue {
3434 @Inject ()
3535 closeConfigDialog: Function ;
3636
37- // 强制更新的 key
38- private componentKey = 0 ;
39-
4037 // 监听对话框打开
4138 @Watch (' configDialogVisible' )
4239 onDialogChange(newVal : boolean ) {
4340 if (newVal ) {
4441 this .deviceManager .updateSimulcastBitrates ();
45- this .forceUpdate ();
4642 }
4743 }
4844
@@ -68,7 +64,6 @@ export default class ConfigDialog extends Vue {
6864 */
6965 set selectedChannelRid(rid : string ) {
7066 this .deviceManager .selectSimulcastChannel (rid );
71- this .forceUpdate ();
7267 }
7368
7469 /**
@@ -89,27 +84,18 @@ export default class ConfigDialog extends Vue {
8984 get isSampleRateFixed(): boolean {
9085 // 立体声模式使用 AudioContext,采样率固定
9186 // 单声道模式使用原始流,采样率可调整
92- const channelMode = this .deviceManager .currentConfigDevice ?. settings ?. channelMode ;
93- return channelMode === ' stereo' ;
87+ const configForm = this .deviceManager .configForm ;
88+ return configForm ?. channelMode === ' stereo' ;
9489 }
9590
96- /**
97- * 获取采样率的最小值
98- */
9991 get sampleRateMin(): number {
10092 return this .deviceManager .currentConfigDevice ?.capabilities ?.sampleRate ?.min || 8000 ;
10193 }
10294
103- /**
104- * 获取采样率的最大值
105- */
10695 get sampleRateMax(): number {
10796 return this .deviceManager .currentConfigDevice ?.capabilities ?.sampleRate ?.max || 48000 ;
10897 }
10998
110- /**
111- * 转换 rid 名称
112- */
11399 private convertRidName(rid : string ): string {
114100 const nameMap: Record <string , string > = {
115101 original: ' 原画' ,
@@ -120,39 +106,24 @@ export default class ConfigDialog extends Vue {
120106 return nameMap [rid ] || rid ;
121107 }
122108
123- /**
124- * 格式化 simulcast 配置显示
125- */
126109 private formatSimulcastConfig(config : any ): string {
127110 const name = this .convertRidName (config .rid );
128111 const bitrate = Math .round (config .maxBitRate );
129112 const scale = config .scaleResolutionDownBy ;
130113 return ` ${name } (${scale }x) @ ${bitrate } Kbps ` ;
131114 }
132115
133- /**
134- * 处理码率选择变化
135- */
136116 private onSimulcastChange(rid : string ) {
137117 this .deviceManager .selectSimulcastChannel (rid );
138- this .forceUpdate ();
139118 }
140119
141- /**
142- * 处理预设分辨率变化
143- */
144120 private onPresetChange(presetStr : string ) {
145121 this .deviceManager .applyPreset (presetStr );
146122 this .deviceManager .updateSimulcastBitrates ();
147- this .forceUpdate ();
148123 }
149124
150- /**
151- * 处理帧率变化
152- */
153125 private onFrameRateChange() {
154126 this .deviceManager .updateSimulcastBitrates ();
155- this .forceUpdate ();
156127 }
157128
158129 /**
@@ -161,14 +132,9 @@ export default class ConfigDialog extends Vue {
161132 private onChannelModeChange(mode : ' mono' | ' stereo' ) {
162133 // 根据通道模式自动设置声道数
163134 this .deviceManager .configForm .channelCount = mode === ' stereo' ? 2 : 1 ;
164- this .forceUpdate ();
165- }
166-
167- /**
168- * 强制组件更新
169- */
170- private forceUpdate() {
171- this .componentKey ++ ;
135+ if (mode === ' stereo' ) {
136+ this .deviceManager .configForm .sampleRate = this .sampleRateMax ;
137+ }
172138 }
173139}
174140 </script >
@@ -220,12 +186,8 @@ export default class ConfigDialog extends Vue {
220186 <div class =" capabilities-info" >
221187 <p v-if =" deviceManager.currentConfigDevice?.capabilities?.sampleRate" >
222188 采样率:
223- {{ Math.round(sampleRateMin) }}
224- <span v-if =" !isSampleRateFixed" > - {{ Math.round(sampleRateMax) }} </span >
225- Hz
226- <span v-if =" isSampleRateFixed" style =" color : var (--font-secondary-color )" >
227- (固定)
228- </span >
189+ <span v-if =" isSampleRateFixed" >{{ Math.round(sampleRateMax) }} Hz</span >
190+ <span v-else >{{ Math.round(sampleRateMin) }} - {{ Math.round(sampleRateMax) }} Hz</span >
229191 </p >
230192 <p v-else >待获取设备参数信息</p >
231193 </div >
@@ -263,12 +225,7 @@ export default class ConfigDialog extends Vue {
263225 </el-form-item >
264226
265227 <el-form-item label =" 码率" >
266- <el-select
267- :key =" componentKey"
268- v-model =" selectedChannelRid"
269- placeholder =" 选择码率"
270- @change =" onSimulcastChange"
271- >
228+ <el-select v-model =" selectedChannelRid" placeholder =" 选择码率" @change =" onSimulcastChange" >
272229 <el-option
273230 v-for =" config in simulcastConfigs"
274231 :key =" config.rid"
0 commit comments