From 8e06a9e7f4a9241dedf7b56c47f049c27009bc18 Mon Sep 17 00:00:00 2001 From: llfbandit Date: Sun, 3 Mar 2024 12:11:51 +0100 Subject: [PATCH] fix(Android): num channels & sample rate are not applied in AAC format. fix #289 --- record_android/CHANGELOG.md | 3 +++ .../kotlin/com/llfbandit/record/record/format/AacFormat.kt | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/record_android/CHANGELOG.md b/record_android/CHANGELOG.md index dd11ef0e..b952df42 100644 --- a/record_android/CHANGELOG.md +++ b/record_android/CHANGELOG.md @@ -1,3 +1,6 @@ +## 1.0.5 +* fix: num channels & sample rate are not applied in AAC format. + ## 1.0.4 * fix: AAC duration can not be obtained. diff --git a/record_android/android/src/main/kotlin/com/llfbandit/record/record/format/AacFormat.kt b/record_android/android/src/main/kotlin/com/llfbandit/record/record/format/AacFormat.kt index 9fb340ca..a785c3a9 100644 --- a/record_android/android/src/main/kotlin/com/llfbandit/record/record/format/AacFormat.kt +++ b/record_android/android/src/main/kotlin/com/llfbandit/record/record/format/AacFormat.kt @@ -35,8 +35,8 @@ class AacFormat : Format() { override fun getMediaFormat(config: RecordConfig): MediaFormat { val format = MediaFormat().apply { setString(MediaFormat.KEY_MIME, mimeTypeAudio) - setInteger(MediaFormat.KEY_SAMPLE_RATE, nearestValue(sampleRates, sampleRate)) - setInteger(MediaFormat.KEY_CHANNEL_COUNT, numChannels) + setInteger(MediaFormat.KEY_SAMPLE_RATE, nearestValue(sampleRates, config.sampleRate)) + setInteger(MediaFormat.KEY_CHANNEL_COUNT, config.numChannels) setInteger(MediaFormat.KEY_BIT_RATE, config.bitRate) // Specifics