mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
baseaudiovisualizer: fix last block condition
Also push out the last frame if we have exact amount of samples. Fix the adapter flushing to not cause endless loops. Drop a redundant avail() check.
This commit is contained in:
parent
594134d139
commit
f7fe0c9e6f
1 changed files with 7 additions and 5 deletions
|
@ -727,7 +727,8 @@ gst_base_audio_visualizer_chain (GstPad * pad, GstBuffer * buffer)
|
|||
|
||||
/* this is what we have */
|
||||
avail = gst_adapter_available (scope->adapter);
|
||||
while (avail > sbpf) {
|
||||
GST_LOG_OBJECT (scope, "avail: %u, bpf: %u", avail, sbpf);
|
||||
while (avail >= sbpf) {
|
||||
GstBuffer *outbuf;
|
||||
|
||||
ret = gst_pad_alloc_buffer_and_set_caps (scope->srcpad,
|
||||
|
@ -770,10 +771,13 @@ gst_base_audio_visualizer_chain (GstPad * pad, GstBuffer * buffer)
|
|||
|
||||
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)
|
||||
if (avail - sbpf >= sbpf) {
|
||||
gst_adapter_flush (scope->adapter, sbpf);
|
||||
else if (avail - sbpf > 0)
|
||||
} else if (avail - sbpf >= 0) {
|
||||
/* just flush a bit and stop */
|
||||
gst_adapter_flush (scope->adapter, (avail - sbpf));
|
||||
break;
|
||||
}
|
||||
avail = gst_adapter_available (scope->adapter);
|
||||
|
||||
if (ret != GST_FLOW_OK)
|
||||
|
@ -781,8 +785,6 @@ gst_base_audio_visualizer_chain (GstPad * pad, GstBuffer * buffer)
|
|||
|
||||
if (scope->next_ts != GST_CLOCK_TIME_NONE)
|
||||
scope->next_ts += scope->frame_duration;
|
||||
|
||||
avail = gst_adapter_available (scope->adapter);
|
||||
}
|
||||
|
||||
gst_object_unref (scope);
|
||||
|
|
Loading…
Reference in a new issue