VirtualBox

Changeset 35487 in vbox for trunk/src


Ignore:
Timestamp:
Jan 11, 2011 1:45:20 PM (14 years ago)
Author:
vboxsync
Message:

Devices/Audio: fixed fallback to nul host audio driver. Added the fallback to HDA audio device. (xTracker 5404).

Location:
trunk/src/VBox/Devices/Audio
Files:
9 edited

Legend:

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

    r35353 r35487  
    21372137}
    21382138
    2139 int codecConstruct(CODECState *pState, ENMCODEC enmCodec)
     2139int codecConstruct(PPDMDEVINS pDevIns, CODECState *pState, ENMCODEC enmCodec)
    21402140{
    21412141    audsettings_t as;
     
    22292229    codecToAudVolume(&pState->pNodes[pState->u8AdcVolsLineIn].adcvol.B_params, AUD_MIXER_LINE_IN);
    22302230
     2231#ifdef VBOX_WITH_AUDIO_FLEXIBLE_FORMAT
     2232    /* @todo If no host voices were created, then fallback to nul audio. */
     2233#else
     2234    /* If no host voices were created, then fallback to nul audio. */
     2235    if (!AUD_is_host_voice_in_ok(pState->SwVoiceIn))
     2236        LogRel (("HDA: WARNING: Unable to open PCM IN!\n"));
     2237    if (!AUD_is_host_voice_in_ok(pState->voice_mc))
     2238        LogRel (("HDA: WARNING: Unable to open PCM MC!\n"));
     2239    if (!AUD_is_host_voice_out_ok(pState->SwVoiceOut))
     2240        LogRel (("HDA: WARNING: Unable to open PCM OUT!\n"));
     2241
     2242    if (   !AUD_is_host_voice_in_ok(pState->SwVoiceIn)
     2243        && !AUD_is_host_voice_out_ok(pState->SwVoiceOut)
     2244        && !AUD_is_host_voice_in_ok(pState->voice_mc))
     2245    {
     2246        /* Was not able initialize *any* voice. Select the NULL audio driver instead */
     2247        AUD_close_in  (&pState->card, pState->SwVoiceIn);
     2248        AUD_close_out (&pState->card, pState->SwVoiceOut);
     2249        AUD_close_in  (&pState->card, pState->voice_mc);
     2250        pState->SwVoiceOut = NULL;
     2251        pState->SwVoiceIn = NULL;
     2252        pState->voice_mc = NULL;
     2253        AUD_init_null ();
     2254
     2255        PDMDevHlpVMSetRuntimeError (pDevIns, 0 /*fFlags*/, "HostAudioNotResponding",
     2256            N_ ("No audio devices could be opened. Selecting the NULL audio backend "
     2257                "with the consequence that no sound is audible"));
     2258    }
     2259    else if (   !AUD_is_host_voice_in_ok(pState->SwVoiceIn)
     2260             || !AUD_is_host_voice_out_ok(pState->SwVoiceOut)
     2261             || !AUD_is_host_voice_in_ok(pState->voice_mc))
     2262    {
     2263        char   szMissingVoices[128];
     2264        size_t len = 0;
     2265        if (!AUD_is_host_voice_in_ok(pState->SwVoiceIn))
     2266            len = RTStrPrintf (szMissingVoices, sizeof(szMissingVoices), "PCM_in");
     2267        if (!AUD_is_host_voice_out_ok(pState->SwVoiceOut))
     2268            len += RTStrPrintf (szMissingVoices + len, sizeof(szMissingVoices) - len, len ? ", PCM_out" : "PCM_out");
     2269        if (!AUD_is_host_voice_in_ok(pState->voice_mc))
     2270            len += RTStrPrintf (szMissingVoices + len, sizeof(szMissingVoices) - len, len ? ", PCM_mic" : "PCM_mic");
     2271
     2272        PDMDevHlpVMSetRuntimeError (pDevIns, 0 /*fFlags*/, "HostAudioNotResponding",
     2273            N_ ("Some audio devices (%s) could not be opened. Guest applications generating audio "
     2274                "output or depending on audio input may hang. Make sure your host audio device "
     2275                "is working properly. Check the logfile for error messages of the audio "
     2276                "subsystem"), szMissingVoices);
     2277    }
     2278#endif /* VBOX_WITH_AUDIO_FLEXIBLE_FORMAT */
     2279
    22312280    return VINF_SUCCESS;
    22322281}
  • trunk/src/VBox/Devices/Audio/DevCodec.h

    r34933 r35487  
    490490} CODECState;
    491491
    492 int codecConstruct(CODECState *pCodecState, ENMCODEC enmCodec);
     492int codecConstruct(PPDMDEVINS pDevIns, CODECState *pCodecState, ENMCODEC enmCodec);
    493493int codecDestruct(CODECState *pCodecState);
    494494int codecSaveState(CODECState *pCodecState, PSSMHANDLE pSSMHandle);
  • trunk/src/VBox/Devices/Audio/DevIchAc97.cpp

    r35353 r35487  
    16341634    ac97Reset (pDevIns);
    16351635
    1636     if (!s->voice_pi)
     1636    if (!AUD_is_host_voice_in_ok(s->voice_pi))
    16371637        LogRel (("AC97: WARNING: Unable to open PCM IN!\n"));
    1638     if (!s->voice_mc)
     1638    if (!AUD_is_host_voice_in_ok(s->voice_mc))
    16391639        LogRel (("AC97: WARNING: Unable to open PCM MC!\n"));
    1640     if (!s->voice_po)
     1640    if (!AUD_is_host_voice_out_ok(s->voice_po))
    16411641        LogRel (("AC97: WARNING: Unable to open PCM OUT!\n"));
    16421642
    1643     if (!s->voice_pi && !s->voice_po && !s->voice_mc)
     1643    if (   !AUD_is_host_voice_in_ok(s->voice_pi)
     1644        && !AUD_is_host_voice_out_ok(s->voice_po)
     1645        && !AUD_is_host_voice_in_ok(s->voice_mc))
    16441646    {
    16451647        /* Was not able initialize *any* voice. Select the NULL audio driver instead */
     
    16571659                "with the consequence that no sound is audible"));
    16581660    }
    1659     else if (!s->voice_pi || !s->voice_po || !s->voice_mc)
     1661    else if (   !AUD_is_host_voice_in_ok(s->voice_pi)
     1662             || !AUD_is_host_voice_out_ok(s->voice_po)
     1663             || !AUD_is_host_voice_in_ok(s->voice_mc))
    16601664    {
    16611665        char   szMissingVoices[128];
    16621666        size_t len = 0;
    1663         if (!s->voice_pi)
     1667        if (!AUD_is_host_voice_in_ok(s->voice_pi))
    16641668            len = RTStrPrintf (szMissingVoices, sizeof(szMissingVoices), "PCM_in");
    1665         if (!s->voice_po)
     1669        if (!AUD_is_host_voice_out_ok(s->voice_po))
    16661670            len += RTStrPrintf (szMissingVoices + len, sizeof(szMissingVoices) - len, len ? ", PCM_out" : "PCM_out");
    1667         if (!s->voice_mc)
     1671        if (!AUD_is_host_voice_in_ok(s->voice_mc))
    16681672            len += RTStrPrintf (szMissingVoices + len, sizeof(szMissingVoices) - len, len ? ", PCM_mic" : "PCM_mic");
    16691673
  • trunk/src/VBox/Devices/Audio/DevIchIntelHDA.cpp

    r35353 r35487  
    21592159
    21602160    pThis->hda.Codec.pHDAState = (void *)&pThis->hda;
    2161     rc = codecConstruct(&pThis->hda.Codec, /* ALC885_CODEC */ STAC9220_CODEC);
     2161    rc = codecConstruct(pDevIns, &pThis->hda.Codec, /* ALC885_CODEC */ STAC9220_CODEC);
    21622162    if (RT_FAILURE(rc))
    21632163        AssertRCReturn(rc, rc);
  • trunk/src/VBox/Devices/Audio/DevSB16.cpp

    r35353 r35487  
    19001900    legacy_reset(s);
    19011901
    1902     if (!s->voice)
     1902    if (!AUD_is_host_voice_out_ok(s->voice))
    19031903    {
     1904        LogRel (("SB16: WARNING: Unable to open PCM OUT!\n"));
    19041905        AUD_close_out(&s->card, s->voice);
    19051906        s->voice = NULL;
  • trunk/src/VBox/Devices/Audio/audio.c

    r35353 r35487  
    19481948{
    19491949    LogRel(("Audio: set_record_source ars=%d als=%d (not implemented)\n", *ars, *als));
     1950}
     1951
     1952int AUD_is_host_voice_in_ok(SWVoiceIn *sw)
     1953{
     1954    AudioState *s = &glob_audio_state;
     1955
     1956    if (sw == NULL) {
     1957        return 0;
     1958    }
     1959
     1960    return filteraudio_is_host_voice_in_ok(s->drv, sw->hw);
     1961}
     1962
     1963int AUD_is_host_voice_out_ok(SWVoiceOut *sw)
     1964{
     1965    AudioState *s = &glob_audio_state;
     1966
     1967    if (sw == NULL) {
     1968        return 0;
     1969    }
     1970
     1971    return filteraudio_is_host_voice_out_ok(s->drv, sw->hw);
    19501972}
    19511973
  • trunk/src/VBox/Devices/Audio/audio.h

    r6140 r35487  
    200200#endif
    201201
     202int AUD_is_host_voice_in_ok(SWVoiceIn *hw);
     203int AUD_is_host_voice_out_ok(SWVoiceOut *hw);
     204
    202205#endif  /* audio.h */
  • trunk/src/VBox/Devices/Audio/audio_int.h

    r35116 r35487  
    333333
    334334struct audio_driver *filteraudio_install(struct audio_driver *pDrv, void *pDrvOpaque);
     335int filteraudio_is_host_voice_in_ok(struct audio_driver *pDrv, HWVoiceIn *phw);
     336int filteraudio_is_host_voice_out_ok(struct audio_driver *pDrv, HWVoiceOut *phw);
    335337
    336338#endif /* audio_int.h */
  • trunk/src/VBox/Devices/Audio/filteraudio.c

    r35427 r35487  
    891891        filter_conf.pDrv->fini(opaque);
    892892        filter_conf.pDrv = NULL;
     893        filter_conf.pDrvOpaque = NULL;
    893894    }
    894895}
     
    944945    return &filteraudio_audio_driver;
    945946}
     947
     948int filteraudio_is_host_voice_in_ok(struct audio_driver *pDrv, HWVoiceIn *phw)
     949{
     950    filterVoiceIn *pVoice;
     951
     952    if (pDrv != &filteraudio_audio_driver)
     953    {
     954        /* This is not the driver for which the filter was installed.
     955         * The filter has no idea and assumes that if the voice
     956         * is not NULL then it is a valid host voice.
     957         */
     958        return (phw != NULL);
     959    }
     960
     961    if (!filter_conf.pDrv)
     962    {
     963        AssertFailed();
     964        return (phw != NULL);
     965    }
     966
     967    pVoice = (filterVoiceIn *)((uint8_t *)phw + filter_conf.pDrv->voice_size_in);
     968
     969    return pVoice->fHostOK;
     970}
     971
     972int filteraudio_is_host_voice_out_ok(struct audio_driver *pDrv, HWVoiceOut *phw)
     973{
     974    /* Output is not yet implemented and there are no filter voices.
     975     * The filter has no idea and assumes that if the voice
     976     * is not NULL then it is a valid host voice.
     977     *
     978     * @todo: similar to filteraudio_is_host_voice_in_ok
     979     */
     980    NOREF(pDrv);
     981    return (phw != NULL);
     982}
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