summaryrefslogtreecommitdiffstats
path: root/stream
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-02-25 22:23:31 +0100
committerwm4 <wm4@nowhere>2015-02-25 22:23:31 +0100
commite85bcc12233ee08b7609382372dd80482fd016f2 (patch)
treee0b3b9b262d34ae830c144605fa96121694d01a1 /stream
parent899f0cd51eaadf6d0249d854efc3d0d1029045bd (diff)
downloadmpv-e85bcc12233ee08b7609382372dd80482fd016f2.tar.bz2
mpv-e85bcc12233ee08b7609382372dd80482fd016f2.tar.xz
cache: use MPCLAMP() macro
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) {