diff mbox series

[FFmpeg-devel,v2,09/10] avcodec/aptxdec: Process data in complete blocks only

Message ID AM7PR03MB66601926B132C3C41E476E4E8FCC9@AM7PR03MB6660.eurprd03.prod.outlook.com
State New
Headers show
Series [FFmpeg-devel,v2,01/10] tests/fate-run: Allow multiple inputs for transcode()
Related show

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Andreas Rheinhardt Aug. 31, 2021, 12:42 p.m. UTC
The APTX (HD) decoder decodes blocks of four (six) bytes to four
output samples. It makes no sense to handle incomplete blocks:
They would just lead to synchronization errors, in which case
the complete frame is discarded. So only handle complete blocks.
This also avoids reading from the packet's padding.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/aptxdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Paul B Mahol Sept. 1, 2021, 6:31 a.m. UTC | #1
lgtm
diff mbox series

Patch

diff --git a/libavcodec/aptxdec.c b/libavcodec/aptxdec.c
index bdcc076c41..de661476b7 100644
--- a/libavcodec/aptxdec.c
+++ b/libavcodec/aptxdec.c
@@ -148,7 +148,7 @@  static int aptx_decode_frame(AVCodecContext *avctx, void *data,
     /* get output buffer */
     frame->channels = NB_CHANNELS;
     frame->format = AV_SAMPLE_FMT_S32P;
-    frame->nb_samples = 4 * avpkt->size / s->block_size;
+    frame->nb_samples = 4 * (avpkt->size / s->block_size);
     if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
         return ret;