| 1257 | } |
| 1258 | |
| 1259 | void LiveCapture::connectionThreadEntry() |
| 1260 | { |
| 1261 | ITargetControl *conn = |
| 1262 | RENDERDOC_CreateTargetControl(m_Hostname, m_RemoteIdent, GetSystemUsername(), true); |
| 1263 | m_Connected.release(); |
| 1264 | |
| 1265 | if(!conn || !conn->Connected()) |
| 1266 | { |
| 1267 | if(conn) |
| 1268 | conn->Shutdown(); |
| 1269 | |
| 1270 | GUIInvoke::call(this, [this]() { |
| 1271 | setTitle(tr("Connection failed")); |
| 1272 | ui->connectionStatus->setText(tr("Failed")); |
| 1273 | ui->connectionIcon->setPixmap(Pixmaps::del(ui->connectionIcon)); |
| 1274 | |
| 1275 | connectionClosed(); |
| 1276 | }); |
| 1277 | |
| 1278 | m_Connected.acquire(); |
| 1279 | return; |
| 1280 | } |
| 1281 | |
| 1282 | uint32_t pid = conn->GetPID(); |
| 1283 | QString target = conn->GetTarget(); |
| 1284 | |
| 1285 | GUIInvoke::call(this, [this, pid, target]() { |
| 1286 | if(!m_Connected.available()) |
| 1287 | return; |
| 1288 | |
| 1289 | if(pid) |
| 1290 | setTitle(QFormatStr("%1 [PID %2]").arg(target).arg(pid)); |
| 1291 | else |
| 1292 | setTitle(target); |
| 1293 | |
| 1294 | ui->target->setText(windowTitle()); |
| 1295 | ui->connectionIcon->setPixmap(Pixmaps::connect(ui->connectionIcon)); |
| 1296 | ui->connectionStatus->setText(tr("Established")); |
| 1297 | }); |
| 1298 | |
| 1299 | while(conn && conn->Connected()) |
| 1300 | { |
| 1301 | if(m_TriggerCapture.tryAcquire()) |
| 1302 | { |
| 1303 | conn->TriggerCapture((uint)m_CaptureNumFrames); |
| 1304 | m_CaptureNumFrames = 1; |
| 1305 | } |
| 1306 | |
| 1307 | if(m_QueueCapture.tryAcquire()) |
| 1308 | { |
| 1309 | conn->QueueCapture((uint32_t)m_QueueCaptureFrameNum, (uint32_t)m_CaptureNumFrames); |
| 1310 | m_QueueCaptureFrameNum = 0; |
| 1311 | m_CaptureNumFrames = 1; |
| 1312 | } |
| 1313 | |
| 1314 | if(m_CopyCapture.tryAcquire()) |
| 1315 | { |
| 1316 | conn->CopyCapture(m_CopyCaptureID, m_CopyCaptureLocalPath); |
no test coverage detected