Message ID | 20170413195417.9064-1-jamrial@gmail.com |
---|---|
State | Accepted |
Commit | f8c73e87532a80821422db9972514c0405b17047 |
Headers | show |
On Thu, Apr 13, 2017 at 04:54:12PM -0300, James Almer wrote: > Don't just look at zero sized packets, and also check for AAC extradata > updates, in preparation for the following patches. > > Signed-off-by: James Almer <jamrial@gmail.com> > --- > libavformat/movenc.c | 34 ++++++++++++++++++---------------- > 1 file changed, 18 insertions(+), 16 deletions(-) should be ok thx [...]
On 4/13/2017 4:54 PM, James Almer wrote: > Don't just look at zero sized packets, and also check for AAC extradata > updates, in preparation for the following patches. > > Signed-off-by: James Almer <jamrial@gmail.com> > --- > libavformat/movenc.c | 34 ++++++++++++++++++---------------- > 1 file changed, 18 insertions(+), 16 deletions(-) Ping for the set.
On 5/18/2017 8:15 PM, James Almer wrote: > On 4/13/2017 4:54 PM, James Almer wrote: >> Don't just look at zero sized packets, and also check for AAC extradata >> updates, in preparation for the following patches. >> >> Signed-off-by: James Almer <jamrial@gmail.com> >> --- >> libavformat/movenc.c | 34 ++++++++++++++++++---------------- >> 1 file changed, 18 insertions(+), 16 deletions(-) > > Ping for the set. I'll push this set soon.
On 4/15/2017 7:56 PM, Michael Niedermayer wrote: > On Thu, Apr 13, 2017 at 04:54:12PM -0300, James Almer wrote: >> Don't just look at zero sized packets, and also check for AAC extradata >> updates, in preparation for the following patches. >> >> Signed-off-by: James Almer <jamrial@gmail.com> >> --- >> libavformat/movenc.c | 34 ++++++++++++++++++---------------- >> 1 file changed, 18 insertions(+), 16 deletions(-) > > should be ok > > thx Patchset pushed, thanks.
diff --git a/libavformat/movenc.c b/libavformat/movenc.c index e6e2313c53..d4fa60b029 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -5303,6 +5303,24 @@ static int mov_write_single_packet(AVFormatContext *s, AVPacket *pkt) mov->flags &= ~FF_MOV_FLAG_FRAG_DISCONT; } + if (trk->par->codec_id == AV_CODEC_ID_MP4ALS || + trk->par->codec_id == AV_CODEC_ID_AAC || + trk->par->codec_id == AV_CODEC_ID_FLAC) { + 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))) { + void *newextra = av_mallocz(side_size + AV_INPUT_BUFFER_PADDING_SIZE); + if (!newextra) + return AVERROR(ENOMEM); + av_free(par->extradata); + par->extradata = newextra; + memcpy(par->extradata, side, side_size); + par->extradata_size = side_size; + if (!pkt->size) // Flush packet + mov->need_rewrite_extradata = 1; + } + } + if (!pkt->size) { if (trk->start_dts == AV_NOPTS_VALUE && trk->frag_discont) { trk->start_dts = pkt->dts; @@ -5312,22 +5330,6 @@ static int mov_write_single_packet(AVFormatContext *s, AVPacket *pkt) trk->start_cts = 0; } - if (trk->par->codec_id == AV_CODEC_ID_MP4ALS || - trk->par->codec_id == AV_CODEC_ID_FLAC) { - 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))) { - void *newextra = av_mallocz(side_size + AV_INPUT_BUFFER_PADDING_SIZE); - if (!newextra) - return AVERROR(ENOMEM); - av_free(par->extradata); - par->extradata = newextra; - memcpy(par->extradata, side, side_size); - par->extradata_size = side_size; - mov->need_rewrite_extradata = 1; - } - } - return 0; /* Discard 0 sized packets */ }
Don't just look at zero sized packets, and also check for AAC extradata updates, in preparation for the following patches. Signed-off-by: James Almer <jamrial@gmail.com> --- libavformat/movenc.c | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-)