@siteed/expo-audio-studio 2.17.0 → 2.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -8,6 +8,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8
8
  ## [Unreleased]
9
9
 
10
10
 
11
+ ## [2.18.0] - 2025-08-01
12
+ ### Changed
13
+ - feat(expo-audio-studio): optimize buffer size on android to prevent oom ([32fcb9b](https://github.com/deeeed/expo-audio-stream/commit/32fcb9b0a965669b3a37c9860998ae46a1d26cd8))
14
+ - fix(expo-audio-studio): invalid paused duration on android ([c107258](https://github.com/deeeed/expo-audio-stream/commit/c107258054ebdbc733298c84b8d84b0f9f416e6e))
15
+ - chore(expo-audio-studio): release @siteed/expo-audio-studio@2.17.0 ([8a303b4](https://github.com/deeeed/expo-audio-stream/commit/8a303b4d96988b97604123d74daaa406d9ec517c))
11
16
  ## [2.17.0] - 2025-07-31
12
17
  ### Changed
13
18
  - fix(expo-audio-studio): fix OutOfMemoryError by tracking stream position correctly ([b67e521](https://github.com/deeeed/expo-audio-stream/commit/b67e52142154d07873c5c1ec9c183d524d61e528))
@@ -368,7 +373,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
368
373
  - Feature: Audio features extraction during recording.
369
374
  - Feature: Consistent WAV PCM recording format across all platforms.
370
375
 
371
- [unreleased]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-studio@2.17.0...HEAD
376
+ [unreleased]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-studio@2.18.0...HEAD
377
+ [2.18.0]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-studio@2.17.0...@siteed/expo-audio-studio@2.18.0
372
378
  [2.17.0]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-studio@2.16.2...@siteed/expo-audio-studio@2.17.0
373
379
  [2.16.2]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-studio@2.16.1...@siteed/expo-audio-studio@2.16.2
374
380
  [2.16.1]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-studio@2.16.0...@siteed/expo-audio-studio@2.16.1
@@ -709,19 +709,29 @@ class AudioRecorderManager(
709
709
  )
710
710
 
711
711
  // Calculate buffer size based on bufferDurationSeconds if provided
712
- bufferSizeInBytes = recordingConfig.bufferDurationSeconds?.let { bufferDuration ->
712
+ var requestedBufferSize = recordingConfig.bufferDurationSeconds?.let { bufferDuration ->
713
713
  val bytesPerSample = when (recordingConfig.encoding) {
714
714
  "pcm_8bit" -> 1
715
715
  "pcm_16bit" -> 2
716
716
  "pcm_32bit" -> 4
717
717
  else -> 2
718
718
  }
719
- val requestedSize = (bufferDuration * recordingConfig.sampleRate *
720
- bytesPerSample * recordingConfig.channels).toInt()
721
- // Use the larger of requested size or minimum buffer size
722
- maxOf(requestedSize, minBufferSize)
719
+ (bufferDuration * recordingConfig.sampleRate * bytesPerSample * recordingConfig.channels).toInt()
723
720
  } ?: minBufferSize
724
721
 
722
+ LogUtils.d(CLASS_NAME, "Calculated minBufferSize: $minBufferSize bytes")
723
+ LogUtils.d(CLASS_NAME, "Requested buffer size: $requestedBufferSize bytes")
724
+
725
+ // Cap the buffer size to prevent OOM
726
+ val MAX_BUFFER_SIZE = 10485760 // 10MB
727
+ if (requestedBufferSize > MAX_BUFFER_SIZE) {
728
+ LogUtils.w(CLASS_NAME, "Requested buffer size $requestedBufferSize exceeds max limit of $MAX_BUFFER_SIZE, capping to max")
729
+ requestedBufferSize = MAX_BUFFER_SIZE
730
+ }
731
+
732
+ bufferSizeInBytes = maxOf(requestedBufferSize, minBufferSize)
733
+ LogUtils.d(CLASS_NAME, "Final bufferSizeInBytes: $bufferSizeInBytes (after capping and min check)")
734
+
725
735
  when {
726
736
  bufferSizeInBytes == AudioRecord.ERROR -> {
727
737
  LogUtils.e(CLASS_NAME, "Error getting minimum buffer size: ERROR")
@@ -1253,7 +1263,14 @@ class AudioRecorderManager(
1253
1263
 
1254
1264
  // Use cached file size instead of file system call
1255
1265
  val fileSize = if (recordingConfig.output.primary.enabled) cachedPrimaryFileSize else 0L
1256
- val duration = if (!recordingConfig.output.primary.enabled) {
1266
+ val duration = if (isPaused.get()) {
1267
+ // Return frozen duration when paused using lastPauseTime
1268
+ if (lastPauseTime > 0) {
1269
+ lastPauseTime - recordingStartTime - pausedDuration
1270
+ } else {
1271
+ 0L
1272
+ }
1273
+ } else if (!recordingConfig.output.primary.enabled) {
1257
1274
  // For streaming-only mode, calculate duration from actual recording time
1258
1275
  val actualRecordingTime = if (recordingStartTime > 0) {
1259
1276
  System.currentTimeMillis() - recordingStartTime - pausedDuration
@@ -1423,7 +1440,7 @@ class AudioRecorderManager(
1423
1440
  while (_isRecording.get() && !Thread.currentThread().isInterrupted) {
1424
1441
  loopCount++
1425
1442
  if (loopCount % 100 == 0) {
1426
- LogUtils.d(CLASS_NAME, "Recording loop iteration $loopCount, isRecording: ${_isRecording.get()}")
1443
+ LogUtils.d(CLASS_NAME, "Recording loop iteration $loopCount, isRecording: ${_isRecording.get()}, accumulatedAudioSize: ${accumulatedAudioData.size()}, accumulatedAnalysisSize: ${accumulatedAnalysisData.size()}")
1427
1444
  }
1428
1445
  if (isPaused.get()) {
1429
1446
  Thread.sleep(100) // Add small delay when paused
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@siteed/expo-audio-studio",
3
- "version": "2.17.0",
3
+ "version": "2.18.0",
4
4
  "description": "Comprehensive audio processing library for React Native and Expo with recording, analysis, visualization, and streaming capabilities across iOS, Android, and web",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",