Open
Conversation
FLAC can have a different sample rate for every frame, therefore it should be stored in `Block` and have a function that exposes the value of it. Ref: https://github.com/ietf-wg-cellar/flac-test-files/blob/main/uncommon/01%20-%20changing%20samplerate.flac
ruuda
reviewed
Jun 23, 2024
Owner
ruuda
left a comment
There was a problem hiding this comment.
Thank you for taking the time to open a pull request. This makes sense to add, but let’s make sure that the sample rate is always set to the correct value then.
| return self.buffer; | ||
| } | ||
|
|
||
| /// Returns the sample rate of this block. |
Owner
There was a problem hiding this comment.
Suggested change
| /// Returns the sample rate of this block. | |
| /// Returns the sample rate of this block in Hz. |
| }; | ||
|
|
||
| let block = Block::new(time, header.block_size as u32, buffer); | ||
| let block = Block::new(time, header.block_size as u32, header.sample_rate.unwrap_or_default(), buffer); |
Owner
There was a problem hiding this comment.
unwrap_or_default would default to 0 when the header does not specify a sample rate. Instead, we need to get the value from the streaminfo:
Line 193 in 20fd6a7
Author
There was a problem hiding this comment.
It doesn't seem like streaminfo is available from this function's scope?
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.
FLAC can have a different sample rate for every frame, therefore it should be stored in
Blockand have a function that exposes the value of it.Ref: https://github.com/ietf-wg-cellar/flac-test-files/blob/main/uncommon/01%20-%20changing%20samplerate.flac