儲存庫 vbox 的更動 67518
- 時間撮記:
- 2017-6-20 下午06:40:52 (7 年 以前)
- 檔案:
-
- 修改 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Devices/Audio/DrvHostPulseAudio.cpp
r67514 r67518 87 87 /** Shutdown indicator. */ 88 88 volatile bool fAbortLoop; 89 /** Abort wait loop during enumeration. */ 90 volatile bool fAbortEnumLoop; 89 91 /** Pointer to host audio interface. */ 90 92 PDMIHOSTAUDIO IHostAudio; … … 186 188 { 187 189 if (!pThis) 188 {189 // LogRel(("DEBUG: paSignalWaiter return because of !pThis\n"));190 190 return; 191 } 192 193 // LogRel(("DEBUG: paSignalWaiter set fLoopWait=true and calling pa_threaded_mainloop_signal()\n")); 191 194 192 pThis->fAbortLoop = true; 193 pThis->fAbortEnumLoop = true; 195 194 pa_threaded_mainloop_signal(pThis->pMainLoop, 0); 196 195 } … … 274 273 * Synchronously wait until an operation completed. 275 274 */ 276 static int paWaitForEx(PDRVHOSTPULSEAUDIO pThis, pa_operation *pOP, RTMSINTERVAL cMsTimeout , bool fDebug)275 static int paWaitForEx(PDRVHOSTPULSEAUDIO pThis, pa_operation *pOP, RTMSINTERVAL cMsTimeout) 277 276 { 278 277 AssertPtrReturn(pThis, VERR_INVALID_POINTER); … … 280 279 281 280 int rc = VINF_SUCCESS; 281 pThis->fAbortEnumLoop = false; 282 282 283 283 uint64_t u64StartMs = RTTimeMilliTS(); … … 287 287 { 288 288 AssertPtr(pThis->pMainLoop); 289 if (fDebug)290 LogRel(("calling pa_threaded_mainloop_wait\n"));291 289 pa_threaded_mainloop_wait(pThis->pMainLoop); 292 if ( fDebug)293 LogRel(("return from pa_threaded_mainloop_wait\n"));290 if (pThis->fAbortEnumLoop) 291 break; 294 292 } 295 293 pThis->fAbortLoop = false; … … 301 299 break; 302 300 } 303 // LogRel(("DEBUG: paWaitForEx next turn (elapsed=%RU64ms)\n", u64ElapsedMs));304 301 } 305 302 … … 310 307 311 308 312 static int paWaitFor(PDRVHOSTPULSEAUDIO pThis, pa_operation *pOP , bool fDebug = false)313 { 314 return paWaitForEx(pThis, pOP, 10 * 1000 /* 10s timeout */ , fDebug);309 static int paWaitFor(PDRVHOSTPULSEAUDIO pThis, pa_operation *pOP) 310 { 311 return paWaitForEx(pThis, pOP, 10 * 1000 /* 10s timeout */); 315 312 } 316 313 … … 330 327 case PA_CONTEXT_READY: 331 328 case PA_CONTEXT_TERMINATED: 329 case PA_CONTEXT_FAILED: 332 330 paSignalWaiter(pThis); 333 331 break; 334 332 335 case PA_CONTEXT_FAILED:336 LogRel(("PulseAudio: Audio context has failed, stopping\n"));337 paSignalWaiter(pThis);338 break;339 340 333 default: 341 LogRel(("paContextCbStateChanged: ignoring new state %d\n", pa_context_get_state(pCtx)));342 334 break; 343 335 } … … 553 545 { 554 546 AssertPtrReturn(pInterface, VERR_INVALID_POINTER); 555 LogRel(("drvHostPulseAudioInit\n"));556 547 557 548 PDRVHOSTPULSEAUDIO pThis = PDMIHOSTAUDIO_2_DRVHOSTPULSEAUDIO(pInterface); … … 655 646 } 656 647 657 LogRel(("drvHostPulseAudioInit done %Rrc\n", rc));658 648 LogFlowFuncLeaveRC(rc); 659 649 return rc; … … 945 935 static void paEnumSinkCb(pa_context *pCtx, const pa_sink_info *pInfo, int eol, void *pvUserData) 946 936 { 947 LogRel(("DEBUG: paEnumSinkCb\n")); 948 if (eol != 0) 949 { 950 LogRel(("DEBUG: paEnumSinkCb return EOL=%d\n", eol)); 937 if (eol > 0) 951 938 return; 952 } 953 if (!pCtx) 954 LogRel(("DEBUG: paEnumSinkCb return because of !pCtx\n")); 939 940 PPULSEAUDIOENUMCBCTX pCbCtx = (PPULSEAUDIOENUMCBCTX)pvUserData; 941 AssertPtrReturnVoid(pCbCtx); 942 PDRVHOSTPULSEAUDIO pThis = pCbCtx->pDrv; 943 AssertPtrReturnVoid(pThis); 944 if (eol < 0) 945 { 946 pThis->fAbortEnumLoop = true; 947 pa_threaded_mainloop_signal(pCbCtx->pDrv->pMainLoop, 0); 948 return; 949 } 950 955 951 AssertPtrReturnVoid(pCtx); 956 if (!pInfo)957 LogRel(("DEBUG: paEnumSinkCb return because of !pInfo\n"));958 952 AssertPtrReturnVoid(pInfo); 959 960 PPULSEAUDIOENUMCBCTX pCbCtx = (PPULSEAUDIOENUMCBCTX)pvUserData;961 if (!pCbCtx)962 LogRel(("DEBUG: paEnumSinkCb return because of !pCbCtx\n"));963 AssertPtrReturnVoid(pCbCtx);964 if (!pCbCtx->pDrv)965 LogRel(("DEBUG: paEnumSinkCb return because of !pCbCtx->pDrv\n"));966 AssertPtrReturnVoid(pCbCtx->pDrv);967 953 968 954 LogRel2(("PulseAudio: Using output sink '%s'\n", pInfo->name)); … … 971 957 pCbCtx->cDevOut++; 972 958 973 LogRel(("DEBUG: pa_threaded_mainloop_signal() from paEnumSinkCb\n"));974 959 pa_threaded_mainloop_signal(pCbCtx->pDrv->pMainLoop, 0); 975 960 } … … 978 963 static void paEnumSourceCb(pa_context *pCtx, const pa_source_info *pInfo, int eol, void *pvUserData) 979 964 { 980 if (eol != 0) 981 { 982 LogRel(("DEBUG: paEnumSourceCb return EOL=%d\n", eol)); 965 if (eol > 0) 983 966 return; 984 } 985 986 if (!pCtx) 987 LogRel(("DEBUG: paEnumSourceCb return because of !pCtx\n")); 967 968 PPULSEAUDIOENUMCBCTX pCbCtx = (PPULSEAUDIOENUMCBCTX)pvUserData; 969 AssertPtrReturnVoid(pCbCtx); 970 PDRVHOSTPULSEAUDIO pThis = pCbCtx->pDrv; 971 AssertPtrReturnVoid(pThis); 972 if (eol < 0) 973 { 974 pThis->fAbortEnumLoop = true; 975 pa_threaded_mainloop_signal(pCbCtx->pDrv->pMainLoop, 0); 976 return; 977 } 978 988 979 AssertPtrReturnVoid(pCtx); 989 if (!pInfo)990 LogRel(("DEBUG: paEnumSourceCb return because of !pInfo\n"));991 980 AssertPtrReturnVoid(pInfo); 992 993 PPULSEAUDIOENUMCBCTX pCbCtx = (PPULSEAUDIOENUMCBCTX)pvUserData;994 if (!pCbCtx)995 LogRel(("DEBUG: paEnumSourceCb return because of !pCbCtx\n"));996 AssertPtrReturnVoid(pCbCtx);997 if (!pCbCtx->pDrv)998 LogRel(("DEBUG: paEnumSourceCb return because of !pCbCtx->pDrv\n"));999 AssertPtrReturnVoid(pCbCtx->pDrv);1000 981 1001 982 LogRel2(("PulseAudio: Using input source '%s'\n", pInfo->name)); … … 1004 985 pCbCtx->cDevIn++; 1005 986 1006 LogRel(("DEBUG: pa_threaded_mainloop_signal() from paEnumSourceCb\n"));1007 987 pa_threaded_mainloop_signal(pCbCtx->pDrv->pMainLoop, 0); 1008 988 } … … 1011 991 static void paEnumServerCb(pa_context *pCtx, const pa_server_info *pInfo, void *pvUserData) 1012 992 { 1013 LogRel(("DEBUG: paEnumServerCb\n"));1014 if (!pCtx)1015 LogRel(("DEBUG: paEnumServerCb return because of !pCtx\n"));1016 993 AssertPtrReturnVoid(pCtx); 994 PPULSEAUDIOENUMCBCTX pCbCtx = (PPULSEAUDIOENUMCBCTX)pvUserData; 995 AssertPtrReturnVoid(pCbCtx); 996 PDRVHOSTPULSEAUDIO pThis = pCbCtx->pDrv; 997 AssertPtrReturnVoid(pThis); 998 1017 999 if (!pInfo) 1018 LogRel(("DEBUG: paEnumServerCb return because of !pInfo\n")); 1019 AssertPtrReturnVoid(pInfo); 1020 1021 PPULSEAUDIOENUMCBCTX pCbCtx = (PPULSEAUDIOENUMCBCTX)pvUserData; 1022 if (!pCbCtx) 1023 LogRel(("DEBUG: paEnumServerCb return because of !pCbCtx\n")); 1024 AssertPtrReturnVoid(pCbCtx); 1025 1026 PDRVHOSTPULSEAUDIO pThis = pCbCtx->pDrv; 1027 if (!pCbCtx->pDrv) 1028 LogRel(("DEBUG: paEnumServerCb return because of !pCbCtx->pDrv\n")); 1029 AssertPtrReturnVoid(pThis); 1000 { 1001 pThis->fAbortEnumLoop = true; 1002 pa_threaded_mainloop_signal(pCbCtx->pDrv->pMainLoop, 0); 1003 return; 1004 } 1030 1005 1031 1006 if (pInfo->default_sink_name) … … 1041 1016 } 1042 1017 1043 LogRel(("DEBUG: pa_threaded_mainloop_signal() from paEnumServerCb\n"));1044 1018 pa_threaded_mainloop_signal(pThis->pMainLoop, 0); 1045 1019 } … … 1059 1033 Cfg.cMaxStreamsIn = UINT32_MAX; 1060 1034 1061 PULSEAUDIOENUMCBCTX cbCtx;1062 RT_ZERO( cbCtx);1063 1064 cbCtx.pDrv = pThis;1065 cbCtx.fFlags = fEnum;1035 PULSEAUDIOENUMCBCTX CbCtx; 1036 RT_ZERO(CbCtx); 1037 1038 CbCtx.pDrv = pThis; 1039 CbCtx.fFlags = fEnum; 1066 1040 1067 1041 bool fLog = (fEnum & PULSEAUDIOENUMCBFLAGS_LOG); 1068 1042 1069 LogRel(("PulseAudio: starting server enumeration\n")); /** @todo remove */ 1070 int rc = paWaitFor(pThis, pa_context_get_server_info(pThis->pContext, paEnumServerCb, &cbCtx)); 1071 LogRel(("PulseAudio: done server enumeration (rc=%Rrc)\n", rc)); 1043 int rc = paWaitFor(pThis, pa_context_get_server_info(pThis->pContext, paEnumServerCb, &CbCtx)); 1044 if ( RT_SUCCESS(rc) 1045 && pThis->fAbortEnumLoop) 1046 rc = VERR_AUDIO_BACKEND_INIT_FAILED; /* error code does not matter */ 1072 1047 if (RT_SUCCESS(rc)) 1073 1048 { 1074 if ( cbCtx.pszDefaultSink)1049 if (CbCtx.pszDefaultSink) 1075 1050 { 1076 1051 if (fLog) 1077 LogRel2(("PulseAudio: Default output sink is '%s'\n", cbCtx.pszDefaultSink)); 1078 1079 LogRel(("PulseAudio: starting output sink enumeration\n")); /** @todo remove */ 1080 rc = paWaitFor(pThis, pa_context_get_sink_info_by_name(pThis->pContext, cbCtx.pszDefaultSink, 1081 paEnumSinkCb, &cbCtx)); 1082 LogRel(("PulseAudio: output sink enumeration done (rc=%Rrc)\n", rc)); /** @todo remove */ 1052 LogRel2(("PulseAudio: Default output sink is '%s'\n", CbCtx.pszDefaultSink)); 1053 1054 rc = paWaitFor(pThis, pa_context_get_sink_info_by_name(pThis->pContext, CbCtx.pszDefaultSink, 1055 paEnumSinkCb, &CbCtx)); 1056 if ( RT_SUCCESS(rc) 1057 && pThis->fAbortEnumLoop) 1058 rc = VERR_AUDIO_BACKEND_INIT_FAILED; /* error code does not matter */ 1083 1059 if ( RT_FAILURE(rc) 1084 1060 && fLog) 1085 1061 { 1086 LogRel(("PulseAudio: Error enumerating properties for default output sink '%s'\n", cbCtx.pszDefaultSink));1062 LogRel(("PulseAudio: Error enumerating properties for default output sink '%s'\n", CbCtx.pszDefaultSink)); 1087 1063 } 1088 1064 } … … 1092 1068 if (RT_SUCCESS(rc)) 1093 1069 { 1094 if ( cbCtx.pszDefaultSource)1070 if (CbCtx.pszDefaultSource) 1095 1071 { 1096 1072 if (fLog) 1097 LogRel2(("PulseAudio: Default input source is '%s'\n", cbCtx.pszDefaultSource)); 1098 1099 LogRel(("PulseAudio: starting input sink enumeration\n")); 1100 rc = paWaitFor(pThis, pa_context_get_source_info_by_name(pThis->pContext, cbCtx.pszDefaultSource, 1101 paEnumSourceCb, &cbCtx)); 1102 LogRel(("PulseAudio: input sink enumeration done (rc=%Rrc)\n", rc)); 1073 LogRel2(("PulseAudio: Default input source is '%s'\n", CbCtx.pszDefaultSource)); 1074 1075 rc = paWaitFor(pThis, pa_context_get_source_info_by_name(pThis->pContext, CbCtx.pszDefaultSource, 1076 paEnumSourceCb, &CbCtx)); 1103 1077 if ( RT_FAILURE(rc) 1104 1078 && fLog) 1105 1079 { 1106 LogRel(("PulseAudio: Error enumerating properties for default input source '%s'\n", cbCtx.pszDefaultSource));1080 LogRel(("PulseAudio: Error enumerating properties for default input source '%s'\n", CbCtx.pszDefaultSource)); 1107 1081 } 1108 1082 } … … 1115 1089 if (fLog) 1116 1090 { 1117 LogRel2(("PulseAudio: Found %RU8 host playback device(s)\n", cbCtx.cDevOut));1118 LogRel2(("PulseAudio: Found %RU8 host capturing device(s)\n", cbCtx.cDevIn));1091 LogRel2(("PulseAudio: Found %RU8 host playback device(s)\n", CbCtx.cDevOut)); 1092 LogRel2(("PulseAudio: Found %RU8 host capturing device(s)\n", CbCtx.cDevIn)); 1119 1093 } 1120 1094 … … 1123 1097 } 1124 1098 1125 if ( cbCtx.pszDefaultSink)1126 { 1127 RTStrFree( cbCtx.pszDefaultSink);1128 cbCtx.pszDefaultSink = NULL;1129 } 1130 1131 if ( cbCtx.pszDefaultSource)1132 { 1133 RTStrFree( cbCtx.pszDefaultSource);1134 cbCtx.pszDefaultSource = NULL;1099 if (CbCtx.pszDefaultSink) 1100 { 1101 RTStrFree(CbCtx.pszDefaultSink); 1102 CbCtx.pszDefaultSink = NULL; 1103 } 1104 1105 if (CbCtx.pszDefaultSource) 1106 { 1107 RTStrFree(CbCtx.pszDefaultSource); 1108 CbCtx.pszDefaultSource = NULL; 1135 1109 } 1136 1110 } … … 1326 1300 PDRVHOSTPULSEAUDIO pThis = PDMIHOSTAUDIO_2_DRVHOSTPULSEAUDIO(pInterface); 1327 1301 1328 LogRel(("drvHostPulseAudioGetConfig\n")); 1329 int rc = paEnumerate(pThis, pBackendCfg, PULSEAUDIOENUMCBFLAGS_LOG /* fEnum */); 1330 LogRel(("drvHostPulseAudioGetConfig done %Rrc\n", rc)); 1331 return rc; 1302 return paEnumerate(pThis, pBackendCfg, PULSEAUDIOENUMCBFLAGS_LOG /* fEnum */); 1332 1303 } 1333 1304
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器