Skip to content

Commit e664fb1

Browse files
authored
Move check out of switch (#660)
* provide option for non-standard GStreamer src/mux plugins which have GST_CLOCK_TIME_NONE segment start * the disable_buffer_clipping check needs to be out of the switch otherwise it's only ever set if property is explicitly set, default would be ignored * fix * don't use TRUE/FALSE for comparison for gboolean
1 parent 106228f commit e664fb1

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/gstreamer/gstkvssink.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,12 @@ void kinesis_video_producer_init(GstKvsSink *kvssink)
249249
string region_str;
250250
bool credential_is_static = true;
251251

252+
// This needs to happen after we've read in ALL of the properties
253+
if (!kvssink->disable_buffer_clipping) {
254+
gst_collect_pads_set_clip_function(kvssink->collect,
255+
GST_DEBUG_FUNCPTR(gst_collect_pads_clip_running_time), kvssink);
256+
}
257+
252258
if (0 == strcmp(kvssink->access_key, DEFAULT_ACCESS_KEY)) { // if no static credential is available in plugin property.
253259
if (nullptr == (access_key = getenv(ACCESS_KEY_ENV_VAR))
254260
|| nullptr == (secret_key = getenv(SECRET_KEY_ENV_VAR))) { // if no static credential is available in env var.
@@ -777,14 +783,9 @@ gst_kvs_sink_set_property(GObject *object, guint prop_id,
777783
case PROP_FILE_START_TIME:
778784
kvssink->file_start_time = g_value_get_uint64 (value);
779785
break;
780-
case PROP_DISABLE_BUFFER_CLIPPING: {
786+
case PROP_DISABLE_BUFFER_CLIPPING:
781787
kvssink->disable_buffer_clipping = g_value_get_boolean(value);
782-
if (kvssink->disable_buffer_clipping == FALSE) {
783-
gst_collect_pads_set_clip_function(kvssink->collect,
784-
GST_DEBUG_FUNCPTR(gst_collect_pads_clip_running_time), kvssink);
785-
}
786788
break;
787-
}
788789
default:
789790
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
790791
break;
@@ -980,7 +981,7 @@ gst_kvs_sink_handle_sink_event (GstCollectPads *pads,
980981
LOG_INFO("received kvs-add-metadata event");
981982
if (NULL == gst_structure_get_string(structure, KVS_ADD_METADATA_NAME) ||
982983
NULL == gst_structure_get_string(structure, KVS_ADD_METADATA_VALUE) ||
983-
FALSE == gst_structure_get_boolean(structure, KVS_ADD_METADATA_PERSISTENT, &persistent)) {
984+
!gst_structure_get_boolean(structure, KVS_ADD_METADATA_PERSISTENT, &persistent)) {
984985

985986
LOG_WARN("Event structure contains invalid field: " << std::string(gst_structure_to_string (structure)));
986987
goto CleanUp;
@@ -991,7 +992,7 @@ gst_kvs_sink_handle_sink_event (GstCollectPads *pads,
991992
is_persist = persistent;
992993

993994
bool result = data->kinesis_video_stream->putFragmentMetadata(metadata_name, metadata_value, is_persist);
994-
if (false == result) {
995+
if (!result) {
995996
LOG_WARN("Failed to putFragmentMetadata. name: " << metadata_name << ", value: " << metadata_value << ", persistent: " << is_persist);
996997
}
997998
gst_event_unref (event);

0 commit comments

Comments
 (0)