net/aws: fix sanity check in transcribe loop

When we receive a new alternative we want to avoid iterating out of
bounds, but the comparison between the current index and the length of
the alternative should not log an error when partial_index == length, as
Vec::drain(length..) is valid, and it is completely valid for AWS to
send us a new alternative with as many items as we have already
dequeued.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1751>
This commit is contained in:
Mathieu Duponchelle 2024-08-26 11:37:08 +02:00
parent 7e912b0dde
commit 66727188cf

View file

@ -237,7 +237,7 @@ impl TranscriberStream {
mut items: Vec<types::Item>, mut items: Vec<types::Item>,
partial: bool, partial: bool,
) -> Option<Vec<TranscriptItem>> { ) -> Option<Vec<TranscriptItem>> {
if items.len() <= self.partial_index { if items.len() < self.partial_index {
gst::error!( gst::error!(
CAT, CAT,
imp = self.imp, imp = self.imp,