[FFmpeg-cvslog] avcodec: remove AVCodecContext->metadata

Hendrik Leppkes git at videolan.org
Wed Mar 13 20:17:54 CET 2013


ffmpeg | branch: master | Hendrik Leppkes <h.leppkes at gmail.com> | Wed Mar 13 17:51:06 2013 +0100| [84bf1cbef9111341e2030aa91bc8279d08e8b345] | committer: Michael Niedermayer

avcodec: remove AVCodecContext->metadata

This field was only ever set and freed from avcodec, and not otherwise
used. However, because frames are refcounted now, avcodec cannot make any
assumptions about the lifetime of the frame metadata, which can result in
double-frees or leaked memory.

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=84bf1cbef9111341e2030aa91bc8279d08e8b345
---

 libavcodec/avcodec.h |    7 -------
 libavcodec/utils.c   |    3 ---
 2 files changed, 10 deletions(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 7145a46..a46a8d6 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2793,13 +2793,6 @@ typedef struct AVCodecContext {
     int64_t pts_correction_last_dts;       /// DTS of the last frame
 
     /**
-     * Current frame metadata.
-     * - decoding: maintained and used by libavcodec, not intended to be used by user apps
-     * - encoding: unused
-     */
-    AVDictionary *metadata;
-
-    /**
      * Character encoding of the input subtitles file.
      * - decoding: set by user
      * - encoding: unused
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 3a2c828..46fc710 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1862,7 +1862,6 @@ static int add_metadata_from_side_data(AVCodecContext *avctx, AVFrame *frame)
     const uint8_t *side_metadata;
     const uint8_t *end;
 
-    av_dict_free(&avctx->metadata);
     side_metadata = av_packet_get_side_data(avctx->pkt,
                                             AV_PKT_DATA_STRINGS_METADATA, &size);
     if (!side_metadata)
@@ -1877,7 +1876,6 @@ static int add_metadata_from_side_data(AVCodecContext *avctx, AVFrame *frame)
         side_metadata = val + strlen(val) + 1;
     }
 end:
-    avctx->metadata = av_frame_get_metadata(frame);
     return ret;
 }
 
@@ -2298,7 +2296,6 @@ av_cold int avcodec_close(AVCodecContext *avctx)
             av_buffer_pool_uninit(&pool->pools[i]);
         av_freep(&avctx->internal->pool);
         av_freep(&avctx->internal);
-        av_dict_free(&avctx->metadata);
     }
 
     if (avctx->priv_data && avctx->codec && avctx->codec->priv_class)



More information about the ffmpeg-cvslog mailing list