GNOME Bugzilla – Bug 644284
Suspicious max_latency computation in gstbaseaudiosink.c
Last modified: 2011-07-28 12:34:49 UTC
I have been reviewing latency computation code to try to understand exactly what the max_latency is (still working on that). While reviewing gstbaseaudiosink.c, I came across the following code in the GST_QUERY_LATENCY handling, which seems suspicious: {{{ min_latency = gst_util_uint64_scale_int (spec->seglatency * spec->segsize, GST_SECOND, spec->rate * spec->bytes_per_sample); GST_OBJECT_UNLOCK (basesink); /* we cannot go lower than the buffer size and the min peer latency */ min_latency = min_latency + min_l; /* the max latency is the max of the peer, we can delay an infinite * amount of time. */ max_latency = min_latency + (max_l == -1 ? 0 : max_l); }}} This code seems suspicious to me because in the case where max_l != 0, the final value of max_latency is: {{{ min_latency_0 + min_l + max_l }}} (where min_latency_0 is the value of min_latency returned by gst_util_uint64_scale_int, and min_l and max_l are the latencies for the upstream pipeline) I am still trying to grasp the exact meaning of max_latency, but it seems very suspicious to me that we would be adding min_l and max_l, so I thought I would flag this computation. It seems likely to me that the author intended to be using min_latency_0 in the max_latency computation, and forgot that min_latency had already been operated on.
Looks suspicious to me too... Wim?
Created attachment 192318 [details] [review] fix latency calculation for live elements Agree too. What about the attached patch? For some reason this test is failing already before making changes, the patch is neutral on it. Running suite(s): baseaudiosrc 0%: Checks: 1, Failures: 1, Errors: 0 pipelines/basetime.c:49:F:general:test_basetime_calculation:0: Two buffers had same timestamp FAIL: pipelines/basetime
Okay the test is unrelated and got fixed.