Closed UninhibitedSoul closed 6 years ago
@UninhibitedSoul, which version of ARVideoKit are you using?
@AFathi version 1.3.1
@UninhibitedSoul, will investigate the issue and get back to you soon
If i use extension to conform protocol 'RenderARDelegate',I send CVPixelBuffer to webrtc.Within half a minute, the memory will exceed 1G. Then my app Crash.
//MARK: RenderARDelegate
extension RARShareARViewController : RenderARDelegate {
func frame(didRender buffer: CVPixelBuffer, with time: CMTime, using rawBuffer: CVPixelBuffer) {
if capture != nil {
capture?.didCaptureCVPixelBufferRef(buffer, time: time, usingRowBuffer: nil)
}
}
}
If i conform protocol 'RenderARDelegate' by class, not by extension.The memory will not exceed 200M. My app won't crash.
class RARShareARViewController : UIViewController,RenderARDelegate {
.
.
.
func frame(didRender buffer: CVPixelBuffer, with time: CMTime, using rawBuffer: CVPixelBuffer) {
if capture != nil {
capture?.didCaptureCVPixelBufferRef(buffer, time: time, usingRowBuffer: nil)
}
}
}
Is it a swift extension bug?
@UninhibitedSoul, thanks for clarifying this to me. I believe the issue may be occurring due to the fact that frame(didRender buffer: CVPixelBuffer, with time: CMTime, using rawBuffer: CVPixelBuffer)
is executed in an extension of RecordAR
.
I'd suggest to go to RecordAR.swift
file located at /ARVideoKit/Sources/
then scroll down all the way to the following block of code:
//MARK: - Internal AR Video Frames Rendering
@available(iOS 11.0, *)
internal extension RecordAR {
@objc internal func renderFrame() {
......
......
......
}
}
then cut (cmd+x) the renderFrame()
function and paste it inside the original RecordAR
class.
I have attached the RecordAR
file to this comments that includes that changes I mentioned above. Feel free download it and replace the current file you have with the new one :).
Note:- Make sure to change the file extension to
.swift
.
@UninhibitedSoul, please let me know whether the changes I suggested fixed the issue you're having or not.
I'm so sorry๏ผI can't reappear this bug. I tried to use extension to conform protocol 'RenderARDelegate'. I tried to roll back the code. But,I can't reappear this bug. The memory will not exceed 200M. My app won't crash. Thanks for you help.
Hi, Can I ask a question: How did you populate the frame with WebRTC?
func frame(didRender buffer: CVPixelBuffer, with time: CMTime, using rawBuffer: CVPixelBuffer) { if capture != nil { capture?.didCaptureCVPixelBufferRef(buffer, time: time, usingRowBuffer: rawBuffer) } } I use WebRTC capture and send CVPixelBuffer. I update ARVideoKit.framework yesterday afternoon , and memory isssue cause crash . It seems to be in Function: CVPixelBufferCreate , CVPixelBufferBacking::initWithPixelBufferDescription,CVPixelBufferStandardMemoryLayout