- Timestamp:
- Nov 5, 2015 2:43:41 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DrvHostPulseAudio.cpp
r58378 r58582 58 58 static struct pa_threaded_mainloop *g_pMainLoop; 59 59 static struct pa_context *g_pContext; 60 static volatile bool g_fAbortMainLoop; 60 61 61 62 /** … … 130 131 static void drvHostPulseAudioCbSuccess(pa_stream *pStream, int fSuccess, void *pvContext); 131 132 133 /** 134 * Signal the main loop to abort. Just signalling isn't sufficient as the 135 * mainloop might not have been entered yet. 136 */ 137 static void drvHostPulseAudioAbortMainLoop(void) 138 { 139 g_fAbortMainLoop = true; 140 pa_threaded_mainloop_signal(g_pMainLoop, 0); 141 } 142 132 143 static pa_sample_format_t drvHostPulseAudioFmtToPulse(PDMAUDIOFMT fmt) 133 144 { … … 228 239 * Context status changed. 229 240 */ 230 static void drvHostPulseAudioCbCtxState(pa_context *pContext, void *pv Context)241 static void drvHostPulseAudioCbCtxState(pa_context *pContext, void *pvUser) 231 242 { 232 243 AssertPtrReturnVoid(pContext); 233 234 PPULSEAUDIOSTREAM pStrm = (PPULSEAUDIOSTREAM)pvContext; 235 NOREF(pStrm); 244 NOREF(pvUser); 236 245 237 246 switch (pa_context_get_state(pContext)) … … 239 248 case PA_CONTEXT_READY: 240 249 case PA_CONTEXT_TERMINATED: 241 pa_threaded_mainloop_signal(g_pMainLoop, 0);250 drvHostPulseAudioAbortMainLoop(); 242 251 break; 243 252 244 253 case PA_CONTEXT_FAILED: 245 254 LogRel(("PulseAudio: Audio input/output stopped!\n")); 246 pa_threaded_mainloop_signal(g_pMainLoop, 0);255 drvHostPulseAudioAbortMainLoop(); 247 256 break; 248 257 … … 288 297 case PA_STREAM_FAILED: 289 298 case PA_STREAM_TERMINATED: 290 pa_threaded_mainloop_signal(g_pMainLoop, 0 /* fWait */);299 drvHostPulseAudioAbortMainLoop(); 291 300 break; 292 301 … … 306 315 307 316 if (fSuccess) 308 { 309 pa_threaded_mainloop_signal(g_pMainLoop, 0 /* fWait */); 310 } 317 drvHostPulseAudioAbortMainLoop(); 311 318 else 312 319 drvHostPulseAudioError(pStrm->pDrv, "Failed to finish stream operation"); … … 396 403 for (;;) 397 404 { 398 pa_threaded_mainloop_wait(g_pMainLoop); 405 if (!g_fAbortMainLoop) 406 pa_threaded_mainloop_wait(g_pMainLoop); 399 407 400 408 sstate = pa_stream_get_state(pStream); … … 487 495 } 488 496 497 g_fAbortMainLoop = false; 489 498 pa_context_set_state_callback(g_pContext, drvHostPulseAudioCbCtxState, NULL); 490 499 pa_threaded_mainloop_lock(g_pMainLoop); … … 504 513 { 505 514 pa_context_state_t cstate; 506 pa_threaded_mainloop_wait(g_pMainLoop); 515 if (!g_fAbortMainLoop) 516 pa_threaded_mainloop_wait(g_pMainLoop); 507 517 508 518 cstate = pa_context_get_state(g_pContext); … … 517 527 } 518 528 } 519 529 } 530 while (0); 531 532 if (fLocked) 520 533 pa_threaded_mainloop_unlock(g_pMainLoop); 521 }522 while (0);523 534 524 535 if (RT_FAILURE(rc)) 525 536 { 526 537 if (g_pMainLoop) 527 { 528 if (fLocked) 529 pa_threaded_mainloop_unlock(g_pMainLoop); 530 531 if (g_pMainLoop) 532 pa_threaded_mainloop_stop(g_pMainLoop); 533 } 538 pa_threaded_mainloop_stop(g_pMainLoop); 534 539 535 540 if (g_pContext)
Note:
See TracChangeset
for help on using the changeset viewer.