Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 7a5ab20 in mainline


Ignore:
Timestamp:
2011-12-05T18:38:30Z (10 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master
Children:
c891eaca
Parents:
2809563
Message:

dplay: Limit delay time to sane value.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/dplay/dplay.c

    r2809563 r7a5ab20  
    4545
    4646#include <stdio.h>
     47#include <macros.h>
    4748
    4849#include "wave.h"
     
    7879        while (true) {
    7980                tv_add(&time, interval); /* Next update point */
     81
    8082                struct timeval current;
    8183                gettimeofday(&current, NULL);
    8284
    83                 const suseconds_t delay = tv_sub(&time, &current);
     85                const suseconds_t delay = min(tv_sub(&time, &current), interval);
    8486                if (delay > 0)
    8587                        usleep(delay);
     88
    8689                const size_t bytes =
    8790                    fread(buffer_place, sizeof(uint8_t), half_buf, source);
Note: See TracChangeset for help on using the changeset viewer.