Changeset 90918 in vbox
- Timestamp:
- Aug 26, 2021 3:29:25 PM (3 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/AudioTestService.cpp
r90911 r90918 1037 1037 1038 1038 /** 1039 * Creates an ATS instance. 1039 * Initializes an ATS instance. 1040 * 1041 * @note This does *not* start the server! 1040 1042 * 1041 1043 * @returns VBox status code. 1042 * @param pThis The ATS instance to create.1043 */1044 int AudioTestSvcCreate(PATSSERVER pThis)1045 {1046 /*1047 * The default transporter is the first one.1048 */1049 pThis->pTransport = g_apTransports[0]; /** @todo Make this dynamic. */1050 1051 return pThis->pTransport->pfnCreate(&pThis->pTransportInst);1052 }1053 1054 /**1055 * Initializes an ATS instance.1056 *1057 * @returns VBox status code.1058 1044 * @param pThis The ATS instance. 1059 1045 * @param pCallbacks The callbacks table to use. … … 1061 1047 int AudioTestSvcInit(PATSSERVER pThis, PCATSCALLBACKS pCallbacks) 1062 1048 { 1049 RT_BZERO(pThis, sizeof(ATSSERVER)); 1050 1051 pThis->hPipeR = NIL_RTPIPE; 1052 pThis->hPipeW = NIL_RTPIPE; 1053 1054 RTListInit(&pThis->LstClientsNew); 1055 1056 /* Copy callback table. */ 1063 1057 memcpy(&pThis->Callbacks, pCallbacks, sizeof(ATSCALLBACKS)); 1064 1058 1065 pThis->fStarted = false;1066 pThis->fTerminate = false;1067 1068 pThis->hPipeR = NIL_RTPIPE;1069 pThis->hPipeW = NIL_RTPIPE;1070 1071 RTListInit(&pThis->LstClientsNew);1072 1073 /*1074 * Initialize the transport layer.1075 */1076 1059 int rc = RTCritSectInit(&pThis->CritSectClients); 1077 1060 if (RT_SUCCESS(rc)) … … 1083 1066 if (RT_SUCCESS(rc)) 1084 1067 { 1085 /* Spin off the thread serving connections. */ 1086 rc = RTThreadCreate(&pThis->hThreadServing, atsClientWorker, pThis, 0, RTTHREADTYPE_IO, RTTHREADFLAGS_WAITABLE, 1087 "AUDTSTSRVC"); 1068 /* 1069 * The default transporter is the first one. 1070 */ 1071 pThis->pTransport = g_apTransports[0]; /** @todo Make this dynamic. */ 1072 1073 rc = pThis->pTransport->pfnCreate(&pThis->pTransportInst); 1088 1074 if (RT_SUCCESS(rc)) 1089 1075 return VINF_SUCCESS; 1090 else1091 LogRel(("Creating the client worker thread failed with %Rrc\n", rc));1092 1076 1093 1077 RTPipeClose(pThis->hPipeR); … … 1105 1089 } 1106 1090 else 1107 LogRel(("Creating global critical section failed with %Rrc\n", rc)); 1091 LogRel(("Creating critical section failed with %Rrc\n", rc)); 1092 1093 if (RT_FAILURE(rc)) 1094 LogRel(("Creating server failed with %Rrc\n", rc)); 1108 1095 1109 1096 return rc; … … 1134 1121 int AudioTestSvcStart(PATSSERVER pThis) 1135 1122 { 1136 int rc = pThis->pTransport->pfnStart(pThis->pTransportInst); 1123 /* Spin off the thread serving connections. */ 1124 int rc = RTThreadCreate(&pThis->hThreadServing, atsClientWorker, pThis, 0, RTTHREADTYPE_IO, RTTHREADFLAGS_WAITABLE, 1125 "ATSCLWORK"); 1126 if (RT_FAILURE(rc)) 1127 { 1128 LogRel(("Creating the client worker thread failed with %Rrc\n", rc)); 1129 return rc; 1130 } 1131 1132 rc = pThis->pTransport->pfnStart(pThis->pTransportInst); 1137 1133 if (RT_SUCCESS(rc)) 1138 1134 { 1139 1135 /* Spin off the connection thread. */ 1140 1136 rc = RTThreadCreate(&pThis->hThreadMain, atsMainThread, pThis, 0, RTTHREADTYPE_DEFAULT, RTTHREADFLAGS_WAITABLE, 1141 "A UDTSTSRVM");1137 "ATSMAIN"); 1142 1138 if (RT_SUCCESS(rc)) 1143 1139 { … … 1152 1148 1153 1149 /** 1154 * S huts downa formerly started ATS instance.1150 * Stops (shuts down) a formerly started ATS instance. 1155 1151 * 1156 1152 * @returns VBox status code. 1157 1153 * @param pThis The ATS instance. 1158 1154 */ 1159 int AudioTestSvcS hutdown(PATSSERVER pThis)1155 int AudioTestSvcStop(PATSSERVER pThis) 1160 1156 { 1161 1157 if (!pThis->fStarted) -
trunk/src/VBox/Devices/Audio/AudioTestService.h
r90912 r90918 171 171 typedef ATSSERVER *PATSSERVER; 172 172 173 int AudioTestSvcCreate(PATSSERVER pThis);174 173 int AudioTestSvcInit(PATSSERVER pThis, PCATSCALLBACKS pCallbacks); 175 174 int AudioTestSvcDestroy(PATSSERVER pThis); 176 175 int AudioTestSvcHandleOption(PATSSERVER pThis, int ch, PCRTGETOPTUNION pVal); 177 176 int AudioTestSvcStart(PATSSERVER pThis); 178 int AudioTestSvcS hutdown(PATSSERVER pThis);177 int AudioTestSvcStop(PATSSERVER pThis); 179 178 180 179 /** -
trunk/src/VBox/Devices/Audio/DrvHostAudioValidationKit.cpp
r90912 r90918 1108 1108 /* Dont' use rc here, as this will be reported back to PDM and will prevent VBox 1109 1109 * from starting -- not critical but warn the user though. */ 1110 int rc2 = AudioTestSvc Create(&pThis->Srv);1110 int rc2 = AudioTestSvcInit(&pThis->Srv, &Callbacks); 1111 1111 if (RT_SUCCESS(rc2)) 1112 1112 { … … 1126 1126 AssertRC(rc2); 1127 1127 1128 rc2 = AudioTestSvcInit(&pThis->Srv, &Callbacks); 1129 if (RT_SUCCESS(rc2)) 1130 rc2 = AudioTestSvcStart(&pThis->Srv); 1128 rc2 = AudioTestSvcStart(&pThis->Srv); 1131 1129 } 1132 1130 … … 1162 1160 LogRel(("ValKit: Shutting down Audio Test Service (ATS) ...\n")); 1163 1161 1164 int rc = AudioTestSvcS hutdown(&pThis->Srv);1162 int rc = AudioTestSvcStop(&pThis->Srv); 1165 1163 if (RT_SUCCESS(rc)) 1166 1164 rc = AudioTestSvcDestroy(&pThis->Srv); -
trunk/src/VBox/Devices/Audio/testcase/tstAudioTestService.cpp
r90912 r90918 158 158 RTTEST_CHECK_RC_OK(hTest, rc); 159 159 160 rc = AudioTestSvcShutdown(&Srv); 160 rc = AudioTestSvcStop(&Srv); 161 RTTEST_CHECK_RC_OK(hTest, rc); 162 163 rc = AudioTestSvcDestroy(&Srv); 161 164 RTTEST_CHECK_RC_OK(hTest, rc); 162 165 -
trunk/src/VBox/ValidationKit/utils/audio/vkat.cpp
r90898 r90918 311 311 { 312 312 /* 313 * 2. Tell the guest ATSto start playback.313 * 2. Tell VKAT on guest to start playback. 314 314 */ 315 RTTestPrintf(g_hTest, RTTESTLVL_DEBUG, "Telling guest VKATto play tone ...\n");315 RTTestPrintf(g_hTest, RTTESTLVL_DEBUG, "Telling VKAT on guest to play tone ...\n"); 316 316 rc = AudioTestSvcClientTonePlay(&pTstEnv->u.Host.AtsClGuest, pToneParms); 317 317 if (RT_FAILURE(rc)) … … 418 418 * 2. Tell the guest ATS to start recording. 419 419 */ 420 RTTestPrintf(g_hTest, RTTESTLVL_DEBUG, "Telling guest VKATto record audio ...\n");420 RTTestPrintf(g_hTest, RTTESTLVL_DEBUG, "Telling VKAT on guest to record audio ...\n"); 421 421 rc = AudioTestSvcClientToneRecord(&pTstEnv->u.Host.AtsClGuest, &pTstParms->TestTone); 422 422 if (RT_FAILURE(rc)) … … 547 547 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Shutting down guest ATS ...\n"); 548 548 549 int rc2 = AudioTestSvcS hutdown(&pTstEnv->Srv);549 int rc2 = AudioTestSvcStop(pTstEnv->pSrv); 550 550 if (RT_SUCCESS(rc)) 551 551 rc = rc2; … … 557 557 RTTestPrintf(g_hTest, RTTESTLVL_DEBUG, "Using tag '%s'\n", pTstEnv->szTag); 558 558 559 RTTestPrintf(g_hTest, RTTESTLVL_DEBUG, "Telling ValKit audio driver on host to begin a new test set ...\n"); 559 560 rc = AudioTestSvcClientTestSetBegin(&pTstEnv->u.Host.AtsClValKit, pTstEnv->szTag); 560 561 if (RT_SUCCESS(rc)) 561 562 { 563 RTTestPrintf(g_hTest, RTTESTLVL_DEBUG, "Telling VKAT on guest to begin a new test set ...\n"); 562 564 rc = AudioTestSvcClientTestSetBegin(&pTstEnv->u.Host.AtsClGuest, pTstEnv->szTag); 563 565 if (RT_FAILURE(rc)) … … 733 735 RT_ZERO(TstEnv); 734 736 735 int rc = AudioTestSvcCreate(&TstEnv.Srv); 736 if (RT_FAILURE(rc)) 737 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Creating ATS service instance failed with %Rrc\n", rc); 737 int rc; 738 738 739 739 const char *pszTag = NULL; /* Custom tag to use. Can be NULL if not being used. */ -
trunk/src/VBox/ValidationKit/utils/audio/vkatCmdSelfTest.cpp
r90900 r90918 139 139 RTStrCopy(pTstEnvGst->TcpOpts.szConnectAddr, sizeof(pTstEnvGst->TcpOpts.szConnectAddr), "127.0.0.1"); 140 140 141 int rc = AudioTestSvcCreate(&pTstEnvGst->Srv);142 AssertRCReturn(rc, rc);143 144 141 /* Generate tag for guest side. */ 145 rc = RTStrCopy(pTstEnvGst->szTag, sizeof(pTstEnvGst->szTag), pCtx->szTag);142 int rc = RTStrCopy(pTstEnvGst->szTag, sizeof(pTstEnvGst->szTag), pCtx->szTag); 146 143 AssertRCReturn(rc, rc); 147 144 -
trunk/src/VBox/ValidationKit/utils/audio/vkatCommon.cpp
r90912 r90918 492 492 pCtx->cClients--; 493 493 494 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Client swants to disconnect, %RU8 remaining\n", pCtx->cClients);494 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Client wants to disconnect, %RU8 remaining\n", pCtx->cClients); 495 495 496 496 if (0 == pCtx->cClients) /* All clients disconnected? Tear things down. */ … … 772 772 RT_ZERO(Val); 773 773 774 int rc = AudioTestSvcInit(pSrv, pCallbacks); 775 if (RT_FAILURE(rc)) 776 return rc; 777 774 778 Val.u32 = pTcpOpts->enmConnMode; 775 AudioTestSvcHandleOption(pSrv, ATSTCPOPT_CONN_MODE, &Val); 779 rc = AudioTestSvcHandleOption(pSrv, ATSTCPOPT_CONN_MODE, &Val); 780 AssertRCReturn(rc, rc); 776 781 777 782 if ( pTcpOpts->enmConnMode == ATSCONNMODE_BOTH … … 780 785 Assert(pTcpOpts->uBindPort); /* Always set by the caller. */ 781 786 Val.u16 = pTcpOpts->uBindPort; 782 AudioTestSvcHandleOption(pSrv, ATSTCPOPT_BIND_PORT, &Val); 787 rc = AudioTestSvcHandleOption(pSrv, ATSTCPOPT_BIND_PORT, &Val); 788 AssertRCReturn(rc, rc); 783 789 784 790 if (pTcpOpts->szBindAddr[0]) 785 791 { 786 792 Val.psz = pTcpOpts->szBindAddr; 787 AudioTestSvcHandleOption(pSrv, ATSTCPOPT_BIND_ADDRESS, &Val); 793 rc = AudioTestSvcHandleOption(pSrv, ATSTCPOPT_BIND_ADDRESS, &Val); 794 AssertRCReturn(rc, rc); 788 795 } 789 796 else … … 803 810 Assert(pTcpOpts->uConnectPort); /* Always set by the caller. */ 804 811 Val.u16 = pTcpOpts->uConnectPort; 805 AudioTestSvcHandleOption(pSrv, ATSTCPOPT_CONNECT_PORT, &Val); 812 rc = AudioTestSvcHandleOption(pSrv, ATSTCPOPT_CONNECT_PORT, &Val); 813 AssertRCReturn(rc, rc); 806 814 807 815 if (pTcpOpts->szConnectAddr[0]) 808 816 { 809 817 Val.psz = pTcpOpts->szConnectAddr; 810 AudioTestSvcHandleOption(pSrv, ATSTCPOPT_CONNECT_ADDRESS, &Val); 818 rc = AudioTestSvcHandleOption(pSrv, ATSTCPOPT_CONNECT_ADDRESS, &Val); 819 AssertRCReturn(rc, rc); 811 820 } 812 821 else … … 820 829 } 821 830 822 int rc = AudioTestSvcInit(pSrv, pCallbacks);823 831 if (RT_SUCCESS(rc)) 832 { 824 833 rc = AudioTestSvcStart(pSrv); 825 826 if (RT_FAILURE(rc))827 RTTestFailed(g_hTest, "Starting server for %s failed with %Rrc\n", pszDesc, rc);834 if (RT_FAILURE(rc)) 835 RTTestFailed(g_hTest, "Starting server for %s failed with %Rrc\n", pszDesc, rc); 836 } 828 837 829 838 return rc; … … 953 962 pTstEnv->TcpOpts.uConnectPort = ATS_TCP_DEF_CONNECT_PORT_GUEST; 954 963 964 pTstEnv->pSrv = (PATSSERVER)RTMemAlloc(sizeof(ATSSERVER)); 965 AssertPtrReturn(pTstEnv->pSrv, VERR_NO_MEMORY); 966 955 967 /* 956 968 * Start the ATS (Audio Test Service) on the guest side. … … 960 972 * Note that we have to bind to "0.0.0.0" by default so that the host can connect to it. 961 973 */ 962 rc = audioTestEnvConfigureAndStartTcpServer( &pTstEnv->Srv, &Callbacks, "guest", &pTstEnv->TcpOpts);974 rc = audioTestEnvConfigureAndStartTcpServer(pTstEnv->pSrv, &Callbacks, "guest", &pTstEnv->TcpOpts); 963 975 } 964 976 else /* Host mode */ … … 1021 1033 } 1022 1034 1035 if (pTstEnv->pSrv) 1036 { 1037 int rc2 = AudioTestSvcDestroy(pTstEnv->pSrv); 1038 AssertRC(rc2); 1039 1040 RTMemFree(pTstEnv->pSrv); 1041 pTstEnv->pSrv = NULL; 1042 } 1043 1023 1044 for (unsigned i = 0; i < RT_ELEMENTS(pTstEnv->aStreams); i++) 1024 1045 { -
trunk/src/VBox/ValidationKit/utils/audio/vkatInternal.h
r90912 r90918 253 253 /** TCP options to use for ATS. */ 254 254 AUDIOTESTENVTCPOPTS TcpOpts; 255 /** ATS server instance to use. */ 256 ATSSERVER Srv; 255 /** ATS server instance to use. 256 * NULL if not in use. */ 257 PATSSERVER pSrv; 257 258 /** ATS callback context to use. */ 258 259 ATSCALLBACKCTX CallbackCtx;
Note:
See TracChangeset
for help on using the changeset viewer.