VirtualBox

Changeset 40719 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Mar 30, 2012 9:16:35 AM (13 years ago)
Author:
vboxsync
Message:

Audio: process the integer overflow in no_run_out

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Audio/noaudio.c

    r39875 r40719  
    5858    ticks_per_second = audio_get_ticks_per_sec ();
    5959    /* Minimize the rounding error: samples = int((ticks * freq) / ticks_per_second + 0.5). */
    60     samples = (2 * ticks * hw->info.freq + ticks_per_second) / ticks_per_second / 2;
     60    samples = (int)((2 * ticks * hw->info.freq + ticks_per_second) / ticks_per_second / 2);
     61    /* Usually there is no integer overflow while calculating the 'samples' value.
     62     * It can happen because this is the first invocation or because the function was not called for awhile.
     63     * In this case simply claim that all samples has been played.
     64     */
     65    if (samples < 0) {
     66        samples = live;
     67    }
    6168
    6269    no->old_ticks = now;
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