fpsdisplaysink: initialize interval_ts and last_frames_* counters

Initialize interval_ts to first QOS event timestamp, otherwise the
fps statistics are printed always after one rendered frame.
Also, initialize last_frames_* counters, the values are bogus e.g. after
PLAYING-NULL-PLAYING state change.
This commit is contained in:
Lasse Laukkanen 2010-09-23 14:15:08 +03:00 committed by Thiago Santos
parent a6b26cac65
commit 4ebdd9b5ac

View file

@ -224,7 +224,7 @@ on_video_sink_data_flow (GstPad * pad, GstMiniObject * mini_obj,
ts = gst_util_get_timestamp ();
if (G_UNLIKELY (!GST_CLOCK_TIME_IS_VALID (self->start_ts))) {
self->last_ts = self->start_ts = ts;
self->interval_ts = self->last_ts = self->start_ts = ts;
}
if (GST_CLOCK_DIFF (self->interval_ts, ts) > self->fps_update_interval) {
display_current_fps (self);
@ -404,6 +404,8 @@ fps_display_sink_start (GstFPSDisplaySink * self)
/* Init counters */
self->frames_rendered = G_GUINT64_CONSTANT (0);
self->frames_dropped = G_GUINT64_CONSTANT (0);
self->last_frames_rendered = G_GUINT64_CONSTANT (0);
self->last_frames_dropped = G_GUINT64_CONSTANT (0);
self->max_fps = -1;
self->min_fps = -1;