[gst-devel] rtp stats in python

Florent fthiery at gmail.com
Sat Oct 17 14:00:00 CEST 2009


Hi

> The RTP C examples in plugins-good show how to extract statistics.
> I would like to do the same in Python, but I cannot find these functions
> anywhere ...

The following should work:


import gst

host="127.0.0.1"
port=1234
p = "videotestsrc ! rtpvrawpay ! udpsink host=%s port=%s" %(host, port)

pipeline = gst.parse_launch(p)
udpsink = pipeline.get_by_name("udpsink0")

def print_stats():
    data = udpsink.emit("get_stats", host, port)
    stats = "bytes_sent: %s, packets_sent: %s, connect_time: %s"
%(data[0], data[1], data[2])
    print stats
    return True

import gobject
gobject.timeout_add_seconds(1, print_stats)

pipeline.set_state(gst.STATE_PLAYING)

import gtk
gtk.main()




More information about the gstreamer-devel mailing list