summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYoann Lopes <yoann.lopes@digia.com>2014-06-05 15:25:55 +0200
committerYoann Lopes <yoann.lopes@digia.com>2014-08-25 17:30:31 +0200
commit5f0f81bcc1b82ea3418e4e5ce939ce22b11af0af (patch)
tree4d0b976ea57e0c187247dd286ed6e77976af8e2f
parentbee6244e2428c4a2f4b62dd1e8896f310b2208c8 (diff)
AVFoundation: fix some controls not being correctly destroyed on iOS.
This patch also makes sure AVF video layers are removed from their parent layer when their corresponding Qt video outputs are destroyed. Task-number: QTBUG-39385 Change-Id: I164cd0da7084f84c0473ed3e396e734acce2a22e Reviewed-by: Andy Nichols <andy.nichols@digia.com>
-rw-r--r--src/plugins/avfoundation/camera/avfcameraservice.mm4
-rw-r--r--src/plugins/avfoundation/mediaplayer/avfmediaplayerservice.mm5
-rw-r--r--src/plugins/avfoundation/mediaplayer/avfvideowidget.mm4
-rw-r--r--src/plugins/avfoundation/mediaplayer/avfvideowindowcontrol.mm4
4 files changed, 11 insertions, 6 deletions
diff --git a/src/plugins/avfoundation/camera/avfcameraservice.mm b/src/plugins/avfoundation/camera/avfcameraservice.mm
index 25111c5cc..966202ede 100644
--- a/src/plugins/avfoundation/camera/avfcameraservice.mm
+++ b/src/plugins/avfoundation/camera/avfcameraservice.mm
@@ -135,9 +135,9 @@ QMediaControl *AVFCameraService::requestControl(const char *name)
void AVFCameraService::releaseControl(QMediaControl *control)
{
if (m_videoOutput == control) {
- m_videoOutput = 0;
m_session->setVideoOutput(0);
- delete control;
+ delete m_videoOutput;
+ m_videoOutput = 0;
}
}
diff --git a/src/plugins/avfoundation/mediaplayer/avfmediaplayerservice.mm b/src/plugins/avfoundation/mediaplayer/avfmediaplayerservice.mm
index e5549803f..bb75adb8b 100644
--- a/src/plugins/avfoundation/mediaplayer/avfmediaplayerservice.mm
+++ b/src/plugins/avfoundation/mediaplayer/avfmediaplayerservice.mm
@@ -118,14 +118,15 @@ void AVFMediaPlayerService::releaseControl(QMediaControl *control)
#ifdef QT_DEBUG_AVF
qDebug() << Q_FUNC_INFO << control;
#endif
-#if defined(Q_OS_OSX)
if (m_videoOutput == control) {
+#if defined(Q_OS_OSX)
AVFVideoRendererControl *renderControl = qobject_cast<AVFVideoRendererControl*>(m_videoOutput);
if (renderControl)
renderControl->setSurface(0);
+#endif
m_videoOutput = 0;
m_session->setVideoOutput(0);
+
delete control;
}
-#endif
}
diff --git a/src/plugins/avfoundation/mediaplayer/avfvideowidget.mm b/src/plugins/avfoundation/mediaplayer/avfvideowidget.mm
index d4fa7c4c6..2893921f3 100644
--- a/src/plugins/avfoundation/mediaplayer/avfvideowidget.mm
+++ b/src/plugins/avfoundation/mediaplayer/avfvideowidget.mm
@@ -64,8 +64,10 @@ AVFVideoWidget::~AVFVideoWidget()
qDebug() << Q_FUNC_INFO;
#endif
- if (m_playerLayer)
+ if (m_playerLayer) {
+ [m_playerLayer removeFromSuperlayer];
[m_playerLayer release];
+ }
}
QSize AVFVideoWidget::sizeHint() const
diff --git a/src/plugins/avfoundation/mediaplayer/avfvideowindowcontrol.mm b/src/plugins/avfoundation/mediaplayer/avfvideowindowcontrol.mm
index 17fc94de7..8e96d732f 100644
--- a/src/plugins/avfoundation/mediaplayer/avfvideowindowcontrol.mm
+++ b/src/plugins/avfoundation/mediaplayer/avfvideowindowcontrol.mm
@@ -61,8 +61,10 @@ AVFVideoWindowControl::AVFVideoWindowControl(QObject *parent)
AVFVideoWindowControl::~AVFVideoWindowControl()
{
- if (m_playerLayer)
+ if (m_playerLayer) {
+ [m_playerLayer removeFromSuperlayer];
[m_playerLayer release];
+ }
}
WId AVFVideoWindowControl::winId() const