Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

perf: Avoid expensive CMSampleBuffer copy #235

Merged
merged 3 commits into from
Jul 6, 2021
Merged

Conversation

mrousavy
Copy link
Owner

@mrousavy mrousavy commented Jul 6, 2021

For calling Frame Processors I always created a copy of the CMSampleBuffer. I don't think this is necessary, ARC will automatically retain it until the frame processor has finished executing anyways. I also don't think video frames will be dropped, since AVFoundation maintains a pool of buffers and the frame processor does (often) not execute every single frame.

This requires a bit more testing, but in general it should greatly improve the performance of frame processors, since a huge copy (~10MB per frame) is avoided.

@mrousavy mrousavy added 🍏 ios Issue affects the iOS platform 💨 performance This issue or pull requests addresses performance issues labels Jul 6, 2021
@mrousavy mrousavy merged commit 7d3b352 into main Jul 6, 2021
@mrousavy mrousavy deleted the perf/dont-copy-frame branch July 6, 2021 07:25
isaaccolson pushed a commit to isaaccolson/deliveries-mobile that referenced this pull request Oct 30, 2024
* Don't copy CMSampleBuffer

* Update CameraView+RecordVideo.swift

* Update Podfile.lock
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
🍏 ios Issue affects the iOS platform 💨 performance This issue or pull requests addresses performance issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant