-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Avoid generating empty frame? #2298
Comments
Correct, the empty frame cannot be generated. Imagine the case where someone has concatenated 3 zstd frames, and the second frame is empty. If the 2nd frame wasn't present because it was empty we would interpret the 3rd stream as the 2nd stream, and assume the 3rd stream is empty. But that would be incorrect. Zstd always generates a valid frame, which is non-empty. If you want, you could add some code on top of zstd which maps the empty input to the empty output. But zstd can't do that. |
The current implementation of streaming If there is a need for this capability, the reference implementation could be updated to add it, likely as an optional parameter of the streaming operation. However, there is another catch : older variants of the A work-around could be to send compressed empty blocks, which ironically are 1 byte larger. If empty blocks generation is requested, this technique would work and remain compatible with all deployed decoders. Anyway, without a good enough reason (an important scenario to support), we have no incentive to make the reference implementation more complex, and therefore will stick by default to current policy to not generate empty blocks. This is different from empty frames. If the question is rather : why |
Thank you very much for your explanation.
Ok, for people with such need, this code is not difficult to implement. |
Run this code:
Output:
It seems empty blocks are not generated, but empty frames are generated, looks a bit inconsistent.
If the current frame has no content, can it not generate an empty frame?
The text was updated successfully, but these errors were encountered: