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

Fix buffer_size calculations for AudioFrame planes #421

Closed
wants to merge 1 commit into from

Conversation

jlaine
Copy link
Member

@jlaine jlaine commented Oct 9, 2018

This PR fixes several misunderstandings concerning AudioFrame buffer
sizes:

  • for audio, "line size" and "buffer size" are equivalent, as there is
    only ever a single "line".

  • only linesizes[0] is ever populated, and it gives you the buffer size
    of each plane.

  • we do not need to recalculate anything upon putting frames into an
    AudioFrame, the buffer size does not change.

  • "align" is not a boolean, it can be any power of two.

We stop carrying around "align", "nb_channels" and "nb_planes", they are
not needed.

This PR fixes several misunderstandings concerning AudioFrame buffer
sizes:

- for audio, "line size" and "buffer size" are equivalent, as there is
only ever a single "line".

- only linesizes[0] is ever populated, and it gives you the buffer size
of each plane.

- we do not need to recalculate anything upon putting frames into an
AudioFrame, the buffer size does not change.

- "align" is not a boolean, it can be any power of two.

We stop carrying around "align", "nb_channels" and "nb_planes", they are
not needed.
@jlaine
Copy link
Member Author

jlaine commented Oct 9, 2018

You'll notice that line_size is gone from AudioPlane as I think it's misleading. I doubt anyone used it since it gave a bogus value of 0 for anything but the first plane. If you absolutely want it back I'd go with a renamed_attr pointing to buffer_size.

mikeboers pushed a commit that referenced this pull request Oct 9, 2018
This PR fixes several misunderstandings concerning AudioFrame buffer
sizes:

- for audio, "line size" and "buffer size" are equivalent, as there is
only ever a single "line".

- only linesizes[0] is ever populated, and it gives you the buffer size
of each plane.

- we do not need to recalculate anything upon putting frames into an
AudioFrame, the buffer size does not change.

- "align" is not a boolean, it can be any power of two.

We stop carrying around "align", "nb_channels" and "nb_planes", they are
not needed.

Merges #421.
@mikeboers
Copy link
Member

Cherry-picked.

@mikeboers mikeboers closed this Oct 9, 2018
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.

2 participants