VirtualBox

Changeset 89415 in vbox


Ignore:
Timestamp:
May 31, 2021 8:31:47 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
144768
Message:

Audio: Removed PDMAUDIOFRAME. bugref:9890

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vmm/pdmaudioifs.h

    r89414 r89415  
    419419
    420420/**
    421  * A single audio frame.
    422  *
    423  * Currently only two (2) channels, left and right, are supported.
    424  *
    425  * @note When changing this structure, make sure to also handle
    426  *       VRDP's input / output processing in DrvAudioVRDE, as VRDP
    427  *       expects audio data in st_sample_t format (historical reasons)
    428  *       which happens to be the same as PDMAUDIOFRAME for now.
    429  *
    430  * @todo r=bird: This is an internal AudioMixBuffer structure which should not
    431  *       be exposed here, I think.  Only used to some sizeof statements in VRDE.
    432  *       (The problem with exposing it, is that we would like to move away from
    433  *       stereo and instead to anything from 1 to 16 channels.  That means
    434  *       removing this structure entirely.)
    435  */
    436 typedef struct PDMAUDIOFRAME
    437 {
    438     /** Left channel. */
    439     int64_t         i64LSample;
    440     /** Right channel. */
    441     int64_t         i64RSample;
    442 } PDMAUDIOFRAME;
    443 /** Pointer to a single (stereo) audio frame. */
    444 typedef PDMAUDIOFRAME *PPDMAUDIOFRAME;
    445 /** Pointer to a const single (stereo) audio frame. */
    446 typedef PDMAUDIOFRAME const *PCPDMAUDIOFRAME;
    447 
    448 
    449 /**
    450421 * Audio path: input sources and playback destinations.
    451422 *
     
    912883     *  See PDMAUDIOSTREAM_WARN_FLAGS_XXX. */
    913884    uint32_t                fWarningsShown;
    914     /** The stream properties (both sides when PDMAUDIOSTREAM_CREATE_F_NO_MIXBUF
    915      * is used, otherwise the guest side). */
     885    /** The stream properties. */
    916886    PDMAUDIOPCMPROPS        Props;
    917887
  • trunk/src/VBox/Main/src-client/DrvAudioVRDE.cpp

    r89379 r89415  
    8484/** Pointer to the instance data for an VRDE audio driver. */
    8585typedef DRVAUDIOVRDE *PDRVAUDIOVRDE;
    86 
    87 /* Sanity. */
    88 AssertCompileSize(PDMAUDIOFRAME, sizeof(int64_t) * 2 /* st_sample_t using by VRDP server */);
    89 
    9086
    9187
     
    588584    /** @todo Find some sane value here. We probably need a VRDE API VRDE to specify this. */
    589585    if (pDrv->cClients)
    590         return _16K * sizeof(PDMAUDIOFRAME);
     586        return _16K * sizeof(int64_t) * 2;
    591587    return 0;
    592588}
     
    631627    Assert(uVrdpFormat == VRDE_AUDIO_FMT_MAKE(PDMAudioPropsHz(pProps), 2, 64, true));
    632628
    633     /* We specified PDMAUDIOSTREAMLAYOUT_RAW (== S64), so
    634        convert the buffer pointe and size accordingly:  */
    635     PCPDMAUDIOFRAME paSampleBuf    = (PCPDMAUDIOFRAME)pvBuf;
    636     uint32_t const  cFramesToWrite = cbBuf / sizeof(paSampleBuf[0]);
    637     Assert(cFramesToWrite * sizeof(paSampleBuf[0]) == cbBuf);
    638 
    639629    /** @todo r=bird: there was some incoherent mumbling about "using the
    640630     *        internal counter to track if we (still) can write to the VRDP
     
    643633     *        sensible, so I've removed it. */
    644634
    645     /*
    646      * Call the VRDP server with the data.
    647      */
    648     uint32_t cFramesWritten = 0;
    649     while (cFramesWritten < cFramesToWrite)
    650     {
    651         uint32_t const cFramesChunk = cFramesToWrite - cFramesWritten; /** @todo For now write all at once. */
    652 
    653         /* Note: The VRDP server expects int64_t samples per channel, regardless
    654                  of the actual  sample bits (e.g 8 or 16 bits). */
    655         pDrv->pConsoleVRDPServer->SendAudioSamples(&paSampleBuf[cFramesWritten], cFramesChunk /* Frames */, uVrdpFormat);
    656 
    657         cFramesWritten += cFramesChunk;
    658     }
    659 
    660     Log3Func(("cFramesWritten=%RU32\n", cFramesWritten));
    661     *pcbWritten = cFramesWritten * sizeof(PDMAUDIOFRAME);
     635    uint32_t cFrames = PDMAudioPropsBytesToFrames(&pStream->pStream->Props, cbBuf);
     636    Assert(cFrames == cbBuf / (sizeof(uint64_t) * 2));
     637    pDrv->pConsoleVRDPServer->SendAudioSamples(pvBuf, cFrames, uVrdpFormat);
     638
     639    Log3Func(("cFramesWritten=%RU32\n", cFrames));
     640    *pcbWritten = PDMAudioPropsFramesToBytes(&pStream->pStream->Props, cFrames);
     641    Assert(*pcbWritten == cbBuf);
    662642    return VINF_SUCCESS;
    663643}
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