mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-26 17:32:06 +00:00
avcodec/aptxdec: Process data in complete blocks only
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 and writing into the frame's padding. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
c8707c105f
commit
e6bfb14223
@ -151,7 +151,7 @@ static int aptx_decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
|||||||
/* get output buffer */
|
/* get output buffer */
|
||||||
frame->ch_layout.nb_channels = NB_CHANNELS;
|
frame->ch_layout.nb_channels = NB_CHANNELS;
|
||||||
frame->format = AV_SAMPLE_FMT_S32P;
|
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)
|
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user