Changeset 90830 in vbox
- Timestamp:
- Aug 24, 2021 10:47:52 AM (3 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/AudioTestService.cpp
r90745 r90830 471 471 if (pPktHdr->cb == sizeof(ATSPKTHDR)) 472 472 { 473 rc = atsReplyAck(pThis, pInst, pPktHdr); 473 if (pThis->Callbacks.pfnBye) 474 { 475 rc = pThis->Callbacks.pfnBye(pThis->Callbacks.pvUser); 476 } 477 else 478 rc = VINF_SUCCESS; 479 480 if (RT_SUCCESS(rc)) 481 { 482 rc = atsReplyAck(pThis, pInst, pPktHdr); 483 } 484 else 485 rc = atsReplyRC(pThis, pInst, pPktHdr, rc, "Shutting down server failed"); 486 474 487 if (RT_SUCCESS(rc)) 475 488 pThis->pTransport->pfnNotifyBye(pThis->pTransportInst, pInst->pTransportClient); … … 512 525 { 513 526 pThis->pTransport->pfnNotifyHowdy(pThis->pTransportInst, pInst->pTransportClient); 514 pInst->enmState = ATSCLIENTSTATE_READY; 527 528 if (pThis->Callbacks.pfnHowdy) 529 rc = pThis->Callbacks.pfnHowdy(pThis->Callbacks.pvUser); 530 531 if (RT_SUCCESS(rc)) 532 pInst->enmState = ATSCLIENTSTATE_READY; 515 533 } 516 534 … … 921 939 922 940 pThis->pTransport->pfnNotifyBye(pThis->pTransportInst, pInst->pTransportClient); 941 pInst->pTransportClient = NULL; 923 942 papInsts[uId - 1] = NULL; 924 943 cClientsCur--; -
trunk/src/VBox/Devices/Audio/AudioTestService.h
r90768 r90830 52 52 typedef struct ATSCALLBACKS 53 53 { 54 /** 55 * Tells the implementation that a new client connected. Optional. 56 * 57 * @param pvUser User-supplied pointer to context data. Optional. 58 */ 59 DECLR3CALLBACKMEMBER(int, pfnHowdy, (void const *pvUser)); 60 61 /** 62 * Tells the implementation that a client disconnected. Optional. 63 * 64 * @param pvUser User-supplied pointer to context data. Optional. 65 */ 66 DECLR3CALLBACKMEMBER(int, pfnBye, (void const *pvUser)); 67 54 68 /** 55 69 * Begins a test set. Optional. -
trunk/src/VBox/Devices/Audio/AudioTestServiceClient.cpp
r90764 r90830 57 57 58 58 59 /********************************************************************************************************************************* 60 * Prototypes * 61 *********************************************************************************************************************************/ 62 static int audioTestSvcClientCloseInternal(PATSCLIENT pClient); 63 59 64 /** 60 65 * Initializes an ATS client, internal version. … … 230 235 231 236 /** 232 * Tells the ATS server that we want disconnect.237 * Tells the ATS server that we want to disconnect. 233 238 * 234 239 * @returns VBox status code. … … 237 242 static int audioTestSvcClientDoBye(PATSCLIENT pClient) 238 243 { 239 ATSPKTREQHOWDY Req; 240 Req.uVersion = ATS_PROTOCOL_VS; 241 audioTestSvcClientReqHdrInit(&Req.Hdr, sizeof(Req), ATSPKT_OPCODE_BYE, 0); 244 ATSPKTHDR Req; 245 audioTestSvcClientReqHdrInit(&Req, sizeof(Req), ATSPKT_OPCODE_BYE, 0); 242 246 int rc = audioTestSvcClientSendMsg(pClient, &Req, sizeof(Req)); 243 247 if (RT_SUCCESS(rc)) … … 272 276 void AudioTestSvcClientDestroy(PATSCLIENT pClient) 273 277 { 274 /* ignore rc */ audioTestSvcClientDoBye(pClient); 278 if (!pClient) 279 return; 280 281 /* ignore rc */ audioTestSvcClientCloseInternal(pClient); 275 282 276 283 if (pClient->pTransport) 284 { 277 285 pClient->pTransport->pfnTerm(pClient->pTransportInst); 286 pClient->pTransport->pfnDestroy(pClient->pTransportInst); 287 pClient->pTransport = NULL; 288 } 278 289 } 279 290 … … 495 506 496 507 /** 508 * Disconnects from an ATS server, internal version. 509 * 510 * @returns VBox status code. 511 * @param pClient Client to disconnect. 512 */ 513 static int audioTestSvcClientCloseInternal(PATSCLIENT pClient) 514 { 515 int rc = audioTestSvcClientDoBye(pClient); 516 if (RT_SUCCESS(rc)) 517 { 518 if (pClient->pTransport->pfnNotifyBye) 519 pClient->pTransport->pfnNotifyBye(pClient->pTransportInst, pClient->pTransportClient); 520 } 521 522 return rc; 523 } 524 525 /** 497 526 * Disconnects from an ATS server. 498 527 * … … 502 531 int AudioTestSvcClientClose(PATSCLIENT pClient) 503 532 { 504 pClient->pTransport->pfnNotifyBye(pClient->pTransportInst, pClient->pTransportClient); 505 506 return VINF_SUCCESS; 507 } 508 533 return audioTestSvcClientCloseInternal(pClient); 534 } 535 -
trunk/src/VBox/Devices/Audio/AudioTestServiceClient.h
r89962 r90830 39 39 typedef ATSCLIENT *PATSCLIENT; 40 40 41 /** @name Creation / destruction. 42 * @{ */ 41 43 int AudioTestSvcClientCreate(PATSCLIENT pClient); 42 44 void AudioTestSvcClientDestroy(PATSCLIENT pClient); 45 /** @} */ 46 47 /** @name Connection handling. 48 * @{ */ 43 49 int AudioTestSvcClientConnect(PATSCLIENT pClient); 50 int AudioTestSvcClientClose(PATSCLIENT pClient); 51 /** @} */ 52 53 /** @name Option handling. 54 * @{ */ 44 55 int AudioTestSvcClientHandleOption(PATSCLIENT pClient, int ch, PCRTGETOPTUNION pVal); 56 /** @} */ 57 58 /** @name Test set handling. 59 * @{ */ 45 60 int AudioTestSvcClientTestSetBegin(PATSCLIENT pClient, const char *pszTag); 46 61 int AudioTestSvcClientTestSetEnd(PATSCLIENT pClient, const char *pszTag); 62 int AudioTestSvcClientTestSetDownload(PATSCLIENT pClient, const char *pszTag, const char *pszPathOutAbs); 63 /** @} */ 64 65 /** @name Tone handling. 66 * @{ */ 47 67 int AudioTestSvcClientTonePlay(PATSCLIENT pClient, PAUDIOTESTTONEPARMS pToneParms); 48 68 int AudioTestSvcClientToneRecord(PATSCLIENT pClient, PAUDIOTESTTONEPARMS pToneParms); 49 int AudioTestSvcClientTestSetDownload(PATSCLIENT pClient, const char *pszTag, const char *pszPathOutAbs); 50 int AudioTestSvcClientClose(PATSCLIENT pClient); 69 /** @} */ 51 70 52 71 #endif /* !VBOX_INCLUDED_SRC_Audio_AudioTestServiceClient_h */ -
trunk/src/VBox/Devices/Audio/AudioTestServiceTcp.cpp
r90554 r90830 426 426 LogFunc(("atsTcpDisconnectClient %RTsock\n", pClient->hTcpClient)); 427 427 atsTcpDisconnectClient(pThis, pClient); 428 RTMemFree(pClient);429 428 } 430 429 … … 446 445 * Try send the babble reply. 447 446 */ 448 NOREF(cMsSendTimeout); /** @todo implement the timeout here; non-blocking write + select-on-write. */447 RT_NOREF(cMsSendTimeout); /** @todo implement the timeout here; non-blocking write + select-on-write. */ 449 448 int rc; 450 449 size_t cbToSend = RT_ALIGN_Z(pPktHdr->cb, ATSPKT_ALIGNMENT); -
trunk/src/VBox/ValidationKit/utils/audio/vkat.cpp
r90788 r90830 257 257 pTstParmsAcq->enmDir = PDMAUDIODIR_OUT; 258 258 #ifdef DEBUG 259 pTstParmsAcq->cIterations = 4;259 pTstParmsAcq->cIterations = 1; 260 260 #else 261 261 pTstParmsAcq->cIterations = RTRandU32Ex(1, 10); … … 361 361 pTstParmsAcq->enmDir = PDMAUDIODIR_IN; 362 362 #ifdef DEBUG 363 pTstParmsAcq->cIterations = 4;363 pTstParmsAcq->cIterations = 1; 364 364 #else 365 365 pTstParmsAcq->cIterations = RTRandU32Ex(1, 10); -
trunk/src/VBox/ValidationKit/utils/audio/vkatCmdSelfTest.cpp
r90769 r90830 162 162 /* else Step 1a later. */ 163 163 164 RTThreadSleep( 5000); /* Fudge: Wait until guest ATS is up. */164 RTThreadSleep(2000); /* Fudge: Wait until guest ATS is up. 2 seconds should be enough (tm). */ 165 165 166 166 if (RT_SUCCESS(rc)) … … 192 192 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Shutting down self test\n"); 193 193 194 ASMAtomicWriteBool(&g_fTerminate, true); 195 194 /* If we started the guest ATS ourselves, wait for it to terminate properly. */ 196 195 if (fStartGuestAts) 197 196 { -
trunk/src/VBox/ValidationKit/utils/audio/vkatCommon.cpp
r90767 r90830 61 61 /** File handle to the (opened) test set archive for reading. */ 62 62 RTFILE hTestSetArchive; 63 /** Number of currently connected clients. */ 64 uint8_t cClients; 63 65 } ATSCALLBACKCTX; 64 66 typedef ATSCALLBACKCTX *PATSCALLBACKCTX; … … 463 465 *********************************************************************************************************************************/ 464 466 467 /** @copydoc ATSCALLBACKS::pfnHowdy 468 * 469 * @note Runs as part of the guest ATS. 470 */ 471 static DECLCALLBACK(int) audioTestGstAtsHowdyCallback(void const *pvUser) 472 { 473 PATSCALLBACKCTX pCtx = (PATSCALLBACKCTX)pvUser; 474 475 AssertReturn(pCtx->cClients <= UINT8_MAX, VERR_BUFFER_OVERFLOW); 476 477 pCtx->cClients++; 478 479 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "New client connected, now %RU8 total\n", pCtx->cClients); 480 481 return VINF_SUCCESS; 482 } 483 484 /** @copydoc ATSCALLBACKS::pfnBye 485 * 486 * @note Runs as part of the guest ATS. 487 */ 488 static DECLCALLBACK(int) audioTestGstAtsByeCallback(void const *pvUser) 489 { 490 PATSCALLBACKCTX pCtx = (PATSCALLBACKCTX)pvUser; 491 492 AssertReturn(pCtx->cClients, VERR_WRONG_ORDER); 493 pCtx->cClients--; 494 495 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Clients wants to disconnect, %RU8 remaining\n", pCtx->cClients); 496 497 if (0 == pCtx->cClients) /* All clients disconnected? Tear things down. */ 498 { 499 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Last client disconnected, terminating server ...\n"); 500 ASMAtomicWriteBool(&g_fTerminate, true); 501 } 502 503 return VINF_SUCCESS; 504 } 505 465 506 /** @copydoc ATSCALLBACKS::pfnTestSetBegin 466 507 * … … 870 911 ATSCALLBACKS Callbacks; 871 912 RT_ZERO(Callbacks); 913 Callbacks.pfnHowdy = audioTestGstAtsHowdyCallback; 914 Callbacks.pfnBye = audioTestGstAtsByeCallback; 872 915 Callbacks.pfnTestSetBegin = audioTestGstAtsTestSetBeginCallback; 873 916 Callbacks.pfnTestSetEnd = audioTestGstAtsTestSetEndCallback; … … 965 1008 return; 966 1009 1010 /* When in host mode, we need to destroy our ATS clients in order to also let 1011 * the ATS server(s) know we're going to quit. */ 1012 if (pTstEnv->enmMode == AUDIOTESTMODE_HOST) 1013 { 1014 AudioTestSvcClientDestroy(&pTstEnv->u.Host.AtsClValKit); 1015 AudioTestSvcClientDestroy(&pTstEnv->u.Host.AtsClGuest); 1016 } 1017 967 1018 for (unsigned i = 0; i < RT_ELEMENTS(pTstEnv->aStreams); i++) 968 1019 {
Note:
See TracChangeset
for help on using the changeset viewer.