VirtualBox

Ignore:
Timestamp:
Oct 19, 2021 2:44:02 PM (3 years ago)
Author:
vboxsync
Message:

Audio/VKAT: Fixes for audioTestDriverStackStreamDestroy(). ​bugref:10008

Location:
trunk/src/VBox/ValidationKit/utils/audio
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/utils/audio/vkatCmdGeneric.cpp

    r91632 r91842  
    385385                }
    386386                audioTestDriverStackStreamDestroy(&DrvStack, pStream);
     387                pStream = NULL;
    387388            }
    388389            else
     
    494495                }
    495496                audioTestDriverStackStreamDestroy(&DrvStack, TstStream.pStream);
     497                TstStream.pStream = NULL;
    496498            }
    497499            else
     
    889891                }
    890892                audioTestDriverStackStreamDestroy(&DrvStack, pStream);
     893                pStream = NULL;
    891894            }
    892895            else
  • trunk/src/VBox/ValidationKit/utils/audio/vkatDriverStack.cpp

    r91824 r91842  
    885885/**
    886886 * Destroys a stream.
     887 *
     888 * @param   pDrvStack           Driver stack the stream to destroy is assigned to.
     889 * @param   pStream             Stream to destroy. Pointer will be NULL (invalid) after successful return.
    887890 */
    888891void audioTestDriverStackStreamDestroy(PAUDIOTESTDRVSTACK pDrvStack, PPDMAUDIOSTREAM pStream)
    889892{
    890     if (pStream)
    891     {
    892         if (pDrvStack->pIAudioConnector)
    893         {
    894             RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Destroying stream '%s' (IAudioConnector) ...\n", pStream->Cfg.szName);
    895             int rc = pDrvStack->pIAudioConnector->pfnStreamDestroy(pDrvStack->pIAudioConnector, pStream, true /*fImmediate*/);
    896             if (RT_FAILURE(rc))
    897                 RTTestFailed(g_hTest, "pfnStreamDestroy failed: %Rrc", rc);
     893    if (!pStream)
     894        return;
     895
     896    if (pDrvStack->pIAudioConnector)
     897    {
     898        RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Destroying stream '%s' (IAudioConnector) ...\n", pStream->Cfg.szName);
     899        int rc = pDrvStack->pIAudioConnector->pfnStreamDestroy(pDrvStack->pIAudioConnector, pStream, true /*fImmediate*/);
     900        if (RT_FAILURE(rc))
     901            RTTestFailed(g_hTest, "pfnStreamDestroy failed: %Rrc", rc);
     902    }
     903    else
     904    {
     905        RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Destroying stream '%s' (IHostAudio) ...\n", pStream->Cfg.szName);
     906        PAUDIOTESTDRVSTACKSTREAM pStreamAt = (PAUDIOTESTDRVSTACKSTREAM)pStream;
     907        int rc = pDrvStack->pIHostAudio->pfnStreamDestroy(pDrvStack->pIHostAudio, &pStreamAt->Backend, true /*fImmediate*/);
     908        if (RT_SUCCESS(rc))
     909        {
     910            pStreamAt->Core.uMagic    = ~PDMAUDIOSTREAM_MAGIC;
     911            pStreamAt->Backend.uMagic = ~PDMAUDIOBACKENDSTREAM_MAGIC;
     912
     913            RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Destroying stream '%s' done\n", pStream->Cfg.szName);
     914
     915            RTMemFree(pStreamAt);
     916
     917            pStreamAt = NULL;
     918            pStream   = NULL;
    898919        }
    899920        else
    900         {
    901             RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Destroying stream '%s' (IHostAudio) ...\n", pStream->Cfg.szName);
    902             PAUDIOTESTDRVSTACKSTREAM pStreamAt = (PAUDIOTESTDRVSTACKSTREAM)pStream;
    903             int rc = pDrvStack->pIHostAudio->pfnStreamDestroy(pDrvStack->pIHostAudio, &pStreamAt->Backend, true /*fImmediate*/);
    904             if (RT_SUCCESS(rc))
    905             {
    906                 pStreamAt->Core.uMagic    = ~PDMAUDIOSTREAM_MAGIC;
    907                 pStreamAt->Backend.uMagic = ~PDMAUDIOBACKENDSTREAM_MAGIC;
    908                 RTMemFree(pStreamAt);
    909             }
    910             else
    911                 RTTestFailed(g_hTest, "PDMIHOSTAUDIO::pfnStreamDestroy failed: %Rrc", rc);
    912         }
    913 
    914         RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Destroying stream '%s' done\n", pStream->Cfg.szName);
     921            RTTestFailed(g_hTest, "PDMIHOSTAUDIO::pfnStreamDestroy failed: %Rrc", rc);
    915922    }
    916923}
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