diff options
author | Zhao Zhili <quinkblack@foxmail.com> | 2019-11-03 01:41:18 +0800 |
---|---|---|
committer | Marton Balint <cus@passwd.hu> | 2019-11-11 22:15:45 +0100 |
commit | 20c5f4d8358e5dab2eb87e611167987a4840122a (patch) | |
tree | e9a10e2546c65d0aaac5d396741766cea44653ab /libavutil | |
parent | 0e495608069550915ee13c14bb657c8e0eb89f25 (diff) | |
download | ffmpeg-20c5f4d8358e5dab2eb87e611167987a4840122a.tar.gz |
avutil/frame: fix remove_side_data
remove_side_data is supposed to remove a single instance by design.
Since new_side_data() doesn't forbid add multiple instances of the
same type, remove_side_data should deal with that.
Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'libavutil')
-rw-r--r-- | libavutil/frame.c | 2 | ||||
-rw-r--r-- | libavutil/frame.h | 3 |
2 files changed, 2 insertions, 3 deletions
diff --git a/libavutil/frame.c b/libavutil/frame.c index dcf1fc3d17..e4038096c2 100644 --- a/libavutil/frame.c +++ b/libavutil/frame.c @@ -806,7 +806,7 @@ void av_frame_remove_side_data(AVFrame *frame, enum AVFrameSideDataType type) { int i; - for (i = 0; i < frame->nb_side_data; i++) { + for (i = frame->nb_side_data - 1; i >= 0; i--) { AVFrameSideData *sd = frame->side_data[i]; if (sd->type == type) { free_side_data(&frame->side_data[i]); diff --git a/libavutil/frame.h b/libavutil/frame.h index 5d3231e7bb..b5afb58634 100644 --- a/libavutil/frame.h +++ b/libavutil/frame.h @@ -920,8 +920,7 @@ AVFrameSideData *av_frame_get_side_data(const AVFrame *frame, enum AVFrameSideDataType type); /** - * If side data of the supplied type exists in the frame, free it and remove it - * from the frame. + * Remove and free all side data instances of the given type. */ void av_frame_remove_side_data(AVFrame *frame, enum AVFrameSideDataType type); |