DirectShow: Release all filters when disconnecting the graph.
When disconnecting the graph we need to make sure that all the filters in the graph are released, even the ones that are automatically added. Since we can't know in advance which filters the graph consists of, we need release them one by one. Task-number: QTBUG-49281 Change-Id: Ifdf2fb6fe1c90ab85b47565c5fe82b6ebe55b183 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Yoann Lopes <yoann.lopes@theqtcompany.com>
This commit is contained in:
committed by
Christian Stromme
parent
6569c25619
commit
3fb3231a9e
@@ -1092,9 +1092,19 @@ void DSCameraSession::disconnectGraph()
|
||||
pPin = NULL;
|
||||
}
|
||||
|
||||
m_filterGraph->RemoveFilter(m_nullRendererFilter);
|
||||
m_filterGraph->RemoveFilter(m_previewFilter);
|
||||
m_filterGraph->RemoveFilter(m_sourceFilter);
|
||||
// To avoid increasing the memory usage every time the graph is re-connected it's
|
||||
// important that all filters are released; also the ones added by the "Intelligent Connect".
|
||||
IEnumFilters *enumFilters = NULL;
|
||||
hr = m_filterGraph->EnumFilters(&enumFilters);
|
||||
if (SUCCEEDED(hr)) {
|
||||
IBaseFilter *filter = NULL;
|
||||
while (enumFilters->Next(1, &filter, NULL) == S_OK) {
|
||||
m_filterGraph->RemoveFilter(filter);
|
||||
enumFilters->Reset();
|
||||
filter->Release();
|
||||
}
|
||||
enumFilters->Release();
|
||||
}
|
||||
}
|
||||
|
||||
static bool qt_frameRateRangeGreaterThan(const QCamera::FrameRateRange &r1, const QCamera::FrameRateRange &r2)
|
||||
|
||||
Reference in New Issue
Block a user