I am experiencing memory leaks in the following scenario. I am using an HTV camera in 2 different classes .
Here is my code.
//Launch Camera in class A //HTVVideo mode
-
(void)launchCamera {
self.camera = [HVTCamera new];
[self.camera setCaptureDevice:[self getCaptureDeviceForcameraType:AVCaptureDeviceTypeBuiltInTelephotoCamera] error:nil];
[self.camera setLevelerFlexSpeed: HVTLevelerFlexSpeedResponsive];
[self.camera setDelegate:self];
[self.preview setFillMode:HVTViewFillModeAspectFill];
[self.camera addView:self.preview];
if(![self.camera isRunning]) {
[self.camera startRunning];
return;
}
}
//Launch Camera in class B //HVTCaptureModePhoto
-
(void)launchCamera {
self.camera = [HVTCamera new];
[self.camera setLevelerFlexSpeed: HVTLevelerFlexSpeedResponsive];
[self.camera setDelegate:self];
[self.preview setFillMode:HVTViewFillModeAspectFill];
[self.camera setCaptureMode:HVTCaptureModePhoto cameraPosition:AVCaptureDevicePositionBack];
[self.camera setCaptureDevice:[self getCaptureDeviceForcameraType:AVCaptureDeviceTypeBuiltInTelephotoCamera] error:nil];
[self.camera setInterfaceOrientation:UIInterfaceOrientationPortrait];
[self.camera addView:self.preview];
if(![self.camera isRunning]) {
[self.camera startRunning];
return;
}
}
The memory leaks when try to launch camera for class A after camera launch for class B (Launching Video camera after Capture camera).
Logs. :
testVideos[44586:12022901] [BackgroundTask] Background Task 4 ("Called by HorizonSDK, from -[HVTPipeline videoPipelineWillStartRunning]"), was created over 30 seconds ago. In applications running in the background, this creates a risk of termination. Remember to call UIApplication.endBackgroundTask(:) for your task in a timely manner to avoid this.
2022-01-04 23:19:53.187075+0530
testVideos[44586:12022901] [BackgroundTask] Background Task 5 ("Called by HorizonSDK, from -[HVTPipeline videoPipelineWillStartRunning]"), was created over 30 seconds ago. In applications running in the background, this creates a risk of termination. Remember to call UIApplication.endBackgroundTask(:) for your task in a timely manner to avoid this.
2022-01-04 23:20:47.975246+0530
testVideos[44586:12022901] [BackgroundTask] Background Task 6 ("Called by HorizonSDK, from -[HVTPipeline videoPipelineWillStartRunning]"), was created over 30 seconds ago. In applications running in the background, this creates a risk of termination. Remember to call UIApplication.endBackgroundTask(:) for your task in a timely manner to avoid this.
2022-01-04 23:20:49.976846+0530
testVideos[44586:12022901] [BackgroundTask] Background Task 7 ("Called by HorizonSDK, from -[HVTPipeline videoPipelineWillStartRunning]"), was created over 30 seconds ago. In applications running in the background, this creates a risk of termination. Remember to call UIApplication.endBackgroundTask(:) for your task in a timely manner to avoid this.
2022-01-04 23:21:57.910423+0530
testVideos[44586:12022901] [BackgroundTask] Background Task 8 ("Called by HorizonSDK, from -[HVTPipeline videoPipelineWillStartRunning]"), was created over 30 seconds ago. In applications running in the background, this creates a risk of termination. Remember to call UIApplication.endBackgroundTask(:) for your task in a timely manner to avoid this.
2022-01-04 23:22:00.911954+0530
testVideos[44586:12022901] [BackgroundTask] Background Task 9 ("Called by HorizonSDK, from -[HVTPipeline videoPipelineWillStartRunning]"), was created over 30 seconds ago. In applications running in the background, this creates a risk of termination. Remember to call UIApplication.endBackgroundTask(:) for your task in a timely manner to avoid this.
2022-01-04 23:22:08.913345+0530
testVideos[44586:12022901] [BackgroundTask] Background Task 10 ("Called by HorizonSDK, from -[HVTCamera recordingStarting]"), was created over 30 seconds ago. In applications running in the background, this creates a risk of termination. Remember to call UIApplication.endBackgroundTask(_:) for your task in a timely manner to avoid this