@qafka/react-native 2.3.4 → 2.3.5
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.
|
@@ -184,11 +184,18 @@ class QafkaAudioModule(reactContext: ReactApplicationContext) :
|
|
|
184
184
|
dlogW("⚠️ AutomaticGainControl NOT available on this device")
|
|
185
185
|
}
|
|
186
186
|
|
|
187
|
-
// Initialize AudioTrack for playback
|
|
187
|
+
// Initialize AudioTrack for playback.
|
|
188
|
+
// The voice-communication output path favors low latency with a
|
|
189
|
+
// small default buffer; that underruns on jittery streamed network
|
|
190
|
+
// audio and makes playback choppy ("skipping"). Size the buffer for
|
|
191
|
+
// ~0.4s of audio to absorb jitter — smoothness matters more than
|
|
192
|
+
// latency for an assistant reply.
|
|
188
193
|
val playMinBuffer = AudioTrack.getMinBufferSize(
|
|
189
194
|
PLAYBACK_SAMPLE_RATE, CHANNEL_OUT, AUDIO_ENCODING
|
|
190
195
|
)
|
|
191
|
-
|
|
196
|
+
// bytes/sec = sampleRate * 2 (16-bit mono); * 4 / 10 ≈ 0.4s
|
|
197
|
+
val jitterBufferBytes = PLAYBACK_SAMPLE_RATE * 2 * 4 / 10
|
|
198
|
+
val playBufferSize = maxOf(playMinBuffer * 2, jitterBufferBytes)
|
|
192
199
|
|
|
193
200
|
// iOS VPIO equivalent (part 2): play on the voice-communication path
|
|
194
201
|
// (USAGE_VOICE_COMMUNICATION + CONTENT_TYPE_SPEECH) so the echo
|
package/package.json
CHANGED