From 6d446ca738ab61cb3607fec753644e2ec32a21cc Mon Sep 17 00:00:00 2001 From: ThibaultBee <37510686+ThibaultBee@users.noreply.github.com> Date: Tue, 21 Nov 2023 22:21:46 +0100 Subject: [PATCH] fix(core): `getSupportedProfiles` only return one of each supported profiles --- .../streampack/internal/encoders/MediaCodecHelper.kt | 4 ++-- .../streamers/helpers/StreamerConfigurationHelper.kt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/io/github/thibaultbee/streampack/internal/encoders/MediaCodecHelper.kt b/core/src/main/java/io/github/thibaultbee/streampack/internal/encoders/MediaCodecHelper.kt index ee6021c1f..16d74edc0 100644 --- a/core/src/main/java/io/github/thibaultbee/streampack/internal/encoders/MediaCodecHelper.kt +++ b/core/src/main/java/io/github/thibaultbee/streampack/internal/encoders/MediaCodecHelper.kt @@ -217,7 +217,7 @@ object MediaCodecHelper { fun getProfileLevel( mimeType: String, ): List = - getCodecCapabilities(mimeType).profileLevels.toList() + getCodecCapabilities(mimeType).profileLevels.toList().toSet().toList() /** * Get encoder supported profile level list for the specified encoder. @@ -230,7 +230,7 @@ object MediaCodecHelper { mimeType: String, name: String ): List = - getCodecCapabilities(mimeType, name).profileLevels.toList() + getCodecCapabilities(mimeType, name).profileLevels.toList().toSet().toList() /** * Get encoder supported profiles list for the default encoder. diff --git a/core/src/main/java/io/github/thibaultbee/streampack/streamers/helpers/StreamerConfigurationHelper.kt b/core/src/main/java/io/github/thibaultbee/streampack/streamers/helpers/StreamerConfigurationHelper.kt index 366e5c891..6193ef929 100644 --- a/core/src/main/java/io/github/thibaultbee/streampack/streamers/helpers/StreamerConfigurationHelper.kt +++ b/core/src/main/java/io/github/thibaultbee/streampack/streamers/helpers/StreamerConfigurationHelper.kt @@ -180,7 +180,7 @@ open class VideoStreamerConfigurationHelper(private val videoMuxerHelper: IVideo else -> throw InvalidParameterException("Unknown mimetype $mimeType") } val supportedProfiles = MediaCodecHelper.getProfiles(mimeType) - return supportedProfiles.filter { profiles.contains(it) } + return profiles.filter { supportedProfiles.contains(it) } } private val avcProfiles = listOf(