Skip to content

Commit afacb76

Browse files
committed
vcomp/cmpto_j2k: catch video pool exceptions
1 parent 95aa721 commit afacb76

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/video_compress/cmpto_j2k.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
#include <cmath>
5757
#include <condition_variable>
5858
#include <cstdint> // for intmax_t, uintmax_t
59+
#include <exception> // for exception
5960
#include <limits> // for numeric_limits
6061
#include <mutex>
6162
#include <string>
@@ -907,7 +908,12 @@ static void j2k_compress_push(void *state, std::shared_ptr<video_frame> tx)
907908
"Allocate custom image data",
908909
HANDLE_ERROR_COMPRESS_PUSH);
909910
memcpy(&udata->desc, &s->compressed_desc, sizeof(s->compressed_desc));
910-
new (&udata->frame) shared_ptr<video_frame>(get_copy(s, tx.get()));
911+
try {
912+
new (&udata->frame) shared_ptr<video_frame>(get_copy(s, tx.get()));
913+
} catch (std::exception &e) {
914+
MSG(ERROR, "Cannot get frame copy: %s\n", e.what());
915+
return;
916+
}
911917
vf_store_metadata(tx.get(), udata->metadata);
912918

913919
if (s->pool_in_cuda_memory) {

0 commit comments

Comments
 (0)