Commit c1f57e2f authored by Ivan's avatar Ivan Committed by Michael Niedermayer

libavformat/flvenc: support for codec configuration change mid stream

Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 52985768
...@@ -566,6 +566,19 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -566,6 +566,19 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt)
else else
flags_size = 1; flags_size = 1;
if (par->codec_id == AV_CODEC_ID_AAC || par->codec_id == AV_CODEC_ID_H264
|| par->codec_id == AV_CODEC_ID_MPEG4) {
int side_size = 0;
uint8_t *side = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, &side_size);
if (side && side_size > 0 && (side_size != par->extradata_size || memcmp(side, par->extradata, side_size))) {
av_free(par->extradata);
par->extradata = av_mallocz(side_size + AV_INPUT_BUFFER_PADDING_SIZE);
memcpy(par->extradata, side, side_size);
par->extradata_size = side_size;
flv_write_codec_header(s, par);
}
}
if (flv->delay == AV_NOPTS_VALUE) if (flv->delay == AV_NOPTS_VALUE)
flv->delay = -pkt->dts; flv->delay = -pkt->dts;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment