-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WebRTC m97 handles odd dimensions
- Loading branch information
Showing
3 changed files
with
8 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 0 additions & 28 deletions
28
livekit-android-sdk/src/test/java/io/livekit/android/room/util/EncodingUtilsTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,4 @@ | ||
package io.livekit.android.room.util | ||
|
||
import org.junit.Assert | ||
import org.junit.Test | ||
|
||
class EncodingUtilsTest { | ||
@Test | ||
fun evenScale() { | ||
fun Int.isEven() = this % 2 == 0 | ||
|
||
val sourceWidth = 800 | ||
val sourceHeight = 600 | ||
val scaleDownBy = EncodingUtils.findEvenScaleDownBy(sourceWidth, sourceHeight, 240, 180) | ||
?: throw Exception("scale should not be null!") | ||
|
||
Assert.assertTrue((sourceWidth / scaleDownBy).toInt().isEven()) | ||
Assert.assertTrue((sourceHeight / scaleDownBy).toInt().isEven()) | ||
} | ||
|
||
@Test | ||
fun evenScaleWeirdSource() { | ||
fun Int.isEven() = this % 2 == 0 | ||
|
||
val sourceWidth = 800 | ||
val sourceHeight = 602 | ||
val scaleDownBy = EncodingUtils.findEvenScaleDownBy(sourceWidth, sourceHeight, 240, 180) | ||
?: throw Exception("scale should not be null!") | ||
|
||
Assert.assertTrue((sourceWidth / scaleDownBy).toInt().isEven()) | ||
Assert.assertTrue((sourceHeight / scaleDownBy).toInt().isEven()) | ||
} | ||
} |