Skip to contentSkip to conversation

audio: st_rate_flow exist a dead loop

PATCH New Peng Hao 1 participant 1 message Jul 4, 2017

lore
Share & tools
lore

Peng Hao

author
#0 lore raw

PATCH 1/1 audio: st_rate_flow exist a dead loop

From: Hao Peng <[email protected]>

if audio device is opend for a long time in windows vm, there is a uint32_t varaible reversal. It will result to a dead loop.

---
 audio/rate_template.h | 5 +++++
 1 file changed, 5 insertions(+)
audio/rate_template.h +5 -0
index bd4b1c7..1aa6c43 100644
@@ -71,6 +71,11 @@ void NAME (void *opaque, struct st_sample *ibuf, struct st_sample *obuf,
         while (rate->ipos <= (rate->opos >> 32)) {
             ilast = *ibuf++;
             rate->ipos++;
+            /* if ipos reversal, there is  a dead loop */
+            if (rate->ipos == 0xffffffff) {
+                rate->ipos = 1;
+                rate->opos = rate->opos & 0xffffffff;
+            }
             /* See if we finished the input buffer yet */
             if (ibuf >= iend) {
                 goto the_end;
Signature · 1 line
1.8.3.1