feat: (for now android only!) dscp retrieval and configuration methods

This commit is contained in:
Andrew 2026-04-28 15:08:25 +07:00
parent 02cc6ad612
commit 26d72ec1af
6 changed files with 104 additions and 6 deletions

View file

@ -242,6 +242,23 @@ class LiblinphoneFlutterPlugin : FlutterPlugin, ActivityAware, MethodCallHandler
result.success(linphoneBridge.getPlaybackGain())
}
"setDscp" -> {
try {
val sipDscp = call.argument<Int>("sipDscp")
val audioDscp = call.argument<Int>("audioDscp")
val videoDscp = call.argument<Int>("videoDscp")
linphoneBridge.setDscp(sipDscp, audioDscp, videoDscp)
result.success(true)
} catch (e: Exception) {
Log.e(TAG, "setDscp: ${e.message}")
result.error("error", e.message, e)
}
}
"getDscp" -> {
result.success(linphoneBridge.getDscp().toMap())
}
else -> {
result.notImplemented()
}

View file

@ -393,4 +393,24 @@ class LinphoneBridge(
fun getPlaybackGain(): Float {
return core.getPlaybackGainDb()
}
data class DscpValues(val sipDscp: Int, val audioDscp: Int, val videoDscp: Int) {
fun toMap(): Map<String, Any?> {
return mapOf(
"sipDscp" to core.sipDscp,
"audioDscp" to core.audioDscp,
"videoDscp" to core.videoDscp,
);
}
}
fun setDscp(sipDscp: Int?, audioDscp: Int?, videoDscp: Int?) {
sipDscp?.let { core.sipDscp = it }
audioDscp?.let { core.audioDscp = it }
videoDscp?.let { core.videoDscp = it }
}
fun getDscp(): DscpValues {
return DscpValues(core.sipDscp, core.audioDscp, core.videoDscp)
}
}