mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-30 12:49:40 +00:00
audiovisualizer: Fix calculations for bytes<->samples conversions
Use bpf instead of channels * sizeof(gint16). https://bugzilla.gnome.org/show_bug.cgi?id=767505
This commit is contained in:
parent
247ce9f39f
commit
d423406e0a
1 changed files with 4 additions and 5 deletions
|
@ -1036,7 +1036,7 @@ gst_audio_visualizer_chain (GstPad * pad, GstObject * parent,
|
|||
guint64 dist, ts;
|
||||
guint avail, sbpf;
|
||||
gpointer adata;
|
||||
gint bpf, channels, rate;
|
||||
gint bpf, rate;
|
||||
|
||||
scope = GST_AUDIO_VISUALIZER (parent);
|
||||
klass = GST_AUDIO_VISUALIZER_CLASS (G_OBJECT_GET_CLASS (scope));
|
||||
|
@ -1056,7 +1056,6 @@ gst_audio_visualizer_chain (GstPad * pad, GstObject * parent,
|
|||
}
|
||||
}
|
||||
|
||||
channels = GST_AUDIO_INFO_CHANNELS (&scope->ainfo);
|
||||
rate = GST_AUDIO_INFO_RATE (&scope->ainfo);
|
||||
bpf = GST_AUDIO_INFO_BPF (&scope->ainfo);
|
||||
|
||||
|
@ -1070,7 +1069,7 @@ gst_audio_visualizer_chain (GstPad * pad, GstObject * parent,
|
|||
g_mutex_lock (&scope->priv->config_lock);
|
||||
|
||||
/* this is what we want */
|
||||
sbpf = scope->req_spf * channels * sizeof (gint16);
|
||||
sbpf = scope->req_spf * bpf;
|
||||
|
||||
inbuf = scope->priv->inbuf;
|
||||
/* FIXME: the timestamp in the adapter would be different */
|
||||
|
@ -1134,7 +1133,7 @@ gst_audio_visualizer_chain (GstPad * pad, GstObject * parent,
|
|||
ret = default_prepare_output_buffer (scope, &outbuf);
|
||||
g_mutex_lock (&scope->priv->config_lock);
|
||||
/* recheck as the value could have changed */
|
||||
sbpf = scope->req_spf * channels * sizeof (gint16);
|
||||
sbpf = scope->req_spf * bpf;
|
||||
|
||||
/* no buffer allocated, we don't care why. */
|
||||
if (ret != GST_FLOW_OK)
|
||||
|
@ -1192,7 +1191,7 @@ gst_audio_visualizer_chain (GstPad * pad, GstObject * parent,
|
|||
|
||||
skip:
|
||||
/* recheck as the value could have changed */
|
||||
sbpf = scope->req_spf * channels * sizeof (gint16);
|
||||
sbpf = scope->req_spf * bpf;
|
||||
GST_LOG_OBJECT (scope, "avail: %u, bpf: %u", avail, sbpf);
|
||||
/* we want to take less or more, depending on spf : req_spf */
|
||||
if (avail - sbpf >= sbpf) {
|
||||
|
|
Loading…
Reference in a new issue