bug 1162364 detect and abort MF_E_TRANSFORM_STREAM_CHANGE infinite loops r=cpearce

--HG--
extra : rebase_source : 5da37518a24e924d1b3f238a3805bba7f8ba304d
This commit is contained in:
Karl Tomlinson 2015-05-13 16:36:45 +12:00
parent b8fb84d00c
commit 516c74784b
2 changed files with 6 additions and 0 deletions

View File

@ -205,6 +205,7 @@ WMFAudioMFTManager::Output(int64_t aStreamOffset,
aOutData = nullptr;
RefPtr<IMFSample> sample;
HRESULT hr;
bool alreadyDidTypeChange = false;
while (true) {
hr = mDecoder->Output(&sample);
if (hr == MF_E_TRANSFORM_NEED_MORE_INPUT) {
@ -213,6 +214,8 @@ WMFAudioMFTManager::Output(int64_t aStreamOffset,
if (hr == MF_E_TRANSFORM_STREAM_CHANGE) {
hr = UpdateOutputType();
NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
NS_ENSURE_FALSE(alreadyDidTypeChange, MF_E_TRANSFORM_STREAM_CHANGE);
alreadyDidTypeChange = true;
continue;
}
break;

View File

@ -482,6 +482,7 @@ WMFVideoMFTManager::Output(int64_t aStreamOffset,
RefPtr<IMFSample> sample;
HRESULT hr;
aOutData = nullptr;
bool alreadyDidTypeChange = false;
// Loop until we decode a sample, or an unexpected error that we can't
// handle occurs.
@ -497,7 +498,9 @@ WMFVideoMFTManager::Output(int64_t aStreamOffset,
MOZ_ASSERT(!sample);
hr = ConfigureVideoFrameGeometry();
NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
NS_ENSURE_FALSE(alreadyDidTypeChange, MF_E_TRANSFORM_STREAM_CHANGE);
// Loop back and try decoding again...
alreadyDidTypeChange = true;
continue;
}
if (SUCCEEDED(hr)) {