summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Kost <ensonic@users.sf.net>2010-10-12 00:01:59 +0300
committerStefan Kost <ensonic@users.sf.net>2010-10-12 00:01:59 +0300
commitdc6ec22b87095fbea8447ba535769f4efc22c904 (patch)
tree96b9ad3271b1093cd2df44a37bfa72f04f96db94
parent22d318318efffb6b0abf6a4dd99d295201b902cf (diff)
tracelib: change transmission_stats
Call pad_stats for the peer. Disable the weired pad traversal code. Seems to now produce the expected results for e.g.: "audiotestsrc num-buffers=10 ! autoaudiosink"
-rw-r--r--src/gsttracelib.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/gsttracelib.c b/src/gsttracelib.c
index 2a583bd..af24f9b 100644
--- a/src/gsttracelib.c
+++ b/src/gsttracelib.c
@@ -919,13 +919,15 @@ _do_transmission_stats(GstPad *pad, GstBuffer *buf, GstClockTimeDiff elapsed)
GstPad *peer_pad = GST_PAD_PEER (pad);
GsttlElementStats *peer_stats;
GSList *node,*bin_i_stats=NULL,*bin_o_stats=NULL;
+ GsttlPadStats *peer_pad_stats;
if (!peer_pad)
return;
+ parent = GST_OBJECT_PARENT (peer_pad);
+#ifdef _ENABLE_BLACK_MAGIC_
/* walk the ghost pad chain downstream to get the real pad */
/* if parent of peer_pad is a ghost-pad, then peer_pad is a proxy_pad */
- parent = GST_OBJECT_PARENT (peer_pad);
while (parent && GST_IS_GHOST_PAD (parent)) {
peer_pad = GST_PAD_CAST (parent);
/* if this is now the ghost pad, get the peer of this */
@@ -947,6 +949,12 @@ _do_transmission_stats(GstPad *pad, GstBuffer *buf, GstClockTimeDiff elapsed)
peer_pad = gst_ghost_pad_get_target (GST_GHOST_PAD_CAST(peer_pad));
parent = peer_pad ? GST_OBJECT_PARENT (peer_pad) : NULL;
}
+#else
+ if (parent && GST_IS_GHOST_PAD (parent)) {
+ peer_pad = GST_PAD_CAST (parent);
+ parent = GST_OBJECT_PARENT (peer_pad);
+ }
+#endif
if (!parent) {
fprintf (stderr,"%" GST_TIME_FORMAT " transmission on unparented target pad%s_%s\n",
@@ -955,6 +963,9 @@ _do_transmission_stats(GstPad *pad, GstBuffer *buf, GstClockTimeDiff elapsed)
}
peer_stats = _get_element_stats (GST_ELEMENT_CAST(parent));
+ peer_pad_stats = _get_pad_stats (peer_pad);
+ _do_pad_stats(peer_pad, peer_pad_stats, buf, elapsed);
+
if(GST_PAD_DIRECTION(pad) == GST_PAD_SRC) {
/* push */
this_stats->sent_buffers++;
@@ -970,6 +981,7 @@ _do_transmission_stats(GstPad *pad, GstBuffer *buf, GstClockTimeDiff elapsed)
peer_stats->first_ts=elapsed+1;
//printf("%" GST_TIME_FORMAT " %s is beeing pushed from %s\n",GST_TIME_ARGS(elapsed),peer_stats->name,this_stats->name);
}
+#ifdef _ENABLE_BLACK_MAGIC_
for (node = bin_o_stats; node; node = g_slist_next(node)) {
peer_stats = node->data;
peer_stats->sent_buffers++;
@@ -980,6 +992,7 @@ _do_transmission_stats(GstPad *pad, GstBuffer *buf, GstClockTimeDiff elapsed)
peer_stats->recv_buffers++;
peer_stats->recv_bytes += GST_BUFFER_SIZE(buf);
}
+#endif
} else {
/* pull */
peer_stats->sent_buffers++;
@@ -995,6 +1008,7 @@ _do_transmission_stats(GstPad *pad, GstBuffer *buf, GstClockTimeDiff elapsed)
peer_stats->first_ts=elapsed;
//printf("%" GST_TIME_FORMAT " %s is beeing pulled from %s\n",GST_TIME_ARGS(elapsed),peer_stats->name,this_stats->name);
}
+#ifdef _ENABLE_BLACK_MAGIC_
for (node = bin_i_stats; node; node = g_slist_next(node)) {
peer_stats = node->data;
peer_stats->sent_buffers++;
@@ -1005,6 +1019,7 @@ _do_transmission_stats(GstPad *pad, GstBuffer *buf, GstClockTimeDiff elapsed)
peer_stats->recv_buffers++;
peer_stats->recv_bytes += GST_BUFFER_SIZE(buf);
}
+#endif
}
g_slist_free (bin_o_stats);
g_slist_free (bin_i_stats);