Commit 20c5f4d8 authored by Zhao Zhili's avatar Zhao Zhili Committed by Marton Balint

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: 's avatarMarton Balint <cus@passwd.hu>
parent 0e495608
......@@ -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]);
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment