GNOME Bugzilla – Bug 767507
audiovisualizer: Timestamp adjustment calculations wrong for >1 channel
Last modified: 2016-06-11 17:53:51 UTC
Currently it does this: ts = gst_adapter_prev_pts (scope->priv->adapter, &dist); if (GST_CLOCK_TIME_IS_VALID (ts)) { dist /= bps; ts += gst_util_uint64_scale_int (dist, GST_SECOND, rate); } where bps is GST_AUDIO_INFO_BPS (&scope->ainfo) which I *think* is bytes per sample, but that means this calculation is ignoring the number of channels, and if I'm reading the docs for gst_util_uint64_scale_int(). So the calculation probably ought to be: ts = gst_adapter_prev_pts (scope->priv->adapter, &dist); if (GST_CLOCK_TIME_IS_VALID (ts)) { dist /= bps; ts += gst_util_uint64_scale_int (dist, GST_SECOND, rate * GST_AUDIO_INFO_BPF (&scope->ainfo)); } because that will ACTUALLY give us bytes per second.
Seems correct. Can you provide a patch (in "git format-patch" format)? :)
Created attachment 329603 [details] [review] Fix Actually I just noticed that the my "ought to be" is still wrong it really ought to be this: ts = gst_adapter_prev_pts (scope->priv->adapter, &dist); if (GST_CLOCK_TIME_IS_VALID (ts)) { ts += gst_util_uint64_scale_int (dist, GST_SECOND, rate * GST_AUDIO_INFO_BPF (&scope->ainfo)); } Attached a patch
commit 721e415fd203807a2c1b51435b08574bd7b963fc Author: Thomas Jones <thomas.jones@utoronto.ca> Date: Fri Jun 10 22:50:41 2016 -0400 audiovisualizer: fix timestamp calculation for audio channels > 1 We have to use bps*channels instead of just bps, which is exactly what bpf is for. https://bugzilla.gnome.org/show_bug.cgi?id=767507
Please try to make sure your patches compile :) I fixed up the one for bug #767505 and the one for bug #767507 to compile. bps and channels was unused now, which caused compiler warnings, and a failure because -Werror.
(In reply to Sebastian Dröge (slomo) from comment #4) > Please try to make sure your patches compile :) I fixed up the one for bug > #767505 and the one for bug #767507 to compile. bps and channels was unused > now, which caused compiler warnings, and a failure because -Werror. Sorry, I was copying out of a version copied into my own source code because my system has 1.6 on it and I didn't have things set up for building against an uninstalled master and I don't build with -werror and I didn't see the warnings. I have got things set up so I can build against master now though so hopefully any future patches will compile :P