From 37a2b6110f63425188498f2539c0cf2e0e2817b4 Mon Sep 17 00:00:00 2001 From: Thiago Santos Date: Thu, 26 Nov 2015 17:20:20 -0300 Subject: media-descriptor-writer: remove condition from inside loop Only enter the loop if it indeed has a change of doing something --- validate/gst/validate/media-descriptor-writer.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/validate/gst/validate/media-descriptor-writer.c b/validate/gst/validate/media-descriptor-writer.c index ea43bd0..b8b9387 100644 --- a/validate/gst/validate/media-descriptor-writer.c +++ b/validate/gst/validate/media-descriptor-writer.c @@ -383,13 +383,15 @@ pad_added_cb (GstElement * decodebin, GstPad * pad, gst_pad_sticky_events_foreach (pad, (GstPadStickyEventsForeachFunction) _find_stream_id, writer); - for (tmp = ((GstMediaDescriptor *) writer)->filenode->streams; tmp; - tmp = tmp->next) { - snode = tmp->data; - if (snode->pad == pad && srcpad != pad) { - gst_object_unref (pad); - snode->pad = gst_object_ref (srcpad); - break; + if (srcpad != pad) { + for (tmp = ((GstMediaDescriptor *) writer)->filenode->streams; tmp; + tmp = tmp->next) { + snode = tmp->data; + if (snode->pad == pad) { + gst_object_unref (pad); + snode->pad = gst_object_ref (srcpad); + break; + } } } -- cgit v1.2.3