After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 627229 - fpsdisplaysink should not measure fps relative to pipeline clock
fpsdisplaysink should not measure fps relative to pipeline clock
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Linux
: Normal normal
: 0.10.21
Assigned To: ensonic
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2010-08-18 03:58 UTC by Rob Clark
Modified: 2010-09-06 08:09 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch to change fpsdisplaysink to measure raw fps (8.42 KB, patch)
2010-08-18 03:59 UTC, Rob Clark
accepted-commit_after_freeze Details | Review
patch to change fpsdisplaysink to measure raw fps (8.44 KB, patch)
2010-08-18 09:14 UTC, Stefan Sauer (gstreamer, gtkdoc dev)
none Details | Review
don't use a timeout (4.15 KB, patch)
2010-08-18 09:16 UTC, Stefan Sauer (gstreamer, gtkdoc dev)
none Details | Review
updated patch which preserves the non-atomic but 64bit counters (7.71 KB, patch)
2010-08-23 15:19 UTC, Rob Clark
committed Details | Review
don't use a timeout (4.13 KB, patch)
2010-08-24 08:28 UTC, Stefan Sauer (gstreamer, gtkdoc dev)
committed Details | Review

Description Rob Clark 2010-08-18 03:58:22 UTC
pipeline clock is running at same speed as playback, so this only shows the framerate of the clip being measured.
Comment 1 Rob Clark 2010-08-18 03:59:25 UTC
Created attachment 168169 [details] [review]
patch to change fpsdisplaysink to measure raw fps
Comment 2 Stefan Sauer (gstreamer, gtkdoc dev) 2010-08-18 08:05:35 UTC
Review of attachment 168169 [details] [review]:

::: gst/debugutils/fpsdisplaysink.c
@@ +225,3 @@
+        self->last_ts = self->start_ts = gst_util_get_timestamp();
+        self->timeout_id =
+            g_timeout_add (self->fps_update_interval, display_current_fps,

Hmm, actually the g_timeout_add() is a problem. It adds a g_main_loop() dependency :/. But it was there before.

@@ +331,3 @@
+
+  frames_rendered = g_atomic_int_get (&self->frames_rendered);
+  frames_dropped = g_atomic_int_get (&self->frames_dropped);

If we want ultimate consistency we would need a lock instead of the atomics. Theoretically we can read the first var and then it changes before we read the 2nd. Would that be bad?
Comment 3 Stefan Sauer (gstreamer, gtkdoc dev) 2010-08-18 08:31:58 UTC
I tried the patch, will commit it after freeze.
Comment 4 Stefan Sauer (gstreamer, gtkdoc dev) 2010-08-18 09:14:06 UTC
Created attachment 168179 [details] [review]
patch to change fpsdisplaysink to measure raw fps

run gst-indent before making the patch
Comment 5 Stefan Sauer (gstreamer, gtkdoc dev) 2010-08-18 09:16:44 UTC
Created attachment 168180 [details] [review]
don't use a timeout

update the message in the probe handler

I wonder if this way we actually don't even need the atomic ops.
Comment 6 Rob Clark 2010-08-18 13:23:31 UTC
(In reply to comment #2)
> Review of attachment 168169 [details] [review]:
> 
> ::: gst/debugutils/fpsdisplaysink.c
> @@ +225,3 @@
> +        self->last_ts = self->start_ts = gst_util_get_timestamp();
> +        self->timeout_id =
> +            g_timeout_add (self->fps_update_interval, display_current_fps,
> 
> Hmm, actually the g_timeout_add() is a problem. It adds a g_main_loop()
> dependency :/. But it was there before.
> 
> @@ +331,3 @@
> +
> +  frames_rendered = g_atomic_int_get (&self->frames_rendered);
> +  frames_dropped = g_atomic_int_get (&self->frames_dropped);
> 
> If we want ultimate consistency we would need a lock instead of the atomics.
> Theoretically we can read the first var and then it changes before we read the
> 2nd. Would that be bad?


fwiw, I don't think it would be bad if there was a context switch between reading those two values.  I guess for either value, only one or the other would be incremented at each QOS event.  So essentially it would be as if the timer ran either before or after the QOS event.  It isn't even so much about race conditions.. the main thing is to assure that a sufficient memory barrier instruction happens so that if other thread is running on different processor, it has a chance to see the updated value at all.
Comment 7 Rob Clark 2010-08-18 13:27:03 UTC
(In reply to comment #5)
> Created an attachment (id=168180) [details] [review]
> don't use a timeout
> 
> update the message in the probe handler
> 
> I wonder if this way we actually don't even need the atomic ops.

Yeah, with this approach we don't need atomic ops..  all is happening in same thread. :-)
Comment 8 Stefan Sauer (gstreamer, gtkdoc dev) 2010-08-18 13:57:52 UTC
If noone sees any downside with doing it in the probe-handler and it works for you (rob), coudl you change the first patch to kick out the atomic_ops once again (sorry about that).
Comment 9 Rob Clark 2010-08-23 15:19:32 UTC
Created attachment 168558 [details] [review]
updated patch which preserves the non-atomic but 64bit counters

updated patch which preserves the non-atomic but 64bit counters
Comment 10 Stefan Sauer (gstreamer, gtkdoc dev) 2010-08-24 08:28:30 UTC
Created attachment 168619 [details] [review]
don't use a timeout
Comment 11 Stefan Sauer (gstreamer, gtkdoc dev) 2010-08-24 08:28:53 UTC
Rob, thanks for updated patch. I'll push them after freeze.