summaryrefslogtreecommitdiffstats
path: root/stream
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-02-25 22:23:31 +0100
committerDiogo Franco (Kovensky) <diogomfranco@gmail.com>2015-02-26 11:03:15 +0900
commit2d3e4fb1b97dab47331dffee8a56176061f187d0 (patch)
tree32d64bae63a17eea05fa321be012c4c4794f6188 /stream
parent78cd25388c3dc4b1aa3d0c7e85ba669bb7310761 (diff)
downloadmpv-2d3e4fb1b97dab47331dffee8a56176061f187d0.tar.bz2
mpv-2d3e4fb1b97dab47331dffee8a56176061f187d0.tar.xz
cache: use MPCLAMP() macro
(cherry picked from commit e85bcc12233ee08b7609382372dd80482fd016f2)
Diffstat (limited to 'stream')
-rw-r--r--stream/cache.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/stream/cache.c b/stream/cache.c
index 8051bfa5e7..fafd76a4ab 100644
--- a/stream/cache.c
+++ b/stream/cache.c
@@ -126,13 +126,6 @@ enum {
FILL_LIMIT = 16 * 1024,
};
-static int64_t mp_clipi64(int64_t val, int64_t min, int64_t max)
-{
- val = FFMIN(val, max);
- val = FFMAX(val, min);
- return val;
-}
-
// Used by the main thread to wakeup the cache thread, and to wait for the
// cache thread. The cache mutex has to be locked when calling this function.
// *retry_time should be set to 0 on the first call.
@@ -232,7 +225,7 @@ static bool cache_fill(struct priv *s)
}
// number of buffer bytes which should be preserved in backwards direction
- int64_t back = mp_clipi64(read - s->min_filepos, 0, s->back_size);
+ int64_t back = MPCLAMP(read - s->min_filepos, 0, s->back_size);
// number of buffer bytes that are valid and can be read
int64_t newb = FFMAX(s->max_filepos - read, 0);
@@ -297,7 +290,7 @@ static int resize_cache(struct priv *s, int64_t size)
{
int64_t min_size = FILL_LIMIT * 4;
int64_t max_size = ((size_t)-1) / 4;
- int64_t buffer_size = MPMIN(MPMAX(size, min_size), max_size);
+ int64_t buffer_size = MPCLAMP(size, min_size, max_size);
unsigned char *buffer = malloc(buffer_size);
if (!buffer) {