mediadevices
mediadevices copied to clipboard
Call stopRunning on captureSession when freeing
Currently, the green light (on a Mac) indicating the camera is in use never goes off, even after closing the videoTrack. I think stopRunning should be called on the captureSession when the videoTrack is closed. This patch seems to work for me:
diff --git a/pkg/avfoundation/AVFoundationBind/AVFoundationBind.m b/pkg/avfoundation/AVFoundationBind/AVFoundationBind.m
index ed75c99..db8f838 100644
--- a/pkg/avfoundation/AVFoundationBind/AVFoundationBind.m
+++ b/pkg/avfoundation/AVFoundationBind/AVFoundationBind.m
@@ -236,6 +236,7 @@ STATUS AVBindSessionFree(PAVBindSession *ppSession) {
CHK(ppSession != NULL, STATUS_NULL_ARG);
PAVBindSession pSession = *ppSession;
if (pSession->refCaptureSession != NULL) {
+ [pSession->refCaptureSession stopRunning];
[pSession->refCaptureSession release];
pSession->refCaptureSession = NULL;
}
or maybe call AVBindSessionClose
instead?
Do you still experience this ? I have tested it and the green light stops when I close the video track.
Do you have an example that triggers the bug for you ?