VirtualBox

Changeset 86494 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Oct 8, 2020 11:23:03 AM (4 years ago)
Author:
vboxsync
Message:

Devices/Audio: Re-initialize the stream in drvAudioStreamGetStatus() when scheduled or it will never be initialized due to the audio mixer skipping everything when the returned status doesn't indicate a ready stream, ticketref:18594, bugref:8658 comment 11

File:
1 edited

Legend:

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

    r82987 r86494  
    817817        if (RT_SUCCESS(rc))
    818818        {
    819             rc = drvAudioStreamCreateInternalBackend(pThis, pStream, &pStream->Host.Cfg, NULL /* pCfgAcq */);
     819            PDMAUDIOSTREAMCFG CfgHostAcq;
     820            rc = drvAudioStreamCreateInternalBackend(pThis, pStream, &pStream->Host.Cfg, &CfgHostAcq);
    820821            /** @todo Validate (re-)acquired configuration with pStream->Host.Cfg? */
     822            if (RT_SUCCESS(rc))
     823            {
     824#ifdef LOG_ENABLED
     825                LogFunc(("[%s] Acquired host format:\n",  pStream->szName));
     826                DrvAudioHlpStreamCfgPrint(&CfgHostAcq);
     827#endif
     828            }
    821829        }
    822830    }
     
    11131121
    11141122/**
     1123 * Re-initializes the given stream if it is scheduled for this operation.
     1124 *
     1125 * @returns VBox status code.
     1126 * @param   pThis               Pointer to driver instance.
     1127 * @param   pStream             Stream to check and maybe re-initialize.
     1128 */
     1129static int drvAudioStreamMaybeReInit(PDRVAUDIO pThis, PPDMAUDIOSTREAM pStream)
     1130{
     1131    int rc = VINF_SUCCESS;
     1132
     1133    if (pStream->fStatus & PDMAUDIOSTREAMSTS_FLAGS_PENDING_REINIT)
     1134    {
     1135#ifdef VBOX_WITH_AUDIO_ENUM
     1136        if (pThis->fEnumerateDevices)
     1137        {
     1138            /* Re-enumerate all host devices. */
     1139            drvAudioDevicesEnumerateInternal(pThis, true /* fLog */, NULL /* pDevEnum */);
     1140
     1141            pThis->fEnumerateDevices = false;
     1142        }
     1143#endif /* VBOX_WITH_AUDIO_ENUM */
     1144
     1145        /* Remove the pending re-init flag in any case, regardless whether the actual re-initialization succeeded
     1146         * or not. If it failed, the backend needs to notify us again to try again at some later point in time. */
     1147        pStream->fStatus &= ~PDMAUDIOSTREAMSTS_FLAGS_PENDING_REINIT;
     1148        rc = drvAudioStreamReInitInternal(pThis, pStream);
     1149    }
     1150
     1151    return rc;
     1152}
     1153
     1154/**
    11151155 * Does one iteration of an audio stream.
    11161156 * This function gives the backend the chance of iterating / altering data and
     
    11311171        return VINF_SUCCESS;
    11321172
    1133     int rc;
    1134 
    11351173    /* Is the stream scheduled for re-initialization? Do so now. */
    1136     if (pStream->fStatus & PDMAUDIOSTREAMSTS_FLAGS_PENDING_REINIT)
    1137     {
    1138 #ifdef VBOX_WITH_AUDIO_ENUM
    1139         if (pThis->fEnumerateDevices)
    1140         {
    1141             /* Re-enumerate all host devices. */
    1142             drvAudioDevicesEnumerateInternal(pThis, true /* fLog */, NULL /* pDevEnum */);
    1143 
    1144             pThis->fEnumerateDevices = false;
    1145         }
    1146 #endif /* VBOX_WITH_AUDIO_ENUM */
    1147 
    1148         /* Remove the pending re-init flag in any case, regardless whether the actual re-initialization succeeded
    1149          * or not. If it failed, the backend needs to notify us again to try again at some later point in time. */
    1150         pStream->fStatus &= ~PDMAUDIOSTREAMSTS_FLAGS_PENDING_REINIT;
    1151 
    1152         rc = drvAudioStreamReInitInternal(pThis, pStream);
    1153         if (RT_FAILURE(rc))
    1154             return rc;
    1155     }
     1174    int rc = drvAudioStreamMaybeReInit(pThis, pStream);
     1175    if (RT_FAILURE(rc))
     1176        return rc;
    11561177
    11571178#ifdef LOG_ENABLED
     
    28932914    int rc2 = RTCritSectEnter(&pThis->CritSect);
    28942915    AssertRC(rc2);
     2916
     2917    /* Is the stream scheduled for re-initialization? Do so now. */
     2918    int rc = drvAudioStreamMaybeReInit(pThis, pStream);
     2919    if (RT_FAILURE(rc)) /** @todo r=aeichner What is the correct operation in the failure case? */
     2920        LogRel(("Audio: Reinitializing the stream in drvAudioStreamGetStatus() failed with %Rrc\n", rc));
    28952921
    28962922    PDMAUDIOSTREAMSTS fStrmStatus = pStream->fStatus;
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