From de478d32950a620f38499dd811b285b2b4593e06 Mon Sep 17 00:00:00 2001 From: jp9000 Date: Tue, 1 Jul 2014 15:08:01 -0700 Subject: [PATCH] Change drop threshold to macro, use milliseconds Like with other plugins, a macro is ideal for preventing typos and misspellings of the setting. Also, add a property for drop threshold. --- plugins/obs-outputs/rtmp-stream.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/obs-outputs/rtmp-stream.c b/plugins/obs-outputs/rtmp-stream.c index dda005a71..3de74625d 100644 --- a/plugins/obs-outputs/rtmp-stream.c +++ b/plugins/obs-outputs/rtmp-stream.c @@ -26,6 +26,8 @@ #include "librtmp/log.h" #include "flv-mux.h" +#define OPT_DROP_THRESHOLD "drop_threshold_ms" + //#define TEST_FRAMEDROPS struct rtmp_stream { @@ -417,7 +419,7 @@ static bool rtmp_stream_start(void *data) dstr_copy(&stream->username, obs_service_get_username(service)); dstr_copy(&stream->password, obs_service_get_password(service)); stream->drop_threshold_usec = - (int64_t)obs_data_getint(settings, "drop_threshold"); + (int64_t)obs_data_getint(settings, OPT_DROP_THRESHOLD) * 1000; obs_data_release(settings); return pthread_create(&stream->connect_thread, NULL, connect_thread, @@ -541,7 +543,7 @@ static void rtmp_stream_data(void *data, struct encoder_packet *packet) static void rtmp_stream_defaults(obs_data_t defaults) { - obs_data_set_default_int(defaults, "drop_threshold", 600000); + obs_data_set_default_int(defaults, OPT_DROP_THRESHOLD, 600); } static obs_properties_t rtmp_stream_properties(void) @@ -549,6 +551,8 @@ static obs_properties_t rtmp_stream_properties(void) obs_properties_t props = obs_properties_create(); /* TODO: locale */ + obs_properties_add_int(props, OPT_DROP_THRESHOLD, + "Drop threshold (milliseconds)", 200, 10000, 100); return props; } -- GitLab