baseparse: Fix upstream read caching 31/244931/3
authorJan Schmidt <jan@centricular.com>
Tue, 31 Mar 2020 15:36:40 +0000 (02:36 +1100)
committerGilbok Lee <gilbok.lee@samsung.com>
Mon, 28 Sep 2020 05:21:40 +0000 (14:21 +0900)
commit4cc3d6a9b771bfe25f8087ac850572282d1ad02e
tree0657df42d87aaa5aec74c8aeaf3639cfc3945f77
parent3e25215e16024af5795d50b97855b68ad577aa7e
baseparse: Fix upstream read caching

When running in pull mode (for e.g. mp3 reading),
baseparse currently reads 64KB from upstream, then mp3parse
consumes typically around 417/418 bytes of it. Then
on the next loop, it will read a full fresh 64KB again,
which is a big waste.

Fix the read loop to use the available cache buffer first
before going for more data, until the cache drops to < 1KB.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/518

Change-Id: Ica6d6cf09e3797eff16e2450de405bfef0ac16a2
libs/gst/base/gstbaseparse.c
packaging/gstreamer.spec
tests/check/libs/baseparse.c