Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(239)

Unified Diff: content/common/gpu/media/dxva_video_decode_accelerator.cc

Issue 10832067: Yield instead of spinning the CPU in CopyOutputSampleDataToPictureBuffer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/gpu/media/dxva_video_decode_accelerator.cc
diff --git a/content/common/gpu/media/dxva_video_decode_accelerator.cc b/content/common/gpu/media/dxva_video_decode_accelerator.cc
index c99121ccaf95553e2bbb75cd2d95a31435f9a2ec..fb019ca1cc761c121ccc92fb8e9c35c20384f774 100644
--- a/content/common/gpu/media/dxva_video_decode_accelerator.cc
+++ b/content/common/gpu/media/dxva_video_decode_accelerator.cc
@@ -391,10 +391,11 @@ bool DXVAVideoDecodeAccelerator::DXVAPictureBuffer::
// Ideally, this should be done immediately before the draw call that uses
// the texture. Flush it once here though.
hr = query_->Issue(D3DISSUE_END);
+ RETURN_ON_HR_FAILURE(hr, "Failed to issue END", false);
do {
hr = query_->GetData(NULL, 0, D3DGETDATA_FLUSH);
if (hr == S_FALSE)
- Sleep(0);
+ Sleep(1); // Poor-man's Yield().
} while (hr == S_FALSE);
eglBindTexImage(
@@ -489,6 +490,10 @@ bool DXVAVideoDecodeAccelerator::CreateD3DDevManager() {
hr = device_->CreateQuery(D3DQUERYTYPE_EVENT, &query_);
RETURN_ON_HR_FAILURE(hr, "Failed to create D3D device query", false);
+ // Ensure query_ API works (to avoid an infinite loop later in
+ // CopyOutputSampleDataToPictureBuffer).
+ hr = query_->Issue(D3DISSUE_END);
+ RETURN_ON_HR_FAILURE(hr, "Failed to issue END test query", false);
return true;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698