Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fluffy-papayas-hammer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"client-sdk-android": patch
---

Fix maxFps not applying for very low framerates
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023-2024 LiveKit, Inc.
* Copyright 2023-2025 LiveKit, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -69,6 +69,7 @@ import livekit.org.webrtc.VideoCapturer
import livekit.org.webrtc.VideoProcessor
import javax.inject.Named
import kotlin.math.max
import kotlin.math.min

class LocalParticipant
@AssistedInject
Expand Down Expand Up @@ -591,7 +592,7 @@ internal constructor(
// if resolution is high enough, we send both h and q res.
// otherwise only send h
val size = max(width, height)

val maxFps = encoding.maxFps
fun calculateScaleDown(captureParam: VideoCaptureParameter): Double {
val targetSize = max(captureParam.width, captureParam.height)
return size / targetSize.toDouble()
Expand All @@ -600,11 +601,11 @@ internal constructor(
val lowScale = calculateScaleDown(lowPreset.capture)
val midScale = calculateScaleDown(midPreset.capture)

addEncoding(lowPreset.encoding, lowScale)
addEncoding(midPreset.encoding, midScale)
addEncoding(lowPreset.encoding.copy(maxFps = min(lowPreset.encoding.maxFps, maxFps)), lowScale)
addEncoding(midPreset.encoding.copy(maxFps = min(midPreset.encoding.maxFps, maxFps)), midScale)
} else {
val lowScale = calculateScaleDown(lowPreset.capture)
addEncoding(lowPreset.encoding, lowScale)
addEncoding(lowPreset.encoding.copy(maxFps = min(lowPreset.encoding.maxFps, maxFps)), lowScale)
}
addEncoding(encoding, 1.0)
} else {
Expand Down
Loading