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
@ -1006,14 +1006,12 @@ gst_spectrum_transform_ip (GstBaseTransform * trans, GstBuffer * buffer)
|
|||||||
spectrum->num_frames, spectrum->frames_per_interval,
|
spectrum->num_frames, spectrum->frames_per_interval,
|
||||||
GST_TIME_ARGS (spectrum->accumulated_error));
|
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;
|
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->frames_todo++;
|
||||||
|
}
|
||||||
|
spectrum->accumulated_error += spectrum->error_per_interval;
|
||||||
|
|
||||||
if (spectrum->post_messages) {
|
if (spectrum->post_messages) {
|
||||||
GstMessage *m;
|
GstMessage *m;
|
||||||
@ -1072,14 +1070,12 @@ gst_spectrum_transform_ip (GstBaseTransform * trans, GstBuffer * buffer)
|
|||||||
spectrum->num_frames, spectrum->frames_per_interval,
|
spectrum->num_frames, spectrum->frames_per_interval,
|
||||||
GST_TIME_ARGS (spectrum->accumulated_error));
|
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;
|
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->frames_todo++;
|
||||||
|
}
|
||||||
|
spectrum->accumulated_error += spectrum->error_per_interval;
|
||||||
|
|
||||||
if (spectrum->post_messages) {
|
if (spectrum->post_messages) {
|
||||||
GstMessage *m;
|
GstMessage *m;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user