]> git.sesse.net Git - nageru/blobdiff - nageru/quicksync_encoder.cpp
On errors, abort() instead of exit(1); exit() in a multithreaded program just gives...
[nageru] / nageru / quicksync_encoder.cpp
index 4883554c5b5d1b52e5146b666528dcee956fcf38..9dc603b5ede7a0c1c2f6bbefcf59db713bd92408 100644 (file)
@@ -80,7 +80,7 @@ std::atomic<int64_t> metric_quick_sync_stalled_frames{0};
 #define CHECK_VASTATUS(va_status, func)                                 \
     if (va_status != VA_STATUS_SUCCESS) {                               \
         fprintf(stderr, "%s:%d (%s) failed with %d\n", __func__, __LINE__, func, va_status); \
-        exit(1);                                                        \
+        abort();                                                        \
     }
 
 #undef BUFFER_OFFSET
@@ -822,7 +822,7 @@ int QuickSyncEncoderImpl::init_va(const string &va_display)
     va_dpy = try_open_va(va_display, &h264_profile, &error);
     if (va_dpy == nullptr) {
        fprintf(stderr, "error: %s\n", error.c_str());
-        exit(1);
+        abort();
     }
     if (!va_dpy->can_use_zerocopy) {
         use_zerocopy = false;
@@ -860,7 +860,7 @@ int QuickSyncEncoderImpl::init_va(const string &va_display)
     /* check the interested configattrib */
     if ((attrib[VAConfigAttribRTFormat].value & VA_RT_FORMAT_YUV420) == 0) {
         printf("Not find desired YUV420 RT format\n");
-        exit(1);
+        abort();
     } else {
         config_attrib[config_attrib_num].type = VAConfigAttribRTFormat;
         config_attrib[config_attrib_num].value = VA_RT_FORMAT_YUV420;
@@ -870,7 +870,7 @@ int QuickSyncEncoderImpl::init_va(const string &va_display)
     if (attrib[VAConfigAttribRateControl].value != VA_ATTRIB_NOT_SUPPORTED) {
         if (!(attrib[VAConfigAttribRateControl].value & VA_RC_CQP)) {
             fprintf(stderr, "ERROR: VA-API encoder does not support CQP mode.\n");
-            exit(1);
+            abort();
         }
 
         config_attrib[config_attrib_num].type = VAConfigAttribRateControl;
@@ -1564,7 +1564,7 @@ QuickSyncEncoderImpl::QuickSyncEncoderImpl(const std::string &filename, Resource
                if (!make_current(context, this->surface)) {
                        printf("display=%p surface=%p context=%p curr=%p err=%d\n", eglGetCurrentDisplay(), this->surface, context, eglGetCurrentContext(),
                                eglGetError());
-                       exit(1);
+                       abort();
                }
                encode_thread_func();
                delete_context(context);
@@ -1804,7 +1804,7 @@ void QuickSyncEncoderImpl::open_output_file(const std::string &filename)
        if (ret < 0) {
                char tmp[AV_ERROR_MAX_STRING_SIZE];
                fprintf(stderr, "%s: avio_open2() failed: %s\n", filename.c_str(), av_make_error_string(tmp, sizeof(tmp), ret));
-               exit(1);
+               abort();
        }
 
        string video_extradata;  // FIXME: See other comment about global headers.
@@ -2179,5 +2179,5 @@ string QuickSyncEncoder::get_usable_va_display()
        fprintf(stderr, "to expose Quick Sync. Alternatively, you can use --record-x264-video\n");
        fprintf(stderr, "to use software instead of hardware H.264 encoding, at the expense\n");
        fprintf(stderr, "of increased CPU usage and possibly bit rate.\n");
-       exit(1);
+       abort();
 }