mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-01-28 02:02:46 +00:00
avcodec/adtsenc: check packet side data for AAC extradata updates
This is in preparation for the following patch. Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
parent
8b3ec51de8
commit
210388a197
@ -149,11 +149,28 @@ static int adts_write_frame_header(ADTSContext *ctx,
|
||||
static int adts_write_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
{
|
||||
ADTSContext *adts = s->priv_data;
|
||||
AVCodecParameters *par = s->streams[0]->codecpar;
|
||||
AVIOContext *pb = s->pb;
|
||||
uint8_t buf[ADTS_HEADER_SIZE];
|
||||
|
||||
if (!pkt->size)
|
||||
return 0;
|
||||
if (!par->extradata_size) {
|
||||
uint8_t *side_data;
|
||||
int side_data_size = 0, ret;
|
||||
|
||||
side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA,
|
||||
&side_data_size);
|
||||
if (side_data_size) {
|
||||
ret = adts_decode_extradata(s, adts, side_data, side_data_size);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
ret = ff_alloc_extradata(par, side_data_size);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
memcpy(par->extradata, side_data, side_data_size);
|
||||
}
|
||||
}
|
||||
if (adts->write_adts) {
|
||||
int err = adts_write_frame_header(adts, buf, pkt->size,
|
||||
adts->pce_size);
|
||||
|
Loading…
Reference in New Issue
Block a user