mirror of https://github.com/thesofproject/sof.git
pcm_converter: do nothing when there are no samples
HiFi3 version of PCM converter can corrupt data or go into endless loop, when called with samples = 0. Make sure the processing functions return immediately if that happens. Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
This commit is contained in:
parent
90f83af891
commit
0996f794a1
|
@ -52,6 +52,10 @@ static void pcm_convert_s16_to_s24(const struct audio_stream *source,
|
||||||
ae_int32x2 *out32x2;
|
ae_int32x2 *out32x2;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
|
/* nothing to do */
|
||||||
|
if (!samples)
|
||||||
|
return;
|
||||||
|
|
||||||
/* required alignment for AE_L16X4_XC */
|
/* required alignment for AE_L16X4_XC */
|
||||||
while (!IS_ALIGNED((uintptr_t)in, 8)) {
|
while (!IS_ALIGNED((uintptr_t)in, 8)) {
|
||||||
/* set source as circular buffer */
|
/* set source as circular buffer */
|
||||||
|
@ -153,6 +157,10 @@ static void pcm_convert_s24_to_s16(const struct audio_stream *source,
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int leftover;
|
int leftover;
|
||||||
|
|
||||||
|
/* nothing to do */
|
||||||
|
if (!samples)
|
||||||
|
return;
|
||||||
|
|
||||||
/* required alignment for AE_L32X2_XC */
|
/* required alignment for AE_L32X2_XC */
|
||||||
if (!IS_ALIGNED((uintptr_t)in, 8)) {
|
if (!IS_ALIGNED((uintptr_t)in, 8)) {
|
||||||
/* set source as circular buffer */
|
/* set source as circular buffer */
|
||||||
|
@ -257,6 +265,10 @@ static void pcm_convert_s16_to_s32(const struct audio_stream *source,
|
||||||
ae_int32x2 *out32x2;
|
ae_int32x2 *out32x2;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
|
/* nothing to do */
|
||||||
|
if (!samples)
|
||||||
|
return;
|
||||||
|
|
||||||
/* required alignment for AE_L16X4_XC */
|
/* required alignment for AE_L16X4_XC */
|
||||||
while (!IS_ALIGNED((uintptr_t)in, 8)) {
|
while (!IS_ALIGNED((uintptr_t)in, 8)) {
|
||||||
/* set source as circular buffer */
|
/* set source as circular buffer */
|
||||||
|
@ -338,6 +350,10 @@ static void pcm_convert_s32_to_s16(const struct audio_stream *source,
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int leftover;
|
int leftover;
|
||||||
|
|
||||||
|
/* nothing to do */
|
||||||
|
if (!samples)
|
||||||
|
return;
|
||||||
|
|
||||||
/* required alignment for AE_L32X2_XC */
|
/* required alignment for AE_L32X2_XC */
|
||||||
if (!IS_ALIGNED((uintptr_t)in, 8)) {
|
if (!IS_ALIGNED((uintptr_t)in, 8)) {
|
||||||
/* set source as circular buffer */
|
/* set source as circular buffer */
|
||||||
|
@ -436,6 +452,10 @@ static void pcm_convert_s24_to_s32(const struct audio_stream *source,
|
||||||
ae_valign align_out = AE_ZALIGN64();
|
ae_valign align_out = AE_ZALIGN64();
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
/* nothing to do */
|
||||||
|
if (!samples)
|
||||||
|
return;
|
||||||
|
|
||||||
/* required alignment for AE_L32X2_XC */
|
/* required alignment for AE_L32X2_XC */
|
||||||
if (!IS_ALIGNED((uintptr_t)in, 8)) {
|
if (!IS_ALIGNED((uintptr_t)in, 8)) {
|
||||||
/* set source as circular buffer */
|
/* set source as circular buffer */
|
||||||
|
@ -522,6 +542,10 @@ static void pcm_convert_s32_to_s24(const struct audio_stream *source,
|
||||||
ae_valign align_out = AE_ZALIGN64();
|
ae_valign align_out = AE_ZALIGN64();
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
/* nothing to do */
|
||||||
|
if (!samples)
|
||||||
|
return;
|
||||||
|
|
||||||
/* required alignment for AE_L32X2_XC */
|
/* required alignment for AE_L32X2_XC */
|
||||||
if (!IS_ALIGNED((uintptr_t)in, 8)) {
|
if (!IS_ALIGNED((uintptr_t)in, 8)) {
|
||||||
/* set source as circular buffer */
|
/* set source as circular buffer */
|
||||||
|
|
Loading…
Reference in New Issue