-
Couldn't load subscription status.
- Fork 747
in case client send corrupt data #279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
That's a great PR. I think probably it needs some changes to stt_cli_client.py in RealtimeSTT_server folder and then maybe to audio_input.py and audio_recorder_client.py in RealtimeSTT folder to adapt to this new chunk verification logic. Since I'm doing some refacturing currently too I think I'll merge it later and then add the needed changes. |
|
I'll help in case I'm free on weekend if you haven't finished it, I also forgot to push the other test that I wrote |
1. RealtimeSTT/audio_recorder_client.py
- Added calculate_checksum() method for data verification
- Updated feed_audio() method to include verification data when server_sent_to_stt is present
- Added enable_data_verification parameter to constructor
- Updated record_and_send_audio() method to include verification metadata when enabled
2. RealtimeSTT_server/stt_cli_client.py
- Added --verify-data command line flag
- Updated client instantiation to pass the verification flag
Key Features Added
Optional Data Verification:
- Backward compatible - verification is off by default
- When enabled, adds checksum, data length, and timestamp to metadata
- Follows the same pattern as the sample Python client
CLI Integration:
- New --verify-data flag enables verification in the CLI client
- Usage: stt-cli-client --verify-data
Automatic Verification:
- feed_audio() automatically enables verification when server_sent_to_stt is in metadata
- record_and_send_audio() includes verification when enable_data_verification=True
Usage Examples
# CLI with verification enabled
stt-cli-client --verify-data --language en
# Python code with verification
client = AudioToTextRecorderClient(
enable_data_verification=True,
language="en"
)
The implementation maintains full backward compatibility while adding robust data integrity verification capabilities that integrate seamlessly with the existing
server verification system.
Usage: # Test your current server python tests/test_quick_performance.py # Compare default vs optimized (manual server restart) python tests/test_quick_performance.py --compare 2. tests/test_performance_benchmark.py - Comprehensive Usage: # Basic benchmark python tests/test_performance_benchmark.py # Test with concurrent requests python tests/test_performance_benchmark.py --concurrent 5 # Auto-start optimized server and test python tests/test_performance_benchmark.py --config optimized --auto-server
…y detection param
feat: Add comprehensive data integrity verification system with client rejection
Server Features: