diff options
author | wm4 <wm4@nowhere> | 2018-08-24 12:56:41 +0200 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2018-10-01 10:41:01 +0200 |
commit | 36e7ef96fcbb9950059179b2a83d026e66e44492 (patch) | |
tree | 6cc52e3b6030bf0a03267ead81537534760fcaf7 /demux | |
parent | 20d381d1e98844146ffda3e9b9b6b812af95e397 (diff) | |
download | mpv-36e7ef96fcbb9950059179b2a83d026e66e44492.tar.bz2 mpv-36e7ef96fcbb9950059179b2a83d026e66e44492.tar.xz |
demux: allow cache sizes > 2GB
There was no reason to limit this. Only some int fields had to be
changed to size_t.
Diffstat (limited to 'demux')
-rw-r--r-- | demux/demux.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/demux/demux.c b/demux/demux.c index 73d4927002..f02f9b77aa 100644 --- a/demux/demux.c +++ b/demux/demux.c @@ -22,6 +22,7 @@ #include <unistd.h> #include <limits.h> #include <pthread.h> +#include <stdint.h> #include <math.h> @@ -97,11 +98,15 @@ struct demux_opts { #define OPT_BASE_STRUCT struct demux_opts +#define MAX_BYTES MPMIN(INT64_MAX, SIZE_MAX / 2) + const struct m_sub_options demux_conf = { .opts = (const struct m_option[]){ OPT_DOUBLE("demuxer-readahead-secs", min_secs, M_OPT_MIN, .min = 0), - OPT_BYTE_SIZE("demuxer-max-bytes", max_bytes, 0, 0, INT_MAX), - OPT_BYTE_SIZE("demuxer-max-back-bytes", max_bytes_bw, 0, 0, INT_MAX), + // (The MAX_BYTES sizes may not be accurate because the max field is + // of double type.) + OPT_BYTE_SIZE("demuxer-max-bytes", max_bytes, 0, 0, MAX_BYTES), + OPT_BYTE_SIZE("demuxer-max-back-bytes", max_bytes_bw, 0, 0, MAX_BYTES), OPT_FLAG("force-seekable", force_seekable, 0), OPT_DOUBLE("cache-secs", min_secs_cache, M_OPT_MIN, .min = 0), OPT_FLAG("access-references", access_references, 0), @@ -160,8 +165,8 @@ struct demux_internal { bool idle; bool autoselect; double min_secs; - int max_bytes; - int max_bytes_bw; + size_t max_bytes; + size_t max_bytes_bw; bool seekable_cache; // At least one decoder actually requested data since init or the last seek. |