Skip to content
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

Fix Transcribe streaming "A complete signal was sent without ending frame" #2827

Merged
merged 1 commit into from
Jan 26, 2024

Conversation

SergeyRyabinin
Copy link
Contributor

@SergeyRyabinin SergeyRyabinin commented Jan 26, 2024

This is merged and released in the SDK v 1.11.279

Issue #, if available:

Description of changes:
Encode very empty frame (=no payload section) http2 frame instead of a frame with headers as a payload.

According to the transcribe documentation and an original SDK implementation, the final "empty frame" should be constructed like a regular data frame, i.e.

// regular data frame with audio
innerPayload = h2_encode(AudioEvent_headers_dict, raw_pcm_audio_stream)
signature_and_timestamp_headers = sigv4_event_stream_sign(innerPayload)
h2_frame_to_be_sent = h2_encode(signature_and_timestamp_headers, innerPayload)

// how it is done today in the SDK for an empty frame
innerPayload = h2_encode(AudioEvent_headers_dict, "")
signature_and_timestamp_headers = sigv4_event_stream_sign(innerPayload)
h2_frame_to_be_sent = h2_encode(signature_and_timestamp_headers, innerPayload)

while Transcribe server expects absolutely no payload for a final empty event (in the payload section of the h2 frame), only headers section must be present (and of course h2 prelude, markers and crc32 like for any other regular h2 frame), i.e.

// how it is done after applying this PR:
signature_and_timestamp_headers = sigv4_event_stream_sign(/*sign null buffer*/"")
h2_frame_to_be_sent = h2_encode(signature_and_timestamp_headers, "")

This does not fix performance issues of HTTP2 streaming within the SDK, except increasing the default buffer size for sent/received events.
I'll submit another PR later for performance issues.
Check all that applies:

  • Did a review by yourself.
  • Added proper tests to cover this PR. (If tests are not applicable, explain.)
  • Checked if this PR is a breaking (APIs have been changed) change.
  • Checked if this PR will not introduce cross-platform inconsistent behavior.
  • Checked if this PR would require a ReadMe/Wiki update.

Check which platforms you have built SDK on to verify the correctness of this PR.

  • Linux
  • Windows
  • Android
  • MacOS
  • IOS
  • Other Platforms

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@SergeyRyabinin SergeyRyabinin merged commit 5b3d0c0 into main Jan 26, 2024
4 checks passed
@SergeyRyabinin SergeyRyabinin deleted the sr/finalEmptyFrame branch January 26, 2024 16:47
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