- 時間撮記:
- 2016-8-12 下午01:58:38 (9 年 以前)
- svn:sync-xref-src-repo-rev:
- 110001
- 檔案:
-
- 修改 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Main/src-client/DrvAudioVRDE.cpp
r63244 r63360 85 85 86 86 87 87 88 static int vrdeCreateStreamIn(PPDMIHOSTAUDIO pInterface, 88 PPDMAUDIOSTREAM pStream, PPDMAUDIOSTREAMCFG pCfg, uint32_t *pcSamples) 89 { 90 PDRVAUDIOVRDE pDrv = RT_FROM_MEMBER(pInterface, DRVAUDIOVRDE, IHostAudio); 91 AssertPtrReturn(pDrv, VERR_INVALID_POINTER); 92 89 PPDMAUDIOSTREAM pStream, PPDMAUDIOSTREAMCFG pCfgReq, PPDMAUDIOSTREAMCFG pCfgAcq) 90 { 91 AssertPtrReturn(pInterface, VERR_INVALID_POINTER); 92 AssertPtrReturn(pStream, VERR_INVALID_POINTER); 93 AssertPtrReturn(pCfgReq, VERR_INVALID_POINTER); 94 AssertPtrReturn(pCfgAcq, VERR_INVALID_POINTER); 95 96 PDRVAUDIOVRDE pDrv = RT_FROM_MEMBER(pInterface, DRVAUDIOVRDE, IHostAudio); 93 97 PVRDESTREAMIN pVRDEStrmIn = (PVRDESTREAMIN)pStream; 94 AssertPtrReturn(pVRDEStrmIn, VERR_INVALID_POINTER); 95 96 if (pcSamples) 97 *pcSamples = _4K; /** @todo Make this configurable. */ 98 99 return DrvAudioHlpStreamCfgToProps(pCfg, &pVRDEStrmIn->Stream.Props); 100 } 98 99 if (pCfgAcq) 100 pCfgAcq->cSamples = _4K; /** @todo Make this configurable. */ 101 102 LogFlowFuncLeaveRC(VINF_SUCCESS); 103 return VINF_SUCCESS; 104 } 105 101 106 102 107 static int vrdeCreateStreamOut(PPDMIHOSTAUDIO pInterface, 103 PPDMAUDIOSTREAM pStream, PPDMAUDIOSTREAMCFG pCfg, uint32_t *pcSamples) 104 { 105 PDRVAUDIOVRDE pDrv = RT_FROM_MEMBER(pInterface, DRVAUDIOVRDE, IHostAudio); 106 AssertPtrReturn(pDrv, VERR_INVALID_POINTER); 107 108 LogFlowFunc(("pStream=%p, pCfg=%p\n", pStream, pCfg)); 109 108 PPDMAUDIOSTREAM pStream, PPDMAUDIOSTREAMCFG pCfgReq, PPDMAUDIOSTREAMCFG pCfgAcq) 109 { 110 AssertPtrReturn(pInterface, VERR_INVALID_POINTER); 111 AssertPtrReturn(pStream, VERR_INVALID_POINTER); 112 AssertPtrReturn(pCfgReq, VERR_INVALID_POINTER); 113 AssertPtrReturn(pCfgAcq, VERR_INVALID_POINTER); 114 115 PDRVAUDIOVRDE pDrv = RT_FROM_MEMBER(pInterface, DRVAUDIOVRDE, IHostAudio); 110 116 PVRDESTREAMOUT pVRDEStrmOut = (PVRDESTREAMOUT)pStream; 111 AssertPtrReturn(pVRDEStrmOut, VERR_INVALID_POINTER); 112 113 if (pcSamples) 114 *pcSamples = _4K; /** @todo Make this configurable. */ 115 116 return DrvAudioHlpStreamCfgToProps(pCfg, &pVRDEStrmOut->Stream.Props); 117 } 117 118 if (pCfgAcq) 119 pCfgAcq->cSamples = _4K; /** @todo Make this configurable. */ 120 121 LogFlowFuncLeaveRC(VINF_SUCCESS); 122 return VINF_SUCCESS; 123 } 124 118 125 119 126 static int vrdeControlStreamOut(PPDMIHOSTAUDIO pInterface, … … 133 140 return VINF_SUCCESS; 134 141 } 142 135 143 136 144 static int vrdeControlStreamIn(PPDMIHOSTAUDIO pInterface, … … 174 182 } 175 183 176 static DECLCALLBACK(int) drvAudioVRDEInit(PPDMIHOSTAUDIO pInterface) 184 185 /** 186 * @interface_method_impl{PDMIHOSTAUDIO,pfnInit} 187 */ 188 PDMAUDIO_IHOSTAUDIO_EMIT_INIT(drvAudioVRDE) 177 189 { 178 190 RT_NOREF(pInterface); … … 182 194 } 183 195 184 /** 185 * {FIXME - Missing brief description - FIXME} 186 * 187 * Transfers audio input formerly sent by a connected RDP client / VRDE backend 188 * (using the onVRDEInputXXX methods) over to the VRDE host (VM). The audio device 189 * emulation then will read and send the data to the guest. 190 * 191 * @return IPRT status code. 192 * @param pInterface 193 * @param pStream 194 * @param pcSamplesCaptured 195 */ 196 static DECLCALLBACK(int) drvAudioVRDEStreamCapture(PPDMIHOSTAUDIO pInterface, PPDMAUDIOSTREAM pStream, 197 uint32_t *pcSamplesCaptured) 196 197 /** 198 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamCapture} 199 */ 200 PDMAUDIO_IHOSTAUDIO_EMIT_STREAMCAPTURE(drvAudioVRDE) 198 201 { 199 202 AssertPtrReturn(pInterface, VERR_INVALID_POINTER); 200 AssertPtrReturn(pStream, VERR_INVALID_POINTER); 201 AssertPtrReturn(pcSamplesCaptured, VERR_INVALID_POINTER); 202 203 PDRVAUDIOVRDE pDrv = RT_FROM_MEMBER(pInterface, DRVAUDIOVRDE, IHostAudio); 204 AssertPtrReturn(pDrv, VERR_INVALID_POINTER); 205 203 AssertPtrReturn(pStream, VERR_INVALID_POINTER); 204 /* pcbRead is optional. */ 205 206 PDRVAUDIOVRDE pDrv = RT_FROM_MEMBER(pInterface, DRVAUDIOVRDE, IHostAudio); 206 207 PVRDESTREAMIN pVRDEStrmIn = (PVRDESTREAMIN)pStream; 207 AssertPtrReturn(pVRDEStrmIn, VERR_INVALID_POINTER);208 208 209 209 /** @todo Use CritSect! */ … … 222 222 if (RT_SUCCESS(rc)) 223 223 { 224 *pcSamplesCaptured = cProcessed;225 226 224 Assert(pVRDEStrmIn->cSamplesCaptured >= cProcessed); 227 225 pVRDEStrmIn->cSamplesCaptured -= cProcessed; 226 227 if (pcbRead) 228 *pcbRead = cProcessed; 228 229 } 229 230 … … 232 233 } 233 234 234 /** 235 * Transfers VM audio output to remote client. 236 * 237 * Transfers VM audio output over to the VRDE instance for playing remotely 238 * on the client. 239 * 240 * @return IPRT status code. 241 * @param pInterface 242 * @param pStream 243 * @param pcSamplesPlayed 244 */ 245 static DECLCALLBACK(int) drvAudioVRDEStreamPlay(PPDMIHOSTAUDIO pInterface, 246 PPDMAUDIOSTREAM pStream, uint32_t *pcSamplesPlayed) 235 236 /** 237 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamPlay} 238 */ 239 PDMAUDIO_IHOSTAUDIO_EMIT_STREAMPLAY(drvAudioVRDE) 247 240 { 248 241 AssertPtrReturn(pInterface, VERR_INVALID_POINTER); 249 242 AssertPtrReturn(pStream, VERR_INVALID_POINTER); 250 /* pcSamplesPlayed is optional. */ 251 252 PDRVAUDIOVRDE pDrv = RT_FROM_MEMBER(pInterface, DRVAUDIOVRDE, IHostAudio); 253 AssertPtrReturn(pDrv, VERR_INVALID_POINTER); 254 243 /* pcbWritten is optional. */ 244 245 PDRVAUDIOVRDE pDrv = RT_FROM_MEMBER(pInterface, DRVAUDIOVRDE, IHostAudio); 255 246 PVRDESTREAMOUT pVRDEStrmOut = (PVRDESTREAMOUT)pStream; 256 AssertPtrReturn(pVRDEStrmOut, VERR_INVALID_POINTER);257 247 258 248 uint32_t cLive = AudioMixBufLive(&pStream->MixBuf); … … 316 306 * VRDP server actually did process those. 317 307 */ 318 if (pc SamplesPlayed)319 *pc SamplesPlayed= cReadTotal;308 if (pcbWritten) 309 *pcbWritten = cReadTotal; 320 310 321 311 LogFlowFunc(("cReadTotal=%RU32, rc=%Rrc\n", cReadTotal, rc)); 322 312 return rc; 323 313 } 314 324 315 325 316 static int vrdeDestroyStreamIn(PPDMIHOSTAUDIO pInterface, PPDMAUDIOSTREAM pStream) … … 335 326 } 336 327 328 337 329 static int vrdeDestroyStreamOut(PPDMIHOSTAUDIO pInterface, PPDMAUDIOSTREAM pStream) 338 330 { … … 344 336 } 345 337 346 static DECLCALLBACK(int) drvAudioVRDEGetConfig(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDCFG pCfg) 338 339 /** 340 * @interface_method_impl{PDMIHOSTAUDIO,pfnGetConfig} 341 */ 342 PDMAUDIO_IHOSTAUDIO_EMIT_GETCONFIG(drvAudioVRDE) 347 343 { 348 344 NOREF(pInterface); 349 AssertPtrReturn(pCfg, VERR_INVALID_POINTER); 350 351 pCfg->cbStreamOut = sizeof(VRDESTREAMOUT); 352 pCfg->cbStreamIn = sizeof(VRDESTREAMIN); 353 pCfg->cMaxStreamsIn = UINT32_MAX; 354 pCfg->cMaxStreamsOut = UINT32_MAX; 355 pCfg->cSources = 1; 356 pCfg->cSinks = 1; 357 358 return VINF_SUCCESS; 359 } 360 361 static DECLCALLBACK(void) drvAudioVRDEShutdown(PPDMIHOSTAUDIO pInterface) 345 AssertPtrReturn(pBackendCfg, VERR_INVALID_POINTER); 346 347 pBackendCfg->cbStreamOut = sizeof(VRDESTREAMOUT); 348 pBackendCfg->cbStreamIn = sizeof(VRDESTREAMIN); 349 pBackendCfg->cMaxStreamsIn = UINT32_MAX; 350 pBackendCfg->cMaxStreamsOut = UINT32_MAX; 351 pBackendCfg->cSources = 1; 352 pBackendCfg->cSinks = 1; 353 354 return VINF_SUCCESS; 355 } 356 357 358 /** 359 * @interface_method_impl{PDMIHOSTAUDIO,pfnShutdown} 360 */ 361 PDMAUDIO_IHOSTAUDIO_EMIT_SHUTDOWN(drvAudioVRDE) 362 362 { 363 363 PDRVAUDIOVRDE pDrv = RT_FROM_MEMBER(pInterface, DRVAUDIOVRDE, IHostAudio); … … 368 368 } 369 369 370 static DECLCALLBACK(PDMAUDIOBACKENDSTS) drvAudioVRDEGetStatus(PPDMIHOSTAUDIO pInterface, PDMAUDIODIR enmDir) 370 371 /** 372 * @interface_method_impl{PDMIHOSTAUDIO,pfnGetStatus} 373 */ 374 PDMAUDIO_IHOSTAUDIO_EMIT_GETSTATUS(drvAudioVRDE) 371 375 { 372 376 RT_NOREF(enmDir); … … 376 380 } 377 381 378 static DECLCALLBACK(int) drvAudioVRDEStreamCreate(PPDMIHOSTAUDIO pInterface, 379 PPDMAUDIOSTREAM pStream, PPDMAUDIOSTREAMCFG pCfg, uint32_t *pcSamples) 382 383 /** 384 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamCreate} 385 */ 386 PDMAUDIO_IHOSTAUDIO_EMIT_STREAMCREATE(drvAudioVRDE) 380 387 { 381 388 AssertPtrReturn(pInterface, VERR_INVALID_POINTER); 382 389 AssertPtrReturn(pStream, VERR_INVALID_POINTER); 383 AssertPtrReturn(pCfg, VERR_INVALID_POINTER); 390 AssertPtrReturn(pCfgReq, VERR_INVALID_POINTER); 391 AssertPtrReturn(pCfgAcq, VERR_INVALID_POINTER); 384 392 385 393 int rc; 386 if (pCfg ->enmDir == PDMAUDIODIR_IN)387 rc = vrdeCreateStreamIn(pInterface, pStream, pCfg , pcSamples);394 if (pCfgReq->enmDir == PDMAUDIODIR_IN) 395 rc = vrdeCreateStreamIn(pInterface, pStream, pCfgReq, pCfgAcq); 388 396 else 389 rc = vrdeCreateStreamOut(pInterface, pStream, pCfg, pcSamples); 390 391 LogFlowFunc(("%s: rc=%Rrc\n", pStream->szName, rc)); 397 rc = vrdeCreateStreamOut(pInterface, pStream, pCfgReq, pCfgAcq); 398 392 399 return rc; 393 400 } 394 401 395 static DECLCALLBACK(int) drvAudioVRDEStreamDestroy(PPDMIHOSTAUDIO pInterface, PPDMAUDIOSTREAM pStream) 402 403 /** 404 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamDestroy} 405 */ 406 PDMAUDIO_IHOSTAUDIO_EMIT_STREAMDESTROY(drvAudioVRDE) 396 407 { 397 408 AssertPtrReturn(pInterface, VERR_INVALID_POINTER); … … 407 418 } 408 419 409 static DECLCALLBACK(int) drvAudioVRDEStreamControl(PPDMIHOSTAUDIO pInterface, 410 PPDMAUDIOSTREAM pStream, PDMAUDIOSTREAMCMD enmStreamCmd) 420 421 /** 422 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamControl} 423 */ 424 PDMAUDIO_IHOSTAUDIO_EMIT_STREAMCONTROL(drvAudioVRDE) 411 425 { 412 426 AssertPtrReturn(pInterface, VERR_INVALID_POINTER); … … 424 438 } 425 439 426 static DECLCALLBACK(PDMAUDIOSTRMSTS) drvAudioVRDEStreamGetStatus(PPDMIHOSTAUDIO pInterface, PPDMAUDIOSTREAM pStream) 440 441 /** 442 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamGetStatus} 443 */ 444 PDMAUDIO_IHOSTAUDIO_EMIT_STREAMGETSTATUS(drvAudioVRDE) 427 445 { 428 446 NOREF(pInterface); … … 433 451 } 434 452 435 static DECLCALLBACK(int) drvAudioVRDEStreamIterate(PPDMIHOSTAUDIO pInterface, PPDMAUDIOSTREAM pStream) 453 454 /** 455 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamIterate} 456 */ 457 PDMAUDIO_IHOSTAUDIO_EMIT_STREAMITERATE(drvAudioVRDE) 436 458 { 437 459 AssertPtrReturn(pInterface, VERR_INVALID_POINTER); … … 443 465 return VINF_SUCCESS; 444 466 } 467 445 468 446 469 /** … … 457 480 } 458 481 482 459 483 AudioVRDE::AudioVRDE(Console *pConsole) 460 484 : mpDrv(NULL), … … 462 486 { 463 487 } 488 464 489 465 490 AudioVRDE::~AudioVRDE(void) … … 472 497 } 473 498 499 474 500 int AudioVRDE::onVRDEControl(bool fEnable, uint32_t uFlags) 475 501 { … … 484 510 return VINF_SUCCESS; /* Never veto. */ 485 511 } 512 486 513 487 514 /** … … 515 542 } 516 543 544 517 545 int AudioVRDE::onVRDEInputData(void *pvContext, const void *pvData, uint32_t cbData) 518 546 { … … 535 563 } 536 564 565 537 566 int AudioVRDE::onVRDEInputEnd(void *pvContext) 538 567 { … … 541 570 return VINF_SUCCESS; 542 571 } 572 543 573 544 574 int AudioVRDE::onVRDEInputIntercept(bool fEnabled) … … 547 577 return VINF_SUCCESS; /* Never veto. */ 548 578 } 579 549 580 550 581 /** … … 557 588 { 558 589 RT_NOREF(fFlags); 590 559 591 PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns); 560 592 PDRVAUDIOVRDE pThis = PDMINS_2_DATA(pDrvIns, PDRVAUDIOVRDE); 593 561 594 AssertPtrReturn(pDrvIns, VERR_INVALID_POINTER); 562 595 AssertPtrReturn(pCfg, VERR_INVALID_POINTER);
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器