summaryrefslogtreecommitdiffstats
path: root/video/out
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2023-01-10 18:59:21 +0100
committersfan5 <sfan5@live.de>2023-01-12 22:02:07 +0100
commit7b03cd367dd5416a4728ccea7e47dcd2827cbab7 (patch)
treecea4075b81850000890f55d6cd01de117a2138a0 /video/out
parentb6b83805183618f3a46f2cc77d85dcff72ef6396 (diff)
downloadmpv-7b03cd367dd5416a4728ccea7e47dcd2827cbab7.tar.bz2
mpv-7b03cd367dd5416a4728ccea7e47dcd2827cbab7.tar.xz
various: replace if + abort() with MP_HANDLE_OOM()
MP_HANDLE_OOM also aborts but calls assert() first, which will result in an useful message if compiled in debug mode.
Diffstat (limited to 'video/out')
-rw-r--r--video/out/dr_helper.c3
-rw-r--r--video/out/gpu/lcms.c6
-rw-r--r--video/out/gpu/shader_cache.c3
-rw-r--r--video/out/vo.c3
-rw-r--r--video/out/vo_lavc.c3
5 files changed, 6 insertions, 12 deletions
diff --git a/video/out/dr_helper.c b/video/out/dr_helper.c
index 78d4633efb..5b585f5528 100644
--- a/video/out/dr_helper.c
+++ b/video/out/dr_helper.c
@@ -140,8 +140,7 @@ static void sync_get_image(void *ptr)
AVBufferRef *new_ref = av_buffer_create(ctx->ref->data, ctx->ref->size,
free_dr_buffer_on_dr_thread, ctx, 0);
- if (!new_ref)
- abort(); // tiny malloc OOM
+ MP_HANDLE_OOM(new_ref);
cmd->res->bufs[0] = new_ref;
diff --git a/video/out/gpu/lcms.c b/video/out/gpu/lcms.c
index b49b9614a2..3df5eba5f2 100644
--- a/video/out/gpu/lcms.c
+++ b/video/out/gpu/lcms.c
@@ -317,8 +317,7 @@ bool gl_lcms_get_lut3d(struct gl_lcms *p, struct lut3d **result_lut3d,
if (vid_profile) {
MP_VERBOSE(p, "Got an embedded ICC profile.\n");
p->vid_profile = av_buffer_ref(vid_profile);
- if (!p->vid_profile)
- abort();
+ MP_HANDLE_OOM(p->vid_profile);
}
if (!gl_parse_3dlut_size(p->opts->size_str, &s_r, &s_g, &s_b))
@@ -344,8 +343,7 @@ bool gl_lcms_get_lut3d(struct gl_lcms *p, struct lut3d **result_lut3d,
uint8_t hash[32];
struct AVSHA *sha = av_sha_alloc();
- if (!sha)
- abort();
+ MP_HANDLE_OOM(sha);
av_sha_init(sha, 256);
av_sha_update(sha, cache_info, strlen(cache_info));
if (vid_profile)
diff --git a/video/out/gpu/shader_cache.c b/video/out/gpu/shader_cache.c
index 5436881ded..1d5e563cb8 100644
--- a/video/out/gpu/shader_cache.c
+++ b/video/out/gpu/shader_cache.c
@@ -579,8 +579,7 @@ static bool create_pass(struct gl_shader_cache *sc, struct sc_entry *entry)
cache_dir = mp_get_user_path(tmp, sc->global, sc->cache_dir);
struct AVSHA *sha = av_sha_alloc();
- if (!sha)
- abort();
+ MP_HANDLE_OOM(sha);
av_sha_init(sha, 256);
av_sha_update(sha, entry->total.start, entry->total.len);
diff --git a/video/out/vo.c b/video/out/vo.c
index a5458b593e..cf806b2244 100644
--- a/video/out/vo.c
+++ b/video/out/vo.c
@@ -1431,8 +1431,7 @@ struct vo_frame *vo_frame_ref(struct vo_frame *frame)
*new = *frame;
for (int n = 0; n < frame->num_frames; n++) {
new->frames[n] = mp_image_new_ref(frame->frames[n]);
- if (!new->frames[n])
- abort(); // OOM on tiny allocs
+ MP_HANDLE_OOM(new->frames[n]);
}
new->current = new->num_frames ? new->frames[0] : NULL;
return new;
diff --git a/video/out/vo_lavc.c b/video/out/vo_lavc.c
index e817b530e0..8e188b5aab 100644
--- a/video/out/vo_lavc.c
+++ b/video/out/vo_lavc.c
@@ -217,8 +217,7 @@ static void draw_frame(struct vo *vo, struct vo_frame *voframe)
pthread_mutex_unlock(&ectx->lock);
AVFrame *frame = mp_image_to_av_frame(mpi);
- if (!frame)
- abort();
+ MP_HANDLE_OOM(frame);
frame->pts = rint(outpts * av_q2d(av_inv_q(avc->time_base)));
frame->pict_type = 0; // keep this at unknown/undefined