WMF: release video controls before releasing the session
For the VideoRendererControl, also stop the video surface at the same time. This fixes a crash when changing video. Change-Id: I49484f8b277c345dafb3e5947cf5d23df15546f3 Reviewed-by: Jason Barron <jason@cutehacks.com>
This commit is contained in:
committed by
The Qt Project
parent
6eb192f047
commit
60eb27dfef
@@ -85,6 +85,11 @@ void Evr9VideoWindowControl::clear()
|
|||||||
m_currentActivate = NULL;
|
m_currentActivate = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Evr9VideoWindowControl::releaseActivate()
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
}
|
||||||
|
|
||||||
WId Evr9VideoWindowControl::winId() const
|
WId Evr9VideoWindowControl::winId() const
|
||||||
{
|
{
|
||||||
return m_windowId;
|
return m_windowId;
|
||||||
|
|||||||
@@ -86,6 +86,7 @@ public:
|
|||||||
void setSaturation(int saturation);
|
void setSaturation(int saturation);
|
||||||
|
|
||||||
IMFActivate* createActivate();
|
IMFActivate* createActivate();
|
||||||
|
void releaseActivate();
|
||||||
|
|
||||||
void setProcAmpValues();
|
void setProcAmpValues();
|
||||||
|
|
||||||
|
|||||||
@@ -476,6 +476,13 @@ void MFPlayerSession::close()
|
|||||||
m_videoProbeMFT = 0;
|
m_videoProbeMFT = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_playerService->videoRendererControl()) {
|
||||||
|
m_playerService->videoRendererControl()->releaseActivate();
|
||||||
|
#ifndef Q_WS_SIMULATOR
|
||||||
|
} else if (m_playerService->videoWindowControl()) {
|
||||||
|
m_playerService->videoWindowControl()->releaseActivate();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
if (m_session)
|
if (m_session)
|
||||||
m_session->Release();
|
m_session->Release();
|
||||||
|
|||||||
@@ -1781,6 +1781,7 @@ namespace
|
|||||||
, m_sink(0)
|
, m_sink(0)
|
||||||
, m_rendererControl(rendererControl)
|
, m_rendererControl(rendererControl)
|
||||||
, m_attributes(0)
|
, m_attributes(0)
|
||||||
|
, m_surface(0)
|
||||||
{
|
{
|
||||||
MFCreateAttributes(&m_attributes, 0);
|
MFCreateAttributes(&m_attributes, 0);
|
||||||
m_sink = new MediaSink(rendererControl);
|
m_sink = new MediaSink(rendererControl);
|
||||||
@@ -2143,6 +2144,9 @@ MFVideoRendererControl::~MFVideoRendererControl()
|
|||||||
|
|
||||||
void MFVideoRendererControl::clear()
|
void MFVideoRendererControl::clear()
|
||||||
{
|
{
|
||||||
|
if (m_surface)
|
||||||
|
m_surface->stop();
|
||||||
|
|
||||||
if (m_currentActivate) {
|
if (m_currentActivate) {
|
||||||
m_currentActivate->ShutdownObject();
|
m_currentActivate->ShutdownObject();
|
||||||
m_currentActivate->Release();
|
m_currentActivate->Release();
|
||||||
@@ -2150,6 +2154,11 @@ void MFVideoRendererControl::clear()
|
|||||||
m_currentActivate = NULL;
|
m_currentActivate = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MFVideoRendererControl::releaseActivate()
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
}
|
||||||
|
|
||||||
QAbstractVideoSurface *MFVideoRendererControl::surface() const
|
QAbstractVideoSurface *MFVideoRendererControl::surface() const
|
||||||
{
|
{
|
||||||
return m_surface;
|
return m_surface;
|
||||||
@@ -2209,10 +2218,8 @@ IMFActivate* MFVideoRendererControl::createActivate()
|
|||||||
clear();
|
clear();
|
||||||
|
|
||||||
m_currentActivate = new VideoRendererActivate(this);
|
m_currentActivate = new VideoRendererActivate(this);
|
||||||
if (m_surface) {
|
if (m_surface)
|
||||||
setSurface(m_surface);
|
setSurface(m_surface);
|
||||||
supportedFormatsChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
return m_currentActivate;
|
return m_currentActivate;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ public:
|
|||||||
void setSurface(QAbstractVideoSurface *surface);
|
void setSurface(QAbstractVideoSurface *surface);
|
||||||
|
|
||||||
IMFActivate* createActivate();
|
IMFActivate* createActivate();
|
||||||
|
void releaseActivate();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void customEvent(QEvent *event);
|
void customEvent(QEvent *event);
|
||||||
|
|||||||
Reference in New Issue
Block a user