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

Make sure FLAC__stream_encoder_init_stream() is only called once. #307

Closed

Conversation

hzeller
Copy link
Contributor

@hzeller hzeller commented Aug 7, 2017

The FLAC__stream_encoder_init_stream() function complains if it is
called multiple times. If we happen to have flushed the header
manually before with
sf_command(snd, SFC_UPDATE_HEADER_NOW, ...)
.. then all subsequent sf_write...() functions fail otherwise because
they attempt to write the header again.

The FLAC__stream_encoder_init_stream() function complains if it is
called multiple times. If we happen to have flushed the header
manually before with
 sf_command(snd, SFC_UPDATE_HEADER_NOW, ...)
.. then all subsequent sf_write...() functions fail otherwise because
they attempt to write the header again.
@hzeller
Copy link
Contributor Author

hzeller commented Aug 7, 2017

This is my localized approach to solve the problem I encountered (sf_write...() failed after having manually called sf_command(snd, SFC_UPDATE_HEADER_NOW,...). There might be better/more centralized ways to fix this, so I am open to implement it differently.

Explicitly writing the header with SFC_UPDATE_HEADER_NOW before
the first sf_write() was making sf_write() calls fail. This is a
test to verify that the fix works.
@hzeller
Copy link
Contributor Author

hzeller commented Aug 8, 2017

Alright, also added test that fails without the patch in the first submit and passes with the patch (and in a subsequent submit fixed that the test should only be run when FLAC is compiled in).

If you merge this via github, then the 'squash and merge' option is probably the best to only end up with a single commit.

@erikd
Copy link
Member

erikd commented Aug 10, 2017

Merged manually. Thanks!

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.

None yet

2 participants