Skip to content

Commit

Permalink
Close the video buffer after using it in iOS
Browse files Browse the repository at this point in the history
If the buffer is not closed, I believe a memory leak is occurring, and GC runs frequently (once every a few seconds in the device I tested, iPhone 7).

Empirically, I tried using "close" and also "release". The first one did the trick.

This change is also based on the documentation that mentions the buffer should be released after use: https://developer.apple.com/documentation/avfoundation/avplayeritemvideooutput/1386148-copypixelbufferforitemtime#return_value
  • Loading branch information
lucas-kakele authored and SimonIT committed Mar 30, 2024
1 parent 68c1674 commit 4897f57
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ public synchronized boolean update () {
return false;
}
updateTextureFromBuffer(buffer);
buffer.close();
return true;
}

Expand Down

0 comments on commit 4897f57

Please sign in to comment.