Changeset 2862 for box/trunk/lib


Ignore:
Timestamp:
26/02/2011 14:09:45 (15 months ago)
Author:
chris
Message:

Hopefully fix divide by zero error on rate limiting stream.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • box/trunk/lib/common/RateLimitingStream.cpp

    r2847 r2862  
    6464        // How are we doing so far? (for logging only) 
    6565        box_time_t currentDuration = currentTime - mStartTime; 
     66 
     67        // in case our timer is not very accurate, don't divide by zero on first pass 
     68        if(currentDuration == 0) 
     69        { 
     70                BOX_TRACE("Current rate not yet known, sending immediately"); 
     71                return bytesReadThisTime; 
     72        } 
     73                 
    6674        uint64_t effectiveRateSoFar = (mTotalBytesRead * MICRO_SEC_IN_SEC_LL) 
    6775                / currentDuration; 
Note: See TracChangeset for help on using the changeset viewer.