Message ID | 20160901151445.18737-1-u@pkh.me |
---|---|
State | Changes Requested |
Headers | show |
On Thu, Sep 01, 2016 at 05:14:45PM +0200, Clément Bœsch wrote: > From: Clément Bœsch <clement@stupeflix.com> > > --- > ffmpeg.c | 19 +++++-------------- > 1 file changed, 5 insertions(+), 14 deletions(-) > > diff --git a/ffmpeg.c b/ffmpeg.c > index 3229823..493b605 100644 > --- a/ffmpeg.c > +++ b/ffmpeg.c > @@ -638,11 +638,11 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, OutputStream *ost) > AVCodecContext *avctx = ost->encoding_needed ? ost->enc_ctx : ost->st->codec; > int ret; > > - if (!ost->st->codec->extradata_size && ost->enc_ctx->extradata_size) { > - ost->st->codec->extradata = av_mallocz(ost->enc_ctx->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE); > - if (ost->st->codec->extradata) { > - memcpy(ost->st->codec->extradata, ost->enc_ctx->extradata, ost->enc_ctx->extradata_size); > - ost->st->codec->extradata_size = ost->enc_ctx->extradata_size; > + if (!ost->st->codecpar->extradata_size && ost->enc_ctx->extradata_size) { > + ost->st->codecpar->extradata = av_mallocz(ost->enc_ctx->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE); > + if (ost->st->codecpar->extradata) { > + memcpy(ost->st->codecpar->extradata, ost->enc_ctx->extradata, ost->enc_ctx->extradata_size); > + ost->st->codecpar->extradata_size = ost->enc_ctx->extradata_size; > } > } > Note that even dropping this chunk completely doesn't make any difference while trying to reproduce https://trac.ffmpeg.org/ticket/3909 (see ab84effde) > @@ -696,15 +696,6 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, OutputStream *ost) > } > if (pkt->size == 0 && pkt->side_data_elems == 0) > return; > - if (!ost->st->codecpar->extradata && avctx->extradata) { > - ost->st->codecpar->extradata = av_malloc(avctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); > - if (!ost->st->codecpar->extradata) { > - av_log(NULL, AV_LOG_ERROR, "Could not allocate extradata buffer to copy parser data.\n"); > - exit_program(1); > - } > - ost->st->codecpar->extradata_size = avctx->extradata_size; > - memcpy(ost->st->codecpar->extradata, avctx->extradata, avctx->extradata_size); > - } > This chunk was added in the merge 6f69f7a8b, I don't know what it's fixing.
On Thu, Sep 01, 2016 at 05:14:45PM +0200, Clément Bœsch wrote: > From: Clément Bœsch <clement@stupeflix.com> > > --- > ffmpeg.c | 19 +++++-------------- > 1 file changed, 5 insertions(+), 14 deletions(-) > > diff --git a/ffmpeg.c b/ffmpeg.c > index 3229823..493b605 100644 > --- a/ffmpeg.c > +++ b/ffmpeg.c > @@ -638,11 +638,11 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, OutputStream *ost) > AVCodecContext *avctx = ost->encoding_needed ? ost->enc_ctx : ost->st->codec; > int ret; > > - if (!ost->st->codec->extradata_size && ost->enc_ctx->extradata_size) { > - ost->st->codec->extradata = av_mallocz(ost->enc_ctx->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE); > - if (ost->st->codec->extradata) { > - memcpy(ost->st->codec->extradata, ost->enc_ctx->extradata, ost->enc_ctx->extradata_size); > - ost->st->codec->extradata_size = ost->enc_ctx->extradata_size; > + if (!ost->st->codecpar->extradata_size && ost->enc_ctx->extradata_size) { > + ost->st->codecpar->extradata = av_mallocz(ost->enc_ctx->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE); > + if (ost->st->codecpar->extradata) { > + memcpy(ost->st->codecpar->extradata, ost->enc_ctx->extradata, ost->enc_ctx->extradata_size); > + ost->st->codecpar->extradata_size = ost->enc_ctx->extradata_size; > } > } > > @@ -696,15 +696,6 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, OutputStream *ost) > } > if (pkt->size == 0 && pkt->side_data_elems == 0) > return; > - if (!ost->st->codecpar->extradata && avctx->extradata) { > - ost->st->codecpar->extradata = av_malloc(avctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); > - if (!ost->st->codecpar->extradata) { > - av_log(NULL, AV_LOG_ERROR, "Could not allocate extradata buffer to copy parser data.\n"); > - exit_program(1); > - } > - ost->st->codecpar->extradata_size = avctx->extradata_size; > - memcpy(ost->st->codecpar->extradata, avctx->extradata, avctx->extradata_size); > - } > > if (!(s->oformat->flags & AVFMT_NOTIMESTAMPS)) { > if (pkt->dts != AV_NOPTS_VALUE && this changes the output of: ./ffmpeg -i tickets/3715/foo.aac -c copy -bsf:a aac_adtstoasc -t 0.1 out.m4a (extradata seem lost) [...]
diff --git a/ffmpeg.c b/ffmpeg.c index 3229823..493b605 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -638,11 +638,11 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, OutputStream *ost) AVCodecContext *avctx = ost->encoding_needed ? ost->enc_ctx : ost->st->codec; int ret; - if (!ost->st->codec->extradata_size && ost->enc_ctx->extradata_size) { - ost->st->codec->extradata = av_mallocz(ost->enc_ctx->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE); - if (ost->st->codec->extradata) { - memcpy(ost->st->codec->extradata, ost->enc_ctx->extradata, ost->enc_ctx->extradata_size); - ost->st->codec->extradata_size = ost->enc_ctx->extradata_size; + if (!ost->st->codecpar->extradata_size && ost->enc_ctx->extradata_size) { + ost->st->codecpar->extradata = av_mallocz(ost->enc_ctx->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE); + if (ost->st->codecpar->extradata) { + memcpy(ost->st->codecpar->extradata, ost->enc_ctx->extradata, ost->enc_ctx->extradata_size); + ost->st->codecpar->extradata_size = ost->enc_ctx->extradata_size; } } @@ -696,15 +696,6 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, OutputStream *ost) } if (pkt->size == 0 && pkt->side_data_elems == 0) return; - if (!ost->st->codecpar->extradata && avctx->extradata) { - ost->st->codecpar->extradata = av_malloc(avctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); - if (!ost->st->codecpar->extradata) { - av_log(NULL, AV_LOG_ERROR, "Could not allocate extradata buffer to copy parser data.\n"); - exit_program(1); - } - ost->st->codecpar->extradata_size = avctx->extradata_size; - memcpy(ost->st->codecpar->extradata, avctx->extradata, avctx->extradata_size); - } if (!(s->oformat->flags & AVFMT_NOTIMESTAMPS)) { if (pkt->dts != AV_NOPTS_VALUE &&
From: Clément Bœsch <clement@stupeflix.com> --- ffmpeg.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-)