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>
This commit is contained in:
@@ -135,9 +135,9 @@ QMediaControl *AVFCameraService::requestControl(const char *name)
|
|||||||
void AVFCameraService::releaseControl(QMediaControl *control)
|
void AVFCameraService::releaseControl(QMediaControl *control)
|
||||||
{
|
{
|
||||||
if (m_videoOutput == control) {
|
if (m_videoOutput == control) {
|
||||||
m_videoOutput = 0;
|
|
||||||
m_session->setVideoOutput(0);
|
m_session->setVideoOutput(0);
|
||||||
delete control;
|
delete m_videoOutput;
|
||||||
|
m_videoOutput = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -118,14 +118,15 @@ void AVFMediaPlayerService::releaseControl(QMediaControl *control)
|
|||||||
#ifdef QT_DEBUG_AVF
|
#ifdef QT_DEBUG_AVF
|
||||||
qDebug() << Q_FUNC_INFO << control;
|
qDebug() << Q_FUNC_INFO << control;
|
||||||
#endif
|
#endif
|
||||||
#if defined(Q_OS_OSX)
|
|
||||||
if (m_videoOutput == control) {
|
if (m_videoOutput == control) {
|
||||||
|
#if defined(Q_OS_OSX)
|
||||||
AVFVideoRendererControl *renderControl = qobject_cast<AVFVideoRendererControl*>(m_videoOutput);
|
AVFVideoRendererControl *renderControl = qobject_cast<AVFVideoRendererControl*>(m_videoOutput);
|
||||||
if (renderControl)
|
if (renderControl)
|
||||||
renderControl->setSurface(0);
|
renderControl->setSurface(0);
|
||||||
|
#endif
|
||||||
m_videoOutput = 0;
|
m_videoOutput = 0;
|
||||||
m_session->setVideoOutput(0);
|
m_session->setVideoOutput(0);
|
||||||
|
|
||||||
delete control;
|
delete control;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,9 +64,11 @@ AVFVideoWidget::~AVFVideoWidget()
|
|||||||
qDebug() << Q_FUNC_INFO;
|
qDebug() << Q_FUNC_INFO;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (m_playerLayer)
|
if (m_playerLayer) {
|
||||||
|
[m_playerLayer removeFromSuperlayer];
|
||||||
[m_playerLayer release];
|
[m_playerLayer release];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QSize AVFVideoWidget::sizeHint() const
|
QSize AVFVideoWidget::sizeHint() const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -61,9 +61,11 @@ AVFVideoWindowControl::AVFVideoWindowControl(QObject *parent)
|
|||||||
|
|
||||||
AVFVideoWindowControl::~AVFVideoWindowControl()
|
AVFVideoWindowControl::~AVFVideoWindowControl()
|
||||||
{
|
{
|
||||||
if (m_playerLayer)
|
if (m_playerLayer) {
|
||||||
|
[m_playerLayer removeFromSuperlayer];
|
||||||
[m_playerLayer release];
|
[m_playerLayer release];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
WId AVFVideoWindowControl::winId() const
|
WId AVFVideoWindowControl::winId() const
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user