VirtualBox

Changeset 89737 in vbox


Ignore:
Timestamp:
Jun 16, 2021 8:40:21 AM (3 years ago)
Author:
vboxsync
Message:

DevIchAc97: Moved the AIO job re-registration to ichac97R3StreamSetUp where it can more easily be skipped if nothing changed. bugref:9890

File:
1 edited

Legend:

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

    r89736 r89737  
    21582158
    21592159    LogFlowFunc(("Stream %u: uTimerHz: %u -> %u; cMsSchedulingHint: %u -> %u; cbCircBuf: %#zx -> %#x (%u ms, cMsDmaMinBuf=%u)%s\n",
    2160                  pStreamCC->State.uTimerHz, uTimerHz, Cfg.Device.cMsSchedulingHint, cMsSchedulingHint,
     2160                 pStreamCC->State.uTimerHz, uTimerHz, pStreamCC->State.Cfg.Device.cMsSchedulingHint, cMsSchedulingHint,
    21612161                 pStreamCC->State.pCircBuf ? RTCircBufSize(pStreamCC->State.pCircBuf) : 0, cbCircBuf, cMsCircBuf, cMsDmaMinBuf,
    21622162                 !pStreamCC->State.pCircBuf || RTCircBufSize(pStreamCC->State.pCircBuf) != cbCircBuf  ? " - re-creating DMA buffer" : ""));
    21632163
    21642164    /*
    2165      * Set the stream's timer rate and scheduling hint.
     2165     * Update the stream's timer rate and scheduling hint, re-registering the AIO
     2166     * update job if necessary.
    21662167     */
     2168    if (   pStreamCC->State.Cfg.Device.cMsSchedulingHint != cMsSchedulingHint
     2169        || !pStreamCC->State.fRegisteredAsyncUpdateJob)
     2170    {
     2171        if (pStreamCC->State.fRegisteredAsyncUpdateJob)
     2172            AudioMixerSinkRemoveUpdateJob(pMixSink, ichac97R3StreamUpdateAsyncIoJob, pStreamCC);
     2173        int rc2 = AudioMixerSinkAddUpdateJob(pMixSink, ichac97R3StreamUpdateAsyncIoJob, pStreamCC,
     2174                                             pStreamCC->State.Cfg.Device.cMsSchedulingHint);
     2175        AssertRC(rc2);
     2176        pStreamCC->State.fRegisteredAsyncUpdateJob = RT_SUCCESS(rc2) || rc2 == VERR_ALREADY_EXISTS;
     2177    }
     2178
    21672179    pStreamCC->State.uTimerHz    = uTimerHz;
    21682180    Cfg.Device.cMsSchedulingHint = cMsSchedulingHint;
     
    22812293
    22822294    int rc = VINF_SUCCESS;
     2295    /*
     2296     * Enable.
     2297     */
    22832298    if (fEnable)
    22842299    {
     
    22882303        /* (Re-)Open the stream if necessary. */
    22892304        rc = ichac97R3StreamSetUp(pDevIns, pThis, pThisCC, pStream, pStreamCC, false /* fForce */);
    2290 
    2291         /* Re-register the update job with the AIO thread with correct sched hint.
    2292            Note! We do not unregister it on disable because of draining. */
    2293         if (pStreamCC->State.fRegisteredAsyncUpdateJob)
    2294             AudioMixerSinkRemoveUpdateJob(pSink, ichac97R3StreamUpdateAsyncIoJob, pStreamCC);
    2295         int rc2 = AudioMixerSinkAddUpdateJob(pSink, ichac97R3StreamUpdateAsyncIoJob, pStreamCC,
    2296                                              pStreamCC->State.Cfg.Device.cMsSchedulingHint);
    2297         AssertRC(rc2);
    2298         pStreamCC->State.fRegisteredAsyncUpdateJob = RT_SUCCESS(rc2) || rc2 == VERR_ALREADY_EXISTS;
    2299 
    2300         /* Open debug files: */
    2301         if (RT_LIKELY(!pStreamCC->Dbg.Runtime.fEnabled))
    2302         { /* likely */ }
    2303         else
     2305        if (RT_SUCCESS(rc))
    23042306        {
    2305             if (!AudioHlpFileIsOpen(pStreamCC->Dbg.Runtime.pFileStream))
     2307            /*
     2308             * Open debug files.
     2309             */
     2310            if (RT_LIKELY(!pStreamCC->Dbg.Runtime.fEnabled))
     2311            { /* likely */ }
     2312            else
    23062313            {
    2307                 rc2 = AudioHlpFileOpen(pStreamCC->Dbg.Runtime.pFileStream, AUDIOHLPFILE_DEFAULT_OPEN_FLAGS,
    2308                                        &pStreamCC->State.Cfg.Props);
    2309                 AssertRC(rc2);
     2314                if (!AudioHlpFileIsOpen(pStreamCC->Dbg.Runtime.pFileStream))
     2315                    AudioHlpFileOpen(pStreamCC->Dbg.Runtime.pFileStream, AUDIOHLPFILE_DEFAULT_OPEN_FLAGS,
     2316                                     &pStreamCC->State.Cfg.Props);
     2317                if (!AudioHlpFileIsOpen(pStreamCC->Dbg.Runtime.pFileDMA))
     2318                    AudioHlpFileOpen(pStreamCC->Dbg.Runtime.pFileDMA, AUDIOHLPFILE_DEFAULT_OPEN_FLAGS,
     2319                                     &pStreamCC->State.Cfg.Props);
    23102320            }
    23112321
    2312             if (!AudioHlpFileIsOpen(pStreamCC->Dbg.Runtime.pFileDMA))
    2313             {
    2314                 rc2 = AudioHlpFileOpen(pStreamCC->Dbg.Runtime.pFileDMA, AUDIOHLPFILE_DEFAULT_OPEN_FLAGS,
    2315                                        &pStreamCC->State.Cfg.Props);
    2316                 AssertRC(rc2);
    2317             }
     2322            /*
     2323             * Do the actual enabling.
     2324             */
     2325            rc = AudioMixerSinkStart(pSink);
    23182326        }
    2319 
    2320         if (RT_SUCCESS(rc))
    2321             rc = AudioMixerSinkStart(pSink);
    2322     }
     2327    }
     2328    /*
     2329     * Disable
     2330     */
    23232331    else
    23242332    {
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