VirtualBox

Changeset 74849 in vbox


Ignore:
Timestamp:
Oct 15, 2018 4:26:52 PM (6 years ago)
Author:
vboxsync
Message:

VideoRec/Main: Let Opus decide which default bitrate to use.

File:
1 edited

Legend:

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

    r74848 r74849  
    305305    }
    306306
    307     LogRel2(("VideoRec: Recording audio in %RU16Hz, %RU8 channels, %RU32 bitrate\n", uHz, cChannels, uBitrate));
     307    LogRel2(("VideoRec: Recording audio in %RU16Hz, %RU8 channels\n", uHz, cChannels));
    308308
    309309    int orc;
     
    317317    AssertPtr(pEnc);
    318318
    319     opus_encoder_ctl(pEnc, OPUS_SET_BITRATE(uBitrate));
    320     if (orc != OPUS_OK)
    321     {
    322         opus_encoder_destroy(pEnc);
    323         pEnc = NULL;
    324 
    325         LogRel(("VideoRec: Audio codec failed to set bitrate (%RU32): %s\n", uBitrate, opus_strerror(orc)));
    326         return VERR_AUDIO_BACKEND_INIT_FAILED;
     319    if (uBitrate) /* Only explicitly set the bitrate if we specified one. Otherwise let Opus decide. */
     320    {
     321        opus_encoder_ctl(pEnc, OPUS_SET_BITRATE(uBitrate));
     322        if (orc != OPUS_OK)
     323        {
     324            opus_encoder_destroy(pEnc);
     325            pEnc = NULL;
     326
     327            LogRel(("VideoRec: Audio codec failed to set bitrate (%RU32): %s\n", uBitrate, opus_strerror(orc)));
     328            return VERR_AUDIO_BACKEND_INIT_FAILED;
     329        }
    327330    }
    328331
     
    622625    CodecParms.cChannels = 2;                  /** @todo Make this configurable. */
    623626    CodecParms.cBits     = 16;                 /** @todo Make this configurable. */
    624     CodecParms.uBitrate  = 196000;             /** @todo Make this configurable. */
     627    CodecParms.uBitrate  = 0;                  /* Let Opus decide, based on the number of channels and the input sampling rate. */
    625628
    626629    int rc = avRecSinkInit(pThis, &pThis->Sink, &ContainerParms, &CodecParms);
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