Skip to content

Conversation

NicolasHug
Copy link
Contributor

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
Contributor 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?

@NicolasHug NicolasHug closed this Aug 4, 2025
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