VirtualBox

Changeset 89519 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jun 4, 2021 10:51:37 PM (4 years ago)
Author:
vboxsync
Message:

DrvHostAudioOss: Adjusted the drvHstAudOssHA_StreamGetReadable hack as it didn't take pre-buffering into account. bugref:9890

File:
1 edited

Legend:

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

    r89518 r89519  
    838838
    839839    /*
    840      * HACK ALERT! Tweak to force recording to start.  Pretend there are bytes
    841      *             available if we haven't read anything yet.  This will cause
    842      *             the following StreamCapture call to block and make sure the
    843      *             stream is really recording.
     840     * HACK ALERT! To force the stream to start recording, we read a frame
     841     *             here if we get back that there are zero bytes available
     842     *             and we're at the start of the stream.  (We cannot just
     843     *             return a frame size, we have to read it, as pre-buffering
     844     *             would prevent it from being read.)
    844845     */
    845846    if (BufInfo.bytes > 0 || pStreamOSS->offInternal != 0)
    846847    { /* likely */ }
    847848    else
    848         cbRet = PDMAudioPropsFramesToBytes(&pStreamOSS->Cfg.Props, 1);
     849    {
     850        uint32_t cbToRead = PDMAudioPropsFramesToBytes(&pStreamOSS->Cfg.Props, 1);
     851        uint8_t  abFrame[256];
     852        Assert(cbToRead < sizeof(abFrame));
     853        ssize_t  cbRead = read(pStreamOSS->hFile, abFrame, cbToRead);
     854        RT_NOREF(cbRead);
     855        LogFunc(("Dummy read for '%s' returns %zd (errno=%d)\n", pStreamOSS->Cfg.szName, cbRead, errno));
     856    }
    849857
    850858    Log4Func(("returns %#x (%u) [cbBuf=%#x]\n", cbRet, cbRet, cbBuf));
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