VirtualBox

Changeset 88433 in vbox for trunk/include/VBox/vmm


Ignore:
Timestamp:
Apr 9, 2021 12:55:19 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
143685
Message:

Audio: Eliminated the DrvAudio mixing buffers for output streams on devices without their own mixer. Changed the prebuffering to not default to the whole backend buffer size, but only 2/3 of it, so that there is room for a bit of incoming data from the device once we start playing. We don't want to have that gather in the device mixer or internal DMA buffers. This code needs some more testing and work, only tested on linux against ALSA. bugref:9890

File:
1 edited

Legend:

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

    r88412 r88433  
    845845    /** Invalid zero value as per usual (guards against using unintialized values). */
    846846    PDMAUDIOSTREAMCMD_INVALID = 0,
    847     /** Unknown command, do not use. */
     847    /** Unknown command, do not use.
     848     * @todo r=bird: WTF is this supposed to be?  Is DrvAudio or a device
     849     *       supposed to issue an unknown command to someone?  For conversion
     850     *       mismatches (e.g. mixer), you use the INVALID value. */
    848851    PDMAUDIOSTREAMCMD_UNKNOWN,
    849852    /** Enables the stream. */
     
    854857     *  any new audio input data afterwards. */
    855858    PDMAUDIOSTREAMCMD_DISABLE,
    856     /** Pauses the stream. */
     859    /** Pauses the stream.
     860     * This is currently only issued when the VM is suspended (paused). */
    857861    PDMAUDIOSTREAMCMD_PAUSE,
    858     /** Resumes the stream. */
     862    /** Resumes the stream.
     863     *This is currently only issued when the VM is resumed. */
    859864    PDMAUDIOSTREAMCMD_RESUME,
    860     /** Tells the stream to drain itself.
    861      *  For output streams this plays all remaining (buffered) audio frames,
    862      *  for input streams this permits receiving any new audio frames.
    863      *  No supported by all backends. */
     865    /** Drain the stream, that is, play what's in the buffer and then stop.
     866     * The effect on input streams amounts to a stop.
     867     *
     868     * A separate DISABLE command will be issued to disable the stream.
     869     *
     870     * @note This should not wait for the stream to finish draining, just change the
     871     *       state.  (EMT cannot wait hundreds of milliseconds of
     872     *       buffer to finish draining.)
     873     * @note No supported by all backends. */
    864874    PDMAUDIOSTREAMCMD_DRAIN,
    865875    /** Tells the stream to drop all (buffered) audio data immediately.
     
    980990     *  See PDMAUDIOSTREAM_WARN_FLAGS_XXX. */
    981991    uint32_t                fWarningsShown;
     992    /** The stream properties (both sides when PDMAUDIOSTREAM_CREATE_F_NO_MIXBUF
     993     * is used, otherwise the guest side). */
     994    PDMAUDIOPCMPROPS        Props;
    982995
    983996    /** Name of this stream. */
     
    9901003
    9911004/** Magic value for PDMAUDIOSTREAM. */
    992 #define PDMAUDIOSTREAM_MAGIC    PDM_VERSION_MAKE(0xa0d3, 2, 0)
     1005#define PDMAUDIOSTREAM_MAGIC    PDM_VERSION_MAKE(0xa0d3, 3, 0)
    9931006
    9941007
     
    12981311
    12991312    /**
    1300      * Returns the amount which is pending (in other words has not yet been processed) by/from the backend yet.
    1301      * Optional.
    1302      *
    1303      * For input streams this is read audio data by the backend which has not been processed by the host yet.
    1304      * For output streams this is written audio data to the backend which has not been processed by the backend yet.
    1305      *
    1306      * @returns For non-raw layout streams: Number of pending bytes.
    1307      *          for raw layout streams    : Number of pending audio frames.
    1308      * @param   pInterface          Pointer to the interface structure containing the called function pointer.
     1313     * Returns the number of buffered bytes that hasn't been played yet.
     1314     *
     1315     * This function is used by DrvAudio to detect when it is appropriate to fully
     1316     * disable an output stream w/o cutting off the playback too early.  The backend
     1317     * should have already received the PDMAUDIOSTREAMCMD_DRAIN command prior to
     1318     * this.  It doesn't really matter whether the returned value is 100% correct,
     1319     * as long as it isn't reported as zero too early.
     1320     *
     1321     * Shoul return zero if called on an input stream.
     1322     *
     1323     * @returns Number of pending bytes.
     1324     * @param   pInterface          Pointer to this interface.
    13091325     * @param   pStream             Pointer to audio stream.
    13101326     */
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette