

fix: Correct closing logic in AudioStream to prevent discarding remaining data
@026ed53b1dcca135009be241cb876b4cd6a8a9a4
--- faster_whisper_server/audio.py
+++ faster_whisper_server/audio.py
... | ... | @@ -87,12 +87,15 @@ |
87 | 87 |
while True: |
88 | 88 |
await self.modify_event.wait() |
89 | 89 |
self.modify_event.clear() |
90 |
- if self.closed or self.duration - i >= min_duration: |
|
90 |
+ |
|
91 |
+ if self.closed: |
|
92 |
+ if self.duration > i: |
|
93 |
+ yield self.after(i).data |
|
94 |
+ return |
|
95 |
+ if self.duration - i >= min_duration: |
|
91 | 96 |
# If `i` shouldn't be set to `duration` after the yield |
92 | 97 |
# because by the time assignment would happen more data might have been added |
93 | 98 |
i_ = i |
94 | 99 |
i = self.duration |
95 | 100 |
# NOTE: probably better to just to a slice |
96 | 101 |
yield self.after(i_).data |
97 |
- if self.closed: |
|
98 |
- return |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?