fix(windows-nui): gate ImageStreamGetNextFrame on new frame number (E_NUI_FRAME_NO_DATA when drained) - fixes game spinning forever in depth-drain loop
This commit is contained in:
1 parent
f98cba70aa
commit
30a2daef30
2 files changed
+15
-9
No files matched your search
@@ -367,21 +367,26 @@ HRESULT VirtualKinectSensor::ImageStreamGetNextFrame(
|
||||
}
|
||||
|
||||
EnterCriticalSection(&lock_);
|
||||
static unsigned img_calls = 0;
|
||||
const bool has = stream->has_frame;
|
||||
const int stype = static_cast<int>(stream->type);
|
||||
if (img_calls < 6 || (img_calls % 150u) == 0u) {
|
||||
ShimLog("ImageStreamGetNextFrame call#%u type=%d has_frame=%d", img_calls,
|
||||
stype, has ? 1 : 0);
|
||||
}
|
||||
++img_calls;
|
||||
if (!has) {
|
||||
if (!stream->has_frame) {
|
||||
LeaveCriticalSection(&lock_);
|
||||
return E_NUI_FRAME_NO_DATA;
|
||||
}
|
||||
const uint32_t frame_no = stream->frames[stream->latest_index].dwFrameNumber;
|
||||
if (frame_no == stream->last_delivered_frame_number) {
|
||||
LeaveCriticalSection(&lock_);
|
||||
return E_NUI_FRAME_NO_DATA;
|
||||
}
|
||||
stream->last_delivered_frame_number = frame_no;
|
||||
stream->outstanding = true;
|
||||
*ppcImageFrame = &stream->frames[stream->latest_index];
|
||||
const int stype = static_cast<int>(stream->type);
|
||||
LeaveCriticalSection(&lock_);
|
||||
static unsigned img_delivered = 0;
|
||||
if (img_delivered < 6 || (img_delivered % 150u) == 0u) {
|
||||
ShimLog("ImageStreamGetNextFrame delivered#%u type=%d frame=%u",
|
||||
img_delivered, stype, frame_no);
|
||||
}
|
||||
++img_delivered;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ struct ImageStream {
|
||||
std::size_t latest_index = 0;
|
||||
bool has_frame = false;
|
||||
bool outstanding = false;
|
||||
uint32_t last_delivered_frame_number = 0;
|
||||
};
|
||||
|
||||
class VirtualKinectSensor {
|
||||
|
||||
Reference in new issue
Block a user