Repository navigation
fix: keep strings intact across JNI and bind both AudioResampler initializers - #512
Merged
Merged
Conversation
…ializers Native strings went back through NewStringUTF, which takes Modified UTF-8, so emoji and embedded NULs came back changed, and empty strings became null. Convert UTF-8 to UTF-16 properly and keep "" as "", mapping to null only where WebRTC encodes an absent value as empty or unset. WebRTC's error text, which carries track ids and SDP lines, was used as the printf format of the thrown exception and also reached Java in Modified UTF-8. Pass it as an argument and convert it the same way. The JNI header lacked the long names of the overloaded AudioResampler.initialize, so initialize(int, int, int) had C++ linkage and Java bound it to the parameterless function.
devopvoid
force-pushed
the
fix/jni-string-conversion
branch
from
November 1, 2026 14:38
3733bde to
3e9a14e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
NewStringUTF, which takes Modified UTF-8: emoji and embedded NULs were mangled and empty strings becamenull(e.g.RTCDataChannel.getLabel()).JavaStringnow converts UTF-8 ⇄ UTF-16 itself and keeps"".nullremains only where WebRTC encodes an absent value as empty or unset: transceivermid, candidatesdpMid/serverUrl, unset ICE server credentials, the unexposed address of an ICE error event.RTCDtmfSender.tones()and the finalonToneChangenow return"", as documented.printfformat of the thrown exception and went throughNewStringUTF/ThrowNew. It is now an argument and converted the same way.AudioResampler.initialize, soinitialize(int, int, int)had C++ linkage and bound to the parameterless function. Both are nowinitialize__/initialize__III.