History

avcodec/aptxenc: Process data in complete blocks of four samples only

Do this by setting AVCodecInternal.pad_samples. This prevents reading into the frame's padding and writing into the packet's padding. This actually happened in our FATE tests (where the number of samples is 2 mod 4), which therefore needed to be updated.

Andreas Rheinhardt committed 5 years ago

Commit 129cbbd1 parent 017d9763 files · +8 −6Browse files

Unified · Split

3 files
  1. libavcodec/aptxenc.c +4 −2
  2. tests/ref/fate/aptx +2 −2
  3. tests/ref/fate/aptx-hd +2 −2
libavcodec/aptxenc.c+4−2
@@ -27,6 +27,7 @@ · 26 unmodified lines
2727 #include "audio_frame_queue.h"
2828 #include "codec_internal.h"
2929 #include "encode.h"
30+#include "internal.h"
3031
3132 typedef struct AptXEncContext {
3233 AptXContext common;
@@ -259,6 +260,7 @@ static av_cold int aptx_encode_init(AVCodecContext *avctx) · 226 unmodified lines
259260
260261 if (!avctx->frame_size || avctx->frame_size % 4)
261262 avctx->frame_size = 1024;
263+ avctx->internal->pad_samples = 4;
262264
263265 return ff_aptx_init(avctx);
264266 }
@@ -269,7 +271,7 @@ const FFCodec ff_aptx_encoder = { · 4 unmodified lines
269271 CODEC_LONG_NAME("aptX (Audio Processing Technology for Bluetooth)"),
270272 .p.type = AVMEDIA_TYPE_AUDIO,
271273 .p.id = AV_CODEC_ID_APTX,
272− .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_SMALL_LAST_FRAME,
274+ .p.capabilities = AV_CODEC_CAP_DR1,
273275 .priv_data_size = sizeof(AptXEncContext),
274276 .init = aptx_encode_init,
275277 FF_CODEC_ENCODE_CB(aptx_encode_frame),
@@ -290,7 +292,7 @@ const FFCodec ff_aptx_hd_encoder = { · 14 unmodified lines
290292 CODEC_LONG_NAME("aptX HD (Audio Processing Technology for Bluetooth)"),
291293 .p.type = AVMEDIA_TYPE_AUDIO,
292294 .p.id = AV_CODEC_ID_APTX_HD,
293− .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_SMALL_LAST_FRAME,
295+ .p.capabilities = AV_CODEC_CAP_DR1,
294296 .priv_data_size = sizeof(AptXEncContext),
295297 .init = aptx_encode_init,
296298 FF_CODEC_ENCODE_CB(aptx_encode_frame),
tests/ref/fate/aptx+2−2
@@ -1,5 +1,5 @@
1−b5d8a297c0e8d9854f19d9d3e8b82859 *tests/data/fate/aptx.aptx
2−418950 tests/data/fate/aptx.aptx
1+97dfd7f32d34fb74337c0f6c66e26e2d *tests/data/fate/aptx.aptx
2+418952 tests/data/fate/aptx.aptx
33 #tb 0: 1/44100
44 #media_type 0: audio
55 #codec_id 0: pcm_s16le
tests/ref/fate/aptx-hd+2−2
@@ -1,5 +1,5 @@
1−48ecaa81ee5adaaa62ed3ff6574b6666 *tests/data/fate/aptx-hd.aptx_hd
2−628425 tests/data/fate/aptx-hd.aptx_hd
1+6126e414af1acb193e24fdf33c7cac2e *tests/data/fate/aptx-hd.aptx_hd
2+628428 tests/data/fate/aptx-hd.aptx_hd
33 #tb 0: 1/44100
44 #media_type 0: audio
55 #codec_id 0: pcm_s32le

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t