Enabled FEC by default + added setting

This commit is contained in:
Sylvain Berfini 2024-04-29 14:33:47 +02:00
parent 7e06c5d85a
commit ca475c0ab8
6 changed files with 48 additions and 1 deletions

View file

@ -43,4 +43,7 @@ history_max_size=100
conference_layout=1
hide_empty_chat_rooms=0
[fec]
fec_enabled=1
## End of default rc

View file

@ -287,6 +287,8 @@ class CoreContext @UiThread constructor(val context: Context) : HandlerThread("C
policy.automaticallyAccept = true
policy.automaticallyAcceptDirection = MediaDirection.RecvOnly
core.videoActivationPolicy = policy
core.isFecEnabled = true
}
updateFriendListsSubscriptionDependingOnDefaultAccount()

View file

@ -54,6 +54,7 @@ class SettingsViewModel @UiThread constructor() : ViewModel() {
val echoCancellerEnabled = MutableLiveData<Boolean>()
val routeAudioToBluetooth = MutableLiveData<Boolean>()
val videoEnabled = MutableLiveData<Boolean>()
val videoFecEnabled = MutableLiveData<Boolean>()
val isVibrationAvailable = MutableLiveData<Boolean>()
val vibrateDuringIncomingCall = MutableLiveData<Boolean>()
@ -171,6 +172,7 @@ class SettingsViewModel @UiThread constructor() : ViewModel() {
echoCancellerEnabled.postValue(core.isEchoCancellationEnabled)
routeAudioToBluetooth.postValue(corePreferences.routeAudioToBluetoothIfAvailable)
videoEnabled.postValue(core.isVideoEnabled)
videoFecEnabled.postValue(core.isFecEnabled)
vibrateDuringIncomingCall.postValue(core.isVibrationOnIncomingCallEnabled)
autoRecordCalls.postValue(corePreferences.automaticallyStartCallRecording)
@ -242,6 +244,15 @@ class SettingsViewModel @UiThread constructor() : ViewModel() {
}
}
@UiThread
fun toggleEnableVideoFec() {
val newValue = videoFecEnabled.value == false
coreContext.postOnCoreThread { core ->
core.isFecEnabled = newValue
videoFecEnabled.postValue(core.isFecEnabled)
}
}
@UiThread
fun toggleVibrateOnIncomingCalls() {
val newValue = vibrateDuringIncomingCall.value == false

View file

@ -114,6 +114,35 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/route_audio_to_bluetooth_switch" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/settings_title_style"
android:onClick="@{() -> viewModel.toggleEnableVideoFec()}"
android:id="@+id/enable_fec_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="10dp"
android:text="@string/settings_calls_enable_fec_title"
android:maxLines="2"
android:ellipsize="end"
app:layout_constraintTop_toTopOf="@id/enable_fec_switch"
app:layout_constraintBottom_toBottomOf="@id/enable_fec_switch"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/enable_fec_switch"/>
<com.google.android.material.materialswitch.MaterialSwitch
style="@style/material_switch_style"
android:id="@+id/enable_fec_switch"
android:onClick="@{() -> viewModel.toggleEnableVideoFec()}"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginEnd="16dp"
android:enabled="@{viewModel.videoEnabled}"
android:checked="@{viewModel.videoEnabled &amp;&amp; viewModel.videoFecEnabled}"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/enable_video_switch" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/settings_title_style"
android:onClick="@{() -> viewModel.toggleVibrateOnIncomingCalls()}"
@ -142,7 +171,7 @@
android:layout_marginEnd="16dp"
android:checked="@{viewModel.vibrateDuringIncomingCall}"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/enable_video_switch" />
app:layout_constraintTop_toBottomOf="@id/enable_fec_switch" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/settings_title_style"

View file

@ -220,6 +220,7 @@
<string name="settings_calls_echo_canceller_subtitle">Évite que de l\'écho soit entendu par votre correspondant</string>
<string name="settings_calls_route_audio_to_bluetooth_title">Utiliser le périphérique Bluetooth si possible</string>
<string name="settings_calls_enable_video_title">Activer la vidéo</string>
<string name="settings_calls_enable_fec_title">Activer la FEC vidéo</string>
<string name="settings_calls_ringtones_title">Choisissez votre sonnerie :</string>
<string name="settings_calls_use_device_ringtone_label">Utiliser la sonnerie du système</string>
<string name="settings_calls_play_ringtone_label">Lire</string>

View file

@ -255,6 +255,7 @@
<string name="settings_calls_echo_canceller_subtitle">Prevents echo from being heard by remote end</string>
<string name="settings_calls_route_audio_to_bluetooth_title">Route audio to bluetooth device, if any</string>
<string name="settings_calls_enable_video_title">Enable video</string>
<string name="settings_calls_enable_fec_title">Enable video FEC</string>
<string name="settings_calls_ringtones_title">Choose your ringtone:</string>
<string name="settings_calls_use_device_ringtone_label">Use this device\'s ringtone</string>
<string name="settings_calls_play_ringtone_label">Play</string>