VirtualBox

Changeset 58590 in vbox


Ignore:
Timestamp:
Nov 5, 2015 4:54:55 PM (9 years ago)
Author:
vboxsync
Message:

Audio/PulseAudio: fix for r103940

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Audio/DrvHostPulseAudio.cpp

    r58582 r58590  
    216216    {
    217217        uint64_t u64StartMs = RTTimeMilliTS();
    218         uint64_t u64ElapsedMs;
    219 
    220218        while (pa_operation_get_state(pOP) == PA_OPERATION_RUNNING)
    221219        {
    222             pa_threaded_mainloop_wait(g_pMainLoop);
    223 
    224             u64ElapsedMs = RTTimeMilliTS() - u64StartMs;
     220            if (!g_fAbortMainLoop)
     221                pa_threaded_mainloop_wait(g_pMainLoop);
     222            g_fAbortMainLoop = false;
     223
     224            uint64_t u64ElapsedMs = RTTimeMilliTS() - u64StartMs;
    225225            if (u64ElapsedMs >= cMsTimeout)
    226226            {
     
    317317        drvHostPulseAudioAbortMainLoop();
    318318    else
    319          drvHostPulseAudioError(pStrm->pDrv, "Failed to finish stream operation");
     319        drvHostPulseAudioError(pStrm->pDrv, "Failed to finish stream operation");
    320320}
    321321
     
    400400
    401401        /* Wait until the stream is ready. */
    402         pa_stream_state_t sstate;
    403402        for (;;)
    404403        {
    405404            if (!g_fAbortMainLoop)
    406405                pa_threaded_mainloop_wait(g_pMainLoop);
    407 
    408             sstate = pa_stream_get_state(pStream);
     406            g_fAbortMainLoop = false;
     407
     408            pa_stream_state_t sstate = pa_stream_get_state(pStream);
    409409            if (sstate == PA_STREAM_READY)
    410410                break;
     
    433433                     pBufAttr->maxlength, pBufAttr->tlength, pBufAttr->prebuf, pBufAttr->minreq));
    434434
    435         pa_threaded_mainloop_unlock(g_pMainLoop);
    436435    }
    437436    while (0);
    438437
     438    if (   RT_FAILURE(rc)
     439        && pStream)
     440        pa_stream_disconnect(pStream);
     441
     442    pa_threaded_mainloop_unlock(g_pMainLoop);
     443
    439444    if (RT_FAILURE(rc))
    440445    {
    441         if (pStream)
    442             pa_stream_disconnect(pStream);
    443 
    444         pa_threaded_mainloop_unlock(g_pMainLoop);
    445 
    446446        if (pStream)
    447447            pa_stream_unref(pStream);
     
    512512        for (;;)
    513513        {
    514             pa_context_state_t cstate;
    515514            if (!g_fAbortMainLoop)
    516515                pa_threaded_mainloop_wait(g_pMainLoop);
    517 
    518             cstate = pa_context_get_state(g_pContext);
     516            g_fAbortMainLoop = false;
     517
     518            pa_context_state_t cstate = pa_context_get_state(g_pContext);
    519519            if (cstate == PA_CONTEXT_READY)
    520520                break;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette