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>
This commit is contained in:
committed by
Marton Balint
parent
0e49560806
commit
20c5f4d835
@@ -806,7 +806,7 @@ void av_frame_remove_side_data(AVFrame *frame, enum AVFrameSideDataType type)
|
|||||||
{
|
{
|
||||||
int i;
|
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];
|
AVFrameSideData *sd = frame->side_data[i];
|
||||||
if (sd->type == type) {
|
if (sd->type == type) {
|
||||||
free_side_data(&frame->side_data[i]);
|
free_side_data(&frame->side_data[i]);
|
||||||
|
@@ -920,8 +920,7 @@ AVFrameSideData *av_frame_get_side_data(const AVFrame *frame,
|
|||||||
enum AVFrameSideDataType type);
|
enum AVFrameSideDataType type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If side data of the supplied type exists in the frame, free it and remove it
|
* Remove and free all side data instances of the given type.
|
||||||
* from the frame.
|
|
||||||
*/
|
*/
|
||||||
void av_frame_remove_side_data(AVFrame *frame, enum AVFrameSideDataType type);
|
void av_frame_remove_side_data(AVFrame *frame, enum AVFrameSideDataType type);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user