diff options
author | Timur Pocheptsov <timur.pocheptsov@theqtcompany.com> | 2016-04-19 15:21:50 +0200 |
---|---|---|
committer | Timur Pocheptsov <timur.pocheptsov@theqtcompany.com> | 2016-04-21 11:32:41 +0000 |
commit | f97e1988a6f76d46d551678666a96fa5f36a92f7 (patch) | |
tree | 1f204bfce7287dfc1deaf86fb8613f49fd81ed53 /src/plugins/avfoundation/camera/avfmediarecordercontrol_ios.mm | |
parent | ffe61fd5169b5dd6f2a475ddccbf3679696d380f (diff) | |
download | qtmultimedia-f97e1988a6f76d46d551678666a96fa5f36a92f7.tar.gz |
AVFMediaAssetWriter - fix potential race condition(s)
1. m_writerQueue is now shared by recorder control and asset writer
to ensure it lives long enough.
2. m_delegate->method() calls from async block can be dangerous, since by the time
this block is actually executed, delegate can be deleted already. This fix uses
Q_INVOKABLE and invokeMethod with QueuedConnection instead.
3. -finishWritingWithCompletionHandler: is async and when the block finally gets
executed, lock and 'if aborted' test are still needed.
4. Simplify the logic and reduce locking.
Change-Id: If23daf2fe22043244033427a7f6517a0fe3f23d1
Reviewed-by: Yoann Lopes <yoann.lopes@qt.io>
Diffstat (limited to 'src/plugins/avfoundation/camera/avfmediarecordercontrol_ios.mm')
-rw-r--r-- | src/plugins/avfoundation/camera/avfmediarecordercontrol_ios.mm | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/src/plugins/avfoundation/camera/avfmediarecordercontrol_ios.mm b/src/plugins/avfoundation/camera/avfmediarecordercontrol_ios.mm index b763dbcce..73e19e683 100644 --- a/src/plugins/avfoundation/camera/avfmediarecordercontrol_ios.mm +++ b/src/plugins/avfoundation/camera/avfmediarecordercontrol_ios.mm @@ -86,8 +86,7 @@ AVFMediaRecorderControlIOS::AVFMediaRecorderControlIOS(AVFCameraService *service return; } - m_writer.reset([[QT_MANGLE_NAMESPACE(AVFMediaAssetWriter) alloc] initWithQueue:m_writerQueue - delegate:this delegateQueue:dispatch_get_main_queue()]); + m_writer.reset([[QT_MANGLE_NAMESPACE(AVFMediaAssetWriter) alloc] initWithQueue:m_writerQueue delegate:this]); if (!m_writer) { qDebugCamera() << Q_FUNC_INFO << "failed to create an asset writer"; return; @@ -259,14 +258,6 @@ void AVFMediaRecorderControlIOS::assetWriterStarted() Q_EMIT statusChanged(QMediaRecorder::RecordingStatus); } -void AVFMediaRecorderControlIOS::assetWriterFailedToStart() -{ -} - -void AVFMediaRecorderControlIOS::assetWriterFailedToStop() -{ -} - void AVFMediaRecorderControlIOS::assetWriterFinished() { AVFCameraControl *cameraControl = m_service->cameraControl(); |