mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 11:45:25 +00:00
spectrum: fix the error accumulation and frames_todo handling
Even though we wrap around the accumulated second, we still need to add the error in the same cycle. Increase the todo in the same conditional as afterwards the accumulated error will be below one second.
This commit is contained in:
parent
315347a8dc
commit
f00af192c9
1 changed files with 8 additions and 12 deletions
|
@ -1006,14 +1006,12 @@ gst_spectrum_transform_ip (GstBaseTransform * trans, GstBuffer * buffer)
|
|||
spectrum->num_frames, spectrum->frames_per_interval,
|
||||
GST_TIME_ARGS (spectrum->accumulated_error));
|
||||
|
||||
if (spectrum->accumulated_error >= GST_SECOND)
|
||||
spectrum->accumulated_error -= GST_SECOND;
|
||||
else
|
||||
spectrum->accumulated_error += spectrum->error_per_interval;
|
||||
|
||||
spectrum->frames_todo = spectrum->frames_per_interval;
|
||||
if (spectrum->accumulated_error >= GST_SECOND)
|
||||
if (spectrum->accumulated_error >= GST_SECOND) {
|
||||
spectrum->accumulated_error -= GST_SECOND;
|
||||
spectrum->frames_todo++;
|
||||
}
|
||||
spectrum->accumulated_error += spectrum->error_per_interval;
|
||||
|
||||
if (spectrum->post_messages) {
|
||||
GstMessage *m;
|
||||
|
@ -1072,14 +1070,12 @@ gst_spectrum_transform_ip (GstBaseTransform * trans, GstBuffer * buffer)
|
|||
spectrum->num_frames, spectrum->frames_per_interval,
|
||||
GST_TIME_ARGS (spectrum->accumulated_error));
|
||||
|
||||
if (spectrum->accumulated_error >= GST_SECOND)
|
||||
spectrum->accumulated_error -= GST_SECOND;
|
||||
else
|
||||
spectrum->accumulated_error += spectrum->error_per_interval;
|
||||
|
||||
spectrum->frames_todo = spectrum->frames_per_interval;
|
||||
if (spectrum->accumulated_error >= GST_SECOND)
|
||||
if (spectrum->accumulated_error >= GST_SECOND) {
|
||||
spectrum->accumulated_error -= GST_SECOND;
|
||||
spectrum->frames_todo++;
|
||||
}
|
||||
spectrum->accumulated_error += spectrum->error_per_interval;
|
||||
|
||||
if (spectrum->post_messages) {
|
||||
GstMessage *m;
|
||||
|
|
Loading…
Reference in a new issue