[idd] resend the last captured frame if a new client connects

This commit is contained in:
Geoffrey McRae
2023-04-14 14:07:30 +10:00
parent fd0cc6aa10
commit d6b26b0eb1
5 changed files with 59 additions and 8 deletions

View File

@@ -165,11 +165,12 @@ void CIndirectDeviceContext::FinishInit(UINT connectorIndex)
return;
}
auto * wrapper = WdfObjectGet_CIndirectMonitorContextWrapper(createOut.MonitorObject);
wrapper->context = new CIndirectMonitorContext(createOut.MonitorObject, this);
m_monitor = createOut.MonitorObject;
auto * wrapper = WdfObjectGet_CIndirectMonitorContextWrapper(m_monitor);
wrapper->context = new CIndirectMonitorContext(m_monitor, this);
IDARG_OUT_MONITORARRIVAL out;
status = IddCxMonitorArrival(createOut.MonitorObject, &out);
status = IddCxMonitorArrival(m_monitor, &out);
}
bool CIndirectDeviceContext::SetupLGMP()
@@ -366,6 +367,13 @@ void CIndirectDeviceContext::LGMPTimer()
lgmpHostAckData(m_pointerQueue);
}
if (lgmpHostQueueNewSubs(m_frameQueue) && m_monitor)
{
auto* wrapper = WdfObjectGet_CIndirectMonitorContextWrapper(m_monitor);
if (wrapper)
wrapper->context->ResendLastFrame();
}
}
void CIndirectDeviceContext::SendFrame(int width, int height, int pitch, DXGI_FORMAT format, void* data)
@@ -373,11 +381,12 @@ void CIndirectDeviceContext::SendFrame(int width, int height, int pitch, DXGI_FO
if (!m_lgmp || !m_frameQueue)
return;
if (m_width != width || m_height != height || m_format != format)
if (m_width != width || m_height != height || m_pitch != pitch || m_format != format)
{
m_width = width;
m_height = height;
m_format = format;
m_pitch = pitch;
++m_formatVer;
}