avcodec/aac_adtstoasc: propagate new extradata using packet side data

This removes the current API violating behavior of overwritting the stream's
extradata during packet filtering, something that should not happen after the
av_bsf_init() call.

The bitstream filter generated extradata is no longer available during
write_header(), and as such not usable with non seekable output. The FATE
tests are updated to reflect this.

Signed-off-by: James Almer <jamrial@gmail.com>
pull/28/merge
James Almer 8 years ago
parent 210388a197
commit f63c351657
  1. 5
      libavcodec/aac_adtstoasc_bsf.c
  2. 5
      tests/fate/aac.mak
  3. 4
      tests/fate/avformat.mak
  4. 43
      tests/ref/fate/aac-autobsf-adtstoasc

@ -97,7 +97,8 @@ static int aac_adtstoasc_filter(AVBSFContext *bsfc, AVPacket *out)
in->data += get_bits_count(&gb)/8; in->data += get_bits_count(&gb)/8;
} }
extradata = av_mallocz(2 + pce_size + AV_INPUT_BUFFER_PADDING_SIZE); extradata = av_packet_new_side_data(in, AV_PKT_DATA_NEW_EXTRADATA,
2 + pce_size);
if (!extradata) { if (!extradata) {
ret = AVERROR(ENOMEM); ret = AVERROR(ENOMEM);
goto fail; goto fail;
@ -115,8 +116,6 @@ static int aac_adtstoasc_filter(AVBSFContext *bsfc, AVPacket *out)
memcpy(extradata + 2, pce_data, pce_size); memcpy(extradata + 2, pce_data, pce_size);
} }
bsfc->par_out->extradata = extradata;
bsfc->par_out->extradata_size = 2 + pce_size;
ctx->first_frame_done = 1; ctx->first_frame_done = 1;
} }

@ -245,9 +245,8 @@ FATE_AAC_LATM += fate-aac-latm_stereo_to_51
fate-aac-latm_stereo_to_51: CMD = pcm -i $(TARGET_SAMPLES)/aac/latm_stereo_to_51.ts -channel_layout 5.1 fate-aac-latm_stereo_to_51: CMD = pcm -i $(TARGET_SAMPLES)/aac/latm_stereo_to_51.ts -channel_layout 5.1
fate-aac-latm_stereo_to_51: REF = $(SAMPLES)/aac/latm_stereo_to_51_ref.s16 fate-aac-latm_stereo_to_51: REF = $(SAMPLES)/aac/latm_stereo_to_51_ref.s16
fate-aac-autobsf-adtstoasc: CMD = md5 -i $(TARGET_SAMPLES)/audiomatch/tones_afconvert_16000_mono_aac_lc.adts -acodec copy -fflags +bitexact -f matroska fate-aac-autobsf-adtstoasc: CMD = transcode "aac" $(TARGET_SAMPLES)/audiomatch/tones_afconvert_16000_mono_aac_lc.adts \
fate-aac-autobsf-adtstoasc: CMP = oneline matroska "-c:a copy" "-c:a copy"
fate-aac-autobsf-adtstoasc: REF = 8c76732bd04d9eb3468f9f842439774d
FATE_AAC-$(call DEMDEC, AAC, AAC) += $(FATE_AAC_CT_RAW) FATE_AAC-$(call DEMDEC, AAC, AAC) += $(FATE_AAC_CT_RAW)
FATE_AAC-$(call DEMDEC, MOV, AAC) += $(FATE_AAC) FATE_AAC-$(call DEMDEC, MOV, AAC) += $(FATE_AAC)

@ -93,14 +93,14 @@ tests/data/mp4-to-ts.m3u8: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data
tests/data/adts-to-mkv.m3u8: TAG = GEN tests/data/adts-to-mkv.m3u8: TAG = GEN
tests/data/adts-to-mkv.m3u8: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data tests/data/adts-to-mkv.m3u8: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data
$(M)$(TARGET_EXEC) $(TARGET_PATH)/$< \ $(M)$(TARGET_EXEC) $(TARGET_PATH)/$< \
-i $(TARGET_SAMPLES)/audiomatch/tones_afconvert_16000_mono_aac_lc.adts \ -i $(TARGET_SAMPLES)/audiomatch/tones_afconvert_16000_mono_aac_lc.m4a \
-f segment -segment_time 1 -map 0 -flags +bitexact -codec copy -segment_format_options live=1 \ -f segment -segment_time 1 -map 0 -flags +bitexact -codec copy -segment_format_options live=1 \
-segment_list $(TARGET_PATH)/$@ -y $(TARGET_PATH)/tests/data/adts-to-mkv-%03d.mkv 2>/dev/null -segment_list $(TARGET_PATH)/$@ -y $(TARGET_PATH)/tests/data/adts-to-mkv-%03d.mkv 2>/dev/null
tests/data/adts-to-mkv-header.mkv: TAG = GEN tests/data/adts-to-mkv-header.mkv: TAG = GEN
tests/data/adts-to-mkv-header.mkv: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data tests/data/adts-to-mkv-header.mkv: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data
$(M)$(TARGET_EXEC) $(TARGET_PATH)/$< \ $(M)$(TARGET_EXEC) $(TARGET_PATH)/$< \
-i $(TARGET_SAMPLES)/audiomatch/tones_afconvert_16000_mono_aac_lc.adts \ -i $(TARGET_SAMPLES)/audiomatch/tones_afconvert_16000_mono_aac_lc.m4a \
-f segment -segment_time 1 -map 0 -flags +bitexact -codec copy -segment_format_options live=1 \ -f segment -segment_time 1 -map 0 -flags +bitexact -codec copy -segment_format_options live=1 \
-segment_header_filename $(TARGET_PATH)/tests/data/adts-to-mkv-header.mkv \ -segment_header_filename $(TARGET_PATH)/tests/data/adts-to-mkv-header.mkv \
-y $(TARGET_PATH)/tests/data/adts-to-mkv-header-%03d.mkv 2>/dev/null -y $(TARGET_PATH)/tests/data/adts-to-mkv-header-%03d.mkv 2>/dev/null

@ -0,0 +1,43 @@
b0375ba00bcbd55023a176255b8d4ba2 *tests/data/fate/aac-autobsf-adtstoasc.matroska
6728 tests/data/fate/aac-autobsf-adtstoasc.matroska
#extradata 0: 2, 0x0030001c
#tb 0: 1/1000
#media_type 0: audio
#codec_id 0: aac
#sample_rate 0: 16000
#channel_layout 0: 4
#channel_layout_name 0: mono
0, 0, 0, 64, 4, 0x02f70117
0, 64, 64, 64, 163, 0xd5f85007
0, 128, 128, 64, 127, 0x66484065
0, 192, 192, 64, 94, 0x55222bd6
0, 256, 256, 64, 314, 0x3c7e923a
0, 320, 320, 64, 207, 0x1efc5d1b
0, 384, 384, 64, 119, 0xb2a13601
0, 448, 448, 64, 184, 0xcafc6091
0, 512, 512, 64, 132, 0xddd33c0b
0, 576, 576, 64, 152, 0x83935031
0, 640, 640, 64, 227, 0x32a86bc4
0, 704, 704, 64, 122, 0xd04e3571
0, 768, 768, 64, 163, 0x57d44d16
0, 832, 832, 64, 147, 0x226043d7
0, 896, 896, 64, 119, 0x8ad931ed
0, 960, 960, 64, 153, 0xbb6e432f
0, 1024, 1024, 64, 185, 0xa01f4ff3
0, 1088, 1088, 64, 126, 0x85503ce6
0, 1152, 1152, 64, 246, 0x652c7b59
0, 1216, 1216, 64, 162, 0xc9f04da0
0, 1280, 1280, 64, 135, 0x71fa3be0
0, 1344, 1344, 64, 246, 0x7a6f7788
0, 1408, 1408, 64, 262, 0xd3097781
0, 1472, 1472, 64, 60, 0x09a118f5
0, 1536, 1536, 64, 255, 0xbab5793c
0, 1600, 1600, 64, 153, 0x6b6a44fb
0, 1664, 1664, 64, 160, 0x550e4530
0, 1728, 1728, 64, 215, 0x7fe66144
0, 1792, 1792, 64, 144, 0xcd723f7d
0, 1856, 1856, 64, 187, 0x2a0b5c1b
0, 1920, 1920, 64, 177, 0xb8c355d5
0, 1984, 1984, 64, 156, 0x867d4f3a
0, 2048, 2048, 64, 201, 0x62745ff9
0, 2112, 2112, 64, 137, 0x90c639e0
Loading…
Cancel
Save