From: Sebastian Dröge Date: Thu, 9 Jan 2020 13:27:28 +0000 (+0200) Subject: timecodestamper: Only allow requesting LTC audio pad in NULL/READY states X-Git-Tag: 1.19.3~507^2~2441 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0a53f6560a373b0c00e20e4f9850c88f8f993d21;p=platform%2Fupstream%2Fgstreamer.git timecodestamper: Only allow requesting LTC audio pad in NULL/READY states And don't introduce any latency at all if not LTC audio pad was requested. --- diff --git a/gst/timecode/gsttimecodestamper.c b/gst/timecode/gsttimecodestamper.c index d86a6ee..8e2051a 100644 --- a/gst/timecode/gsttimecodestamper.c +++ b/gst/timecode/gsttimecodestamper.c @@ -877,7 +877,7 @@ gst_timecodestamper_query (GstBaseTransform * trans, g_mutex_lock (&timecodestamper->mutex); if (res && timecodestamper->vinfo.fps_n && timecodestamper->vinfo.fps_d) { gst_query_parse_latency (query, &live, &min_latency, &max_latency); - if (live) { + if (live && timecodestamper->ltcpad) { /* Introduce additional 8 frames of latency for LTC processing as * the LTC library seems to usually lag behind 1-6 frames with the * values reported back to us. */ @@ -1171,7 +1171,7 @@ gst_timecodestamper_transform_ip (GstBaseTransform * vfilter, /* Update LTC-based timecode as needed */ #if HAVE_LTC - { + if (timecodestamper->ltcpad) { GstClockTime frame_duration; gchar *tc_str; LTCFrameExt ltc_frame; @@ -1520,6 +1520,14 @@ gst_timecodestamper_request_new_pad (GstElement * element, return NULL; } + if (GST_STATE (timecodestamper) > GST_STATE_READY || + GST_STATE_TARGET (timecodestamper) > GST_STATE_READY) { + GST_ERROR_OBJECT (timecodestamper, + "LTC audio pad can only be requested in NULL or READY state"); + GST_OBJECT_UNLOCK (timecodestamper); + return NULL; + } + timecodestamper->ltcpad = gst_pad_new_from_static_template (&gst_timecodestamper_ltc_template, "ltc_sink");