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

[audio] Update bitrate calc #4141

Merged
merged 1 commit into from
Apr 28, 2024
Merged

Conversation

GiviMAD
Copy link
Member

@GiviMAD GiviMAD commented Mar 10, 2024

I think bitrate was miscalculated after #4116

nBitsPerSecond = nSamplesPerChannelPerSecond * nBitsPerSample * nChannels;

PR seems to make no difference but seems a little clear to me. Feel free to close it if irrelevant.

Signed-off-by: Miguel Álvarez <miguelwork92@gmail.com>
@GiviMAD GiviMAD requested a review from a team as a code owner March 10, 2024 14:18
@GiviMAD
Copy link
Member Author

GiviMAD commented Mar 10, 2024

Hello @lolodomo could you test if these solves #4140?

@lolodomo
Copy link
Contributor

I will try and let you know, thank you for quick investigation.

@lolodomo
Copy link
Contributor

I just tested but unfortunately it does not solve the issue.

@GiviMAD
Copy link
Member Author

GiviMAD commented Mar 15, 2024

It seems like methods getSampleRate and getFrameRate return same value for formats without compression so the PR makes no effect.

@GiviMAD GiviMAD changed the title [audio] Fix bitrate calc [audio] Update bitrate calc Mar 16, 2024
@J-N-K
Copy link
Member

J-N-K commented Mar 27, 2024

@GiviMAD Are you working on an improvement?

@GiviMAD
Copy link
Member Author

GiviMAD commented Mar 28, 2024

Nop, I just saw it while reviewing a recent PR and thought at the beginning that it could be wrong, but seems to be right for the case.
I think the API is intended to either do format.getFrameRate() * format.getFrameSize() to get the compressed byte rate or format.getSampleRate() * format.getSampleSizeInBits() to get the uncompressed one. But because of the wav format support not compression format.getFrameRate() and format.getSampleRate() will return same value.

@J-N-K J-N-K merged commit 8bca481 into openhab:main Apr 28, 2024
3 checks passed
@J-N-K J-N-K added the bug An unexpected problem or unintended behavior of the Core label Apr 28, 2024
@J-N-K J-N-K added this to the 4.2 milestone Apr 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An unexpected problem or unintended behavior of the Core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants