VirtualBox

Changeset 91647 in vbox


Ignore:
Timestamp:
Oct 8, 2021 6:48:43 PM (3 years ago)
Author:
vboxsync
Message:

Audio/Validation Kit: Added a VBOX_WITH_AUDIO_VALKIT_DUMP_STREAMS define for dumping output audio streams to disks to the Validation Kit audio driver. ​bugref:10008

File:
1 edited

Legend:

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

    r91532 r91647  
    3939
    4040
     41#ifdef DEBUG_andy
     42/** Enables dumping audio streams to the temporary directory for debugging. */
     43# define VBOX_WITH_AUDIO_VALKIT_DUMP_STREAMS
     44#endif
     45
     46
    4147/*********************************************************************************************************************************
    4248*   Structures and Typedefs                                                                                                      *
     
    5359    /** How much bytes are available to read (only for capturing streams). */
    5460    uint32_t                cbAvail;
     61#ifdef VBOX_WITH_AUDIO_VALKIT_DUMP_STREAMS
     62    /** Audio file to dump output to. */
     63    PAUDIOHLPFILE           pFile;
     64#endif
    5565} VALKITAUDIOSTREAM;
    5666/** Pointer to a Validation Kit stream. */
     
    670680    int rc = VINF_SUCCESS;
    671681    PDMAudioStrmCfgCopy(&pStreamDbg->Cfg, pCfgAcq);
     682
     683#ifdef VBOX_WITH_AUDIO_VALKIT_DUMP_STREAMS
     684    int rc2 = AudioHlpFileCreateAndOpenEx(&pStreamDbg->pFile, AUDIOHLPFILETYPE_WAV, NULL /*use temp dir*/,
     685                                          pThis->pDrvIns->iInstance, AUDIOHLPFILENAME_FLAGS_NONE, AUDIOHLPFILE_FLAGS_NONE,
     686                                          &pCfgReq->Props, RTFILE_O_WRITE | RTFILE_O_DENY_WRITE | RTFILE_O_CREATE_REPLACE,
     687                                          pCfgReq->enmDir == PDMAUDIODIR_IN ? "ValKitAudioIn" : "ValKitAudioOut");
     688    if (RT_FAILURE(rc2))
     689        LogRel(("ValKit: Failed to creating debug file for %s stream '%s' in the temp directory: %Rrc\n",
     690                pCfgReq->enmDir == PDMAUDIODIR_IN ? "input" : "output", pCfgReq->szName, rc2));
     691#endif
     692
    672693    return rc;
    673694}
     
    682703    PVALKITAUDIOSTREAM  pStreamDbg = (PVALKITAUDIOSTREAM)pStream;
    683704    AssertPtrReturn(pStreamDbg, VERR_INVALID_POINTER);
     705
     706#ifdef VBOX_WITH_AUDIO_VALKIT_DUMP_STREAMS
     707    if (pStreamDbg->pFile)
     708    {
     709        AudioHlpFileDestroy(pStreamDbg->pFile);
     710        pStreamDbg->pFile = NULL;
     711    }
     712#endif
    684713
    685714    return VINF_SUCCESS;
     
    858887    PVALKITTESTDATA     pTst  = NULL;
    859888
     889    int rc2;
     890#ifdef VBOX_WITH_AUDIO_VALKIT_DUMP_STREAMS
     891    PVALKITAUDIOSTREAM  pStrmValKit = (PVALKITAUDIOSTREAM)pStream;
     892    rc2 = AudioHlpFileWrite(pStrmValKit->pFile, pvBuf, cbBuf);
     893    AssertRC(rc2);
     894#endif
     895
    860896    bool const fIsSilence = PDMAudioPropsIsBufferSilence(&pStream->pStream->Cfg.Props, pvBuf, cbBuf);
    861897
     
    879915        pTst = pThis->pTestCurPlay;
    880916
    881         int rc2 = RTCritSectLeave(&pThis->CritSect);
     917        rc2 = RTCritSectLeave(&pThis->CritSect);
    882918        AssertRC(rc2);
    883919    }
     
    9701006                    pTst                = NULL;
    9711007
    972                     int rc2 = RTCritSectLeave(&pThis->CritSect);
     1008                    rc2 = RTCritSectLeave(&pThis->CritSect);
    9731009                    if (RT_SUCCESS(rc))
    9741010                        rc = rc2;
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