VirtualBox

Changeset 74903 in vbox for trunk/src/VBox/Main/src-client


Ignore:
Timestamp:
Oct 18, 2018 7:59:50 AM (6 years ago)
Author:
vboxsync
Message:

Main/WebMWriter: Added some more checks for WebMWriter::AddAudioTrack().

File:
1 edited

Legend:

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

    r74781 r74903  
    180180{
    181181#ifdef VBOX_WITH_LIBOPUS
    182     int rc;
     182    AssertReturn(uHz,       VERR_INVALID_PARAMETER);
     183    AssertReturn(cBits,     VERR_INVALID_PARAMETER);
     184    AssertReturn(cChannels, VERR_INVALID_PARAMETER);
    183185
    184186    /*
    185      * Check if the requested codec rate is supported.
     187     * Adjust the handed-in Hz rate to values which are supported by the Opus codec.
    186188     *
    187189     * Only the following values are supported by an Opus standard build
    188190     * -- every other rate only is supported by a custom build.
     191     *
     192     * See opus_encoder_create() for more information.
    189193     */
    190     switch (uHz)
    191     {
    192         case 48000:
    193         case 24000:
    194         case 16000:
    195         case 12000:
    196         case  8000:
    197             rc = VINF_SUCCESS;
    198             break;
    199 
    200         default:
    201             rc = VERR_NOT_SUPPORTED;
    202             break;
    203     }
    204 
    205     if (RT_FAILURE(rc))
    206         return rc;
     194    if      (uHz > 24000) uHz = 48000;
     195    else if (uHz > 16000) uHz = 24000;
     196    else if (uHz > 12000) uHz = 16000;
     197    else if (uHz > 8000 ) uHz = 12000;
     198    else     uHz = 8000;
    207199
    208200    /* Some players (e.g. Firefox with Nestegg) rely on track numbers starting at 1.
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