replace base64 with raw data#129
Merged
Merged
Conversation
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.
This pull request refactors the audio streaming code in both
audio_input_stream.pyandaudio_rtsp_input_stream.pyto 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:
generatormethod in bothaudio_input_stream.pyandaudio_rtsp_input_stream.pynow yields rawbytesinstead 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))timestamp), and is serialized and prefixed to the audio chunk usingstruct.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:
structfor 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))[[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.