Commit 5901bd8c authored by hubbe's avatar hubbe Committed by Commit bot

DXVA: Avoid infinite recursion

I'm guessing this shouldn't happen, but apparently it did anyways.
Let's have a max number of retries...

BUG=715707
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel

Review-Url: https://codereview.chromium.org/2846343002
Cr-Commit-Position: refs/heads/master@{#468561}
parent 1d2fd608
...@@ -1778,6 +1778,10 @@ void DXVAVideoDecodeAccelerator::DoDecode(const gfx::ColorSpace& color_space) { ...@@ -1778,6 +1778,10 @@ void DXVAVideoDecodeAccelerator::DoDecode(const gfx::ColorSpace& color_space) {
if (D3D11Device()) if (D3D11Device())
g_last_device_removed_reason = D3D11Device()->GetDeviceRemovedReason(); g_last_device_removed_reason = D3D11Device()->GetDeviceRemovedReason();
base::win::ScopedComPtr<IMFSample> output_sample;
int retries = 10;
while (true) {
output_sample.Reset();
MFT_OUTPUT_DATA_BUFFER output_data_buffer = {0}; MFT_OUTPUT_DATA_BUFFER output_data_buffer = {0};
DWORD status = 0; DWORD status = 0;
HRESULT hr; HRESULT hr;
...@@ -1793,7 +1797,6 @@ void DXVAVideoDecodeAccelerator::DoDecode(const gfx::ColorSpace& color_space) { ...@@ -1793,7 +1797,6 @@ void DXVAVideoDecodeAccelerator::DoDecode(const gfx::ColorSpace& color_space) {
DVLOG(1) << "Got events from ProcessOuput, but discarding"; DVLOG(1) << "Got events from ProcessOuput, but discarding";
events->Release(); events->Release();
} }
base::win::ScopedComPtr<IMFSample> output_sample;
output_sample.Attach(output_data_buffer.pSample); output_sample.Attach(output_data_buffer.pSample);
if (FAILED(hr)) { if (FAILED(hr)) {
// A stream change needs further ProcessInput calls to get back decoder // A stream change needs further ProcessInput calls to get back decoder
...@@ -1807,9 +1810,14 @@ void DXVAVideoDecodeAccelerator::DoDecode(const gfx::ColorSpace& color_space) { ...@@ -1807,9 +1810,14 @@ void DXVAVideoDecodeAccelerator::DoDecode(const gfx::ColorSpace& color_space) {
NOTREACHED() << "Failed to set decoder output media type to NV12"; NOTREACHED() << "Failed to set decoder output media type to NV12";
SetState(kStopped); SetState(kStopped);
} else { } else {
DVLOG(1) << "Received output format change from the decoder." if (retries-- > 0) {
" Recursively invoking DoDecode"; DVLOG(1) << "Received format change from the decoder, retrying.";
DoDecode(color_space); continue; // Retry
} else {
RETURN_AND_NOTIFY_ON_FAILURE(
false, "Received too many format changes from decoder.",
PLATFORM_FAILURE, );
}
} }
return; return;
} else if (hr == MF_E_TRANSFORM_NEED_MORE_INPUT) { } else if (hr == MF_E_TRANSFORM_NEED_MORE_INPUT) {
...@@ -1822,6 +1830,9 @@ void DXVAVideoDecodeAccelerator::DoDecode(const gfx::ColorSpace& color_space) { ...@@ -1822,6 +1830,9 @@ void DXVAVideoDecodeAccelerator::DoDecode(const gfx::ColorSpace& color_space) {
return; return;
} }
} }
break; // No more retries needed.
}
TRACE_EVENT_ASYNC_END0("gpu", "DXVAVideoDecodeAccelerator.Decoding", this); TRACE_EVENT_ASYNC_END0("gpu", "DXVAVideoDecodeAccelerator.Decoding", this);
TRACE_COUNTER1("DXVA Decoding", "TotalPacketsBeforeDecode", TRACE_COUNTER1("DXVA Decoding", "TotalPacketsBeforeDecode",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment