[FFmpeg-devel,6/6] ffmpeg: remove bsf extradata propagation hack

Submitted by James Almer on April 13, 2017, 7:54 p.m.

Details

Message ID 20170413195417.9064-6-jamrial@gmail.com
State New
Headers show

Commit Message

James Almer April 13, 2017, 7:54 p.m.
The offending bitstream filter was fixed, so this is no longer needed.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 ffmpeg.c     | 19 -------------------
 ffmpeg.h     |  1 -
 ffmpeg_opt.c |  7 -------
 3 files changed, 27 deletions(-)

Patch hide | download patch | download mbox

diff --git a/ffmpeg.c b/ffmpeg.c
index e4b94b2fa0..1a0f6a57f1 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -536,7 +536,6 @@  static void ffmpeg_cleanup(int ret)
         for (j = 0; j < ost->nb_bitstream_filters; j++)
             av_bsf_free(&ost->bsf_ctx[j]);
         av_freep(&ost->bsf_ctx);
-        av_freep(&ost->bsf_extradata_updated);
 
         av_frame_free(&ost->filtered_frame);
         av_frame_free(&ost->last_frame);
@@ -835,27 +834,9 @@  static void output_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost)
                 continue;
             } else if (ret < 0)
                 goto finish;
-            /* HACK! - aac_adtstoasc updates extradata after filtering the first frame when
-             * the api states this shouldn't happen after init(). Propagate it here to the
-             * muxer and to the next filters in the chain to workaround this.
-             * TODO/FIXME - Make aac_adtstoasc use new packet side data instead of changing
-             * par_out->extradata and adapt muxers accordingly to get rid of this. */
-            if (!(ost->bsf_extradata_updated[idx - 1] & 1)) {
-                ret = avcodec_parameters_copy(ost->st->codecpar, ost->bsf_ctx[idx - 1]->par_out);
-                if (ret < 0)
-                    goto finish;
-                ost->bsf_extradata_updated[idx - 1] |= 1;
-            }
 
             /* send it to the next filter down the chain or to the muxer */
             if (idx < ost->nb_bitstream_filters) {
-                /* HACK/FIXME! - See above */
-                if (!(ost->bsf_extradata_updated[idx] & 2)) {
-                    ret = avcodec_parameters_copy(ost->bsf_ctx[idx]->par_out, ost->bsf_ctx[idx - 1]->par_out);
-                    if (ret < 0)
-                        goto finish;
-                    ost->bsf_extradata_updated[idx] |= 2;
-                }
                 ret = av_bsf_send_packet(ost->bsf_ctx[idx], pkt);
                 if (ret < 0)
                     goto finish;
diff --git a/ffmpeg.h b/ffmpeg.h
index 4d0456c1fb..1a381aa345 100644
--- a/ffmpeg.h
+++ b/ffmpeg.h
@@ -455,7 +455,6 @@  typedef struct OutputStream {
     AVRational mux_timebase;
 
     int                    nb_bitstream_filters;
-    uint8_t                  *bsf_extradata_updated;
     AVBSFContext            **bsf_ctx;
 
     AVCodecContext *enc_ctx;
diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
index d1fe8742ff..08e03c4ef9 100644
--- a/ffmpeg_opt.c
+++ b/ffmpeg_opt.c
@@ -1374,13 +1374,6 @@  static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e
         if (*bsfs)
             bsfs++;
     }
-    if (ost->nb_bitstream_filters) {
-        ost->bsf_extradata_updated = av_mallocz_array(ost->nb_bitstream_filters, sizeof(*ost->bsf_extradata_updated));
-        if (!ost->bsf_extradata_updated) {
-            av_log(NULL, AV_LOG_FATAL, "Bitstream filter memory allocation failed\n");
-            exit_program(1);
-        }
-    }
 
     MATCH_PER_STREAM_OPT(codec_tags, str, codec_tag, oc, st);
     if (codec_tag) {