Skip to content

replace base64 with raw data#129

Merged
openminddev merged 4 commits into
mainfrom
replace-base64-with-raw-data
May 28, 2026
Merged

replace base64 with raw data#129
openminddev merged 4 commits into
mainfrom
replace-base64-with-raw-data

Conversation

@YuchengZhou821

Copy link
Copy Markdown
Contributor

This pull request refactors the audio streaming code in both audio_input_stream.py and audio_rtsp_input_stream.py to improve how audio data is packaged and transmitted. The main change is switching from a JSON-based response containing base64-encoded audio to a binary format that prepends a JSON header to the raw audio chunk. This should improve efficiency and simplify downstream processing.

Audio streaming protocol changes:

  • The generator method in both audio_input_stream.py and audio_rtsp_input_stream.py now yields raw bytes instead of a dictionary with base64-encoded audio. The new format consists of a 4-byte length-prefixed JSON header followed by the raw audio chunk. ([[1]](https://github.com/OpenMind/OM1-modules/pull/129/files#diff-74140ed30247fd9aaedddedae151eac279bb8026a26f6021b171d09fdbc3bd99L419-R420), [[2]](https://github.com/OpenMind/OM1-modules/pull/129/files#diff-6495332b6ea94450241e9a14106cad03cbda46ebc4e10ea720ba8217a29259a8L417-R418))
  • The JSON header now includes a millisecond-precision timestamp (timestamp), and is serialized and prefixed to the audio chunk using struct.pack. ([[1]](https://github.com/OpenMind/OM1-modules/pull/129/files#diff-74140ed30247fd9aaedddedae151eac279bb8026a26f6021b171d09fdbc3bd99L440-R451), [[2]](https://github.com/OpenMind/OM1-modules/pull/129/files#diff-6495332b6ea94450241e9a14106cad03cbda46ebc4e10ea720ba8217a29259a8L438-R449))

Code and interface updates:

  • Updated import statements to include struct for binary packing. ([[1]](https://github.com/OpenMind/OM1-modules/pull/129/files#diff-74140ed30247fd9aaedddedae151eac279bb8026a26f6021b171d09fdbc3bd99R8), [[2]](https://github.com/OpenMind/OM1-modules/pull/129/files#diff-6495332b6ea94450241e9a14106cad03cbda46ebc4e10ea720ba8217a29259a8R5))
  • Audio data callbacks now receive the new binary format instead of a JSON string. ([[1]](https://github.com/OpenMind/OM1-modules/pull/129/files#diff-74140ed30247fd9aaedddedae151eac279bb8026a26f6021b171d09fdbc3bd99L440-R451), [[2]](https://github.com/OpenMind/OM1-modules/pull/129/files#diff-6495332b6ea94450241e9a14106cad03cbda46ebc4e10ea720ba8217a29259a8L438-R449))

These changes make the audio streaming more efficient and consistent across both input stream modules.

@openminddev openminddev merged commit 4ee799e into main May 28, 2026
6 of 7 checks passed
@openminddev openminddev deleted the replace-base64-with-raw-data branch May 28, 2026 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants