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

Simplify UniqueAVFrame handling in audio decoder #571

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

NicolasHug
Copy link
Member

Follow-up to #556 (comment).

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Meta Open Source bot. label Mar 17, 2025
AVSampleFormat desiredSampleFormat) {
if (sourceSampleFormat == desiredSampleFormat) {
return std::move(avFrame);
}
Copy link
Member Author

Choose a reason for hiding this comment

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

@scotts WDYT - this is wrong, isn't it? This will end up destructing the avFrameStream.avFrame that was passed as a parameter to convertAudioAVFrameToFrameOutputOnCPU?

Copy link
Contributor

Choose a reason for hiding this comment

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

On this being wrong - I don't know, that depends on what we need for the calling side. What this will do is take ownership away from the input avFrame and give it to the output UniqueAVFrame. The question then is: is that okay for avFrameStream in the calling context? That is, is it okay for the avFrameStream in the calling context to be modified such that it no longer owns the avFrame? Because as a consequence of the move, avFrameStream.avFrame will become nullptr.

And if it's not okay, then should avFrameStream in convertAudioAVFrameToFrameOutputOnCPU() actually be a const reference?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Meta Open Source bot.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants