diff options
author | wm4 <wm4@nowhere> | 2018-04-22 19:40:36 +0200 |
---|---|---|
committer | Jan Ekström <jeebjp@gmail.com> | 2018-04-29 02:21:32 +0300 |
commit | 6c8362ef54f4e90476553cb6b64996cc414da06d (patch) | |
tree | ab3fa75a18958bacc08c473304f59519a58f5969 /common/common.h | |
parent | 8135e25600ace2894df274e6a825cfef525fee77 (diff) | |
download | mpv-6c8362ef54f4e90476553cb6b64996cc414da06d.tar.bz2 mpv-6c8362ef54f4e90476553cb6b64996cc414da06d.tar.xz |
encode: rewrite half of it
The main change is that we wait with opening the muxer ("writing
headers") until we have data from all streams. This fixes race
conditions at init due to broken assumptions in the old code.
This also changes a lot of other stuff. I found and fixed a few API
violations (often things for which better mechanisms were invented, and
the old ones are not valid anymore). I try to get away from the public
mutex and shared fields in encode_lavc_context. For now it's still
needed for some timestamp-related fields, but most are gone. It also
removes some bad code duplication between audio and video paths.
Diffstat (limited to 'common/common.h')
-rw-r--r-- | common/common.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/common/common.h b/common/common.h index 14a9973371..dfb2ba7b7a 100644 --- a/common/common.h +++ b/common/common.h @@ -106,4 +106,15 @@ char *mp_tprintf_buf(char *buf, size_t buf_size, const char *format, ...) char **mp_dup_str_array(void *tctx, char **s); +// We generally do not handle allocation failure of small malloc()s. This would +// create a large number of rarely tested code paths, which would probably +// regress and cause security issues. We prefer to fail fast. +// This macro generally behaves like an assert(), except it will make sure to +// kill the process even with NDEBUG. +#define MP_HANDLE_OOM(x) do { \ + assert(x); \ + if (!(x)) \ + abort(); \ + } while (0) + #endif /* MPLAYER_MPCOMMON_H */ |