From cc1dea140ad054e70c76c2cc39dcc5f8e3509b77 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 7 Apr 2013 17:20:42 +0200 Subject: [PATCH] mp3dec: recover from PCM write errors without crashing --- src/driver/audiodec/mp3dec.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/driver/audiodec/mp3dec.cpp b/src/driver/audiodec/mp3dec.cpp index c0fa2da42..458873e56 100644 --- a/src/driver/audiodec/mp3dec.cpp +++ b/src/driver/audiodec/mp3dec.cpp @@ -768,6 +768,8 @@ q * next mad_frame_decode() invocation. (See the comments marked { fprintf(stderr,"%s: PCM write error in stereo (%s).\n", ProgName, strerror(errno)); Status = WRITE_ERR; + Synth.pcm.length = 0; /* discard buffer */ + OutputPtr = OutputBuffer; break; } @@ -835,6 +837,8 @@ q * next mad_frame_decode() invocation. (See the comments marked { fprintf(stderr,"%s: PCM write error in mono (%s).\n", ProgName, strerror(errno)); Status = WRITE_ERR; + Synth.pcm.length = 0; /* discard buffer */ + OutputPtr = OutputBuffer; break; }