Skip to content

Commit

Permalink
fix: Fix NoSuchElementException in getRecommendedBitRate (#2266)
Browse files Browse the repository at this point in the history
* Remove unused hasConstants method.  Do no thrown error on minBy call when filterd videoProfiles contains zero items.

* Remove not related to the fix changes.
  • Loading branch information
Romick2005 authored Dec 12, 2023
1 parent 4ee52d6 commit a612eb9
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ fun RecordingSession.getRecommendedBitRate(fps: Int, codec: VideoCodec, hdr: Boo
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
val profiles = CamcorderProfile.getAll(cameraId, quality)
if (profiles != null) {
val best = profiles.videoProfiles.filterNotNull().minBy {
val best = profiles.videoProfiles.filterNotNull().minByOrNull {
abs(it.width * it.height - targetResolution.width * targetResolution.height)
}

Expand Down

1 comment on commit a612eb9

@vercel
Copy link

@vercel vercel bot commented on a612eb9 Dec 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.