Ignore:
Timestamp:
Jul 2, 2009, 1:50:07 AM (13 years ago)
Author:
charles
Message:

(trunk libT) #529: Time remaining for downloads is unreliable

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/torrent.c

    r8768 r8770  
    948948            else if( s->pieceDownloadSpeed < 0.1 )
    949949                s->eta = TR_ETA_UNKNOWN;
    950             else
    951                 s->eta = s->leftUntilDone / s->pieceDownloadSpeed / 1024.0;
     950            else {
     951                /* etaSpeed exists because if we pieceDownloadSpeed directly,
     952                 * brief fluctuations cause the ETA to jump all over the place.
     953                 * so, etaSpeed is a smoothed-out version of pieceDownloadSpeed
     954                 * to dampen the effect of fluctuations */
     955                if( ( tor->etaSpeedCalculatedAt + 800 ) < now ) {
     956                    tor->etaSpeedCalculatedAt = now;
     957                    tor->etaSpeed = fabs(tor->etaSpeed>0.001)
     958                        ? s->pieceDownloadSpeed /* if no previous speed, no need to smooth */
     959                        : 0.8*tor->etaSpeed + 0.2*s->pieceDownloadSpeed; /* smooth across 5 readings */
     960                }
     961                s->eta = s->leftUntilDone / tor->etaSpeed / 1024.0;
     962            }
    952963            break;
    953964
Note: See TracChangeset for help on using the changeset viewer.