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

allow streaming small sound file #1576

Merged
merged 2 commits into from
Oct 6, 2024

Conversation

dzosz
Copy link
Collaborator

@dzosz dzosz commented Jul 4, 2024

No description provided.

@dzosz dzosz requested a review from sprunk July 4, 2024 16:48
return false;
}

const int numDecodedStreams = 1 + static_cast<int>(DecodeStream(buffers[1]));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. What if it's a big sound file but decoding fails?
  2. I slightly dislike this cast, especially since it doesn't allow any error handling. How about something like
int numDecodedStreams = 1;
if (DecodeStream(buffers[1])) {
  ++ numDecodedStreams;
} else {
  // did it fail, or was it just a very small file?
}

Copy link
Collaborator Author

@dzosz dzosz Jul 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. It's not a major change. Current implementation requires at least 2 valid chunks to play a sound, this changes it to 1 chunk. If any of the subsequent chunks fail (3rd, 4th or 300th) in function UpdateBuffers we would assume the stream is finished as we don't do any error checking there as well.

The decoder is doing some initial checks on the file in function LoadData() which checks validity of the file.

@lhog lhog merged commit 09a35e1 into beyond-all-reason:master Oct 6, 2024
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.

3 participants