VirtualBox

Changeset 68452 in vbox


Ignore:
Timestamp:
Aug 17, 2017 7:57:56 PM (7 years ago)
Author:
vboxsync
Message:

Main/DrvAudioVideoRec: Also set the bits per sample, logging.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-client/DrvAudioVideoRec.cpp

    r68338 r68452  
    149149            /** Time (in ms) an (encoded) frame takes.
    150150             *
    151              *  For Opus, valid frame size are:
     151             *  For Opus, valid frame sizes are:
    152152             *  ms           Frame size
    153153             *  2.5          120
     
    233233{
    234234    uint32_t uHz       = pCodecParms->uHz;
    235     uint8_t  cBits     = 16; /** @ŧodo Make this configurable? */
     235    uint8_t  cBits     = pCodecParms->cBits;
    236236    uint8_t  cChannels = pCodecParms->cChannels;
    237237    uint32_t uBitrate  = pCodecParms->uBitrate;
     
    297297                    {
    298298                        /** @todo Add sink name / number to file name. */
    299 
    300                         LogRel2(("VideoRec: Recording audio to file '%s'\n", szFile));
    301299
    302300                        pSink->Con.WebM.pWebM = new WebMWriter();
     
    534532
    535533    AVRECCONTAINERPARMS ContainerParms;
    536     ContainerParms.enmType = AVRECCONTAINERTYPE_WEBM; /** @todo Make this configurable. */
     534    ContainerParms.enmType = AVRECCONTAINERTYPE_MAIN_CONSOLE; /** @todo Make this configurable. */
    537535
    538536    AVRECCODECPARMS CodecParms;
    539537    CodecParms.uHz       = AVREC_OPUS_HZ_MAX;  /** @todo Make this configurable. */
    540538    CodecParms.cChannels = 2;                  /** @todo Make this configurable. */
     539    CodecParms.cBits     = 16;                 /** @todo Make this configurable. */
    541540    CodecParms.uBitrate  = 196000;             /** @todo Make this configurable. */
    542541
     
    637636    const uint32_t cbFrame = csFrame * pSink->Codec.Parms.cChannels * (pSink->Codec.Parms.cBits / 8 /* Bytes */);
    638637
     638    /* Only encode data if we have data for the given time period (or more). */
    639639    while (RTCircBufUsed(pCircBuf) >= cbFrame)
    640640    {
     
    686686# ifdef VBOX_WITH_STATISTICS
    687687            /* Get overall frames encoded. */
    688             uint32_t cEncFrames          = opus_packet_get_nb_frames(abDst, cbDst);
    689             uint32_t cEncSamplesPerFrame = opus_packet_get_samples_per_frame(abDst, pSink->Codec.Parms.uHz);
    690             uint32_t csEnc               = cEncFrames * cEncSamplesPerFrame;
     688            const uint32_t cEncFrames     = opus_packet_get_nb_frames(abDst, cbWritten);
    691689
    692690            pSink->Codec.STAM.cEncFrames += cEncFrames;
    693             pSink->Codec.STAM.msEncTotal += 20 /* Default 20 ms */ * cEncFrames;
    694 
    695             LogFunc(("%RU64ms [%RU64 frames]: cbSrc=%zu, cbDst=%zu, cEncFrames=%RU32, cEncSamplesPerFrame=%RU32, csEnc=%RU32\n",
    696                      pSink->Codec.STAM.msEncTotal, pSink->Codec.STAM.cEncFrames,
    697                      cbSrc, cbDst, cEncFrames, cEncSamplesPerFrame, csEnc));
     691            pSink->Codec.STAM.msEncTotal += pSink->Codec.Opus.msFrame * cEncFrames;
     692
     693            LogFunc(("%RU64ms [%RU64 frames]: cbSrc=%zu, cbDst=%zu, cEncFrames=%RU32\n",
     694                     pSink->Codec.STAM.msEncTotal, pSink->Codec.STAM.cEncFrames, cbSrc, cbDst, cEncFrames));
    698695# endif
    699696            Assert((uint32_t)cbWritten <= cbDst);
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