rtp: tests: Simplify loop

All buffers can be added in 100 outer loops. Add buffer less than 200 in the last (i = 99) loop.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1489>
This commit is contained in:
Zhao, Gang 2024-03-10 16:41:07 +08:00
parent 15e7a63e7b
commit 7a46377627

View file

@ -74,12 +74,10 @@ fn test_pcma_splitting() {
let mut expected_pay = Vec::with_capacity(134);
let mut queued = 0;
let mut pos = 0;
for i in 0..134 {
if i < 100 {
queued += 480;
}
for i in 0..100 {
queued += 480;
while (i < 100 && queued >= 200) || (i == 100 && queued > 0) {
while queued >= 200 || (i == 99 && queued > 0) {
let size = cmp::min(queued, 400);
queued -= size;