diff mbox series

[FFmpeg-devel] avfilter/f_metadata: do not return the frame early if there is no metadata

Message ID 20210623004159.27110-1-cus@passwd.hu
State Accepted
Commit 758e2da28939c156b18c11c3993ea068da3ea869
Headers show
Series [FFmpeg-devel] avfilter/f_metadata: do not return the frame early if there is no metadata | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate fail Make fate failed
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate warning Make fate failed

Commit Message

Marton Balint June 23, 2021, 12:41 a.m. UTC
The early return caused isses for the "add" mode (got fixed in
c95dfe5cce98cde3e7fb14fbd04b3897f3927cec) and the "select" mode needs a similar
fix. It is probably better to fully remove the check, since all modes work
correctly with NULL metadata.

Signed-off-by: Marton Balint <cus@passwd.hu>
---
 libavfilter/f_metadata.c | 3 ---
 1 file changed, 3 deletions(-)

Comments

Gyan Doshi June 23, 2021, 6:54 a.m. UTC | #1
On 2021-06-23 06:11, Marton Balint wrote:
> The early return caused isses for the "add" mode (got fixed in
> c95dfe5cce98cde3e7fb14fbd04b3897f3927cec) and the "select" mode needs a similar
> fix. It is probably better to fully remove the check, since all modes work
> correctly with NULL metadata.

Doesn't select mode imply the presence of a dictionary?

>
> Signed-off-by: Marton Balint <cus@passwd.hu>
> ---
>   libavfilter/f_metadata.c | 3 ---
>   1 file changed, 3 deletions(-)
>
> diff --git a/libavfilter/f_metadata.c b/libavfilter/f_metadata.c
> index e7c7b00118..d0a78b00d0 100644
> --- a/libavfilter/f_metadata.c
> +++ b/libavfilter/f_metadata.c
> @@ -308,9 +308,6 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
>       AVDictionary **metadata = &frame->metadata;
>       AVDictionaryEntry *e;
>   
> -    if (!*metadata && s->mode != METADATA_ADD)
> -        return ff_filter_frame(outlink, frame);
> -
>       e = av_dict_get(*metadata, !s->key ? "" : s->key, NULL,
>                       !s->key ? AV_DICT_IGNORE_SUFFIX: 0);
>
Marton Balint June 23, 2021, 3:30 p.m. UTC | #2
On Wed, 23 Jun 2021, Gyan Doshi wrote:

>
>
> On 2021-06-23 06:11, Marton Balint wrote:
>> The early return caused isses for the "add" mode (got fixed in
>> c95dfe5cce98cde3e7fb14fbd04b3897f3927cec) and the "select" mode needs a 
>> similar
>> fix. It is probably better to fully remove the check, since all modes work
>> correctly with NULL metadata.
>
> Doesn't select mode imply the presence of a dictionary?

Select mode selects frames with metadata, if there is no metadata the 
frame should NOT be selected, but currently it is.

Regards,
Marton

>
>> 
>> Signed-off-by: Marton Balint <cus@passwd.hu>
>> ---
>>   libavfilter/f_metadata.c | 3 ---
>>   1 file changed, 3 deletions(-)
>> 
>> diff --git a/libavfilter/f_metadata.c b/libavfilter/f_metadata.c
>> index e7c7b00118..d0a78b00d0 100644
>> --- a/libavfilter/f_metadata.c
>> +++ b/libavfilter/f_metadata.c
>> @@ -308,9 +308,6 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
>> *frame)
>>       AVDictionary **metadata = &frame->metadata;
>>       AVDictionaryEntry *e;
>>   -    if (!*metadata && s->mode != METADATA_ADD)
>> -        return ff_filter_frame(outlink, frame);
>> -
>>       e = av_dict_get(*metadata, !s->key ? "" : s->key, NULL,
>>                       !s->key ? AV_DICT_IGNORE_SUFFIX: 0);
>> 
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>
Marton Balint July 4, 2021, 4:47 p.m. UTC | #3
On Wed, 23 Jun 2021, Marton Balint wrote:

>
>
> On Wed, 23 Jun 2021, Gyan Doshi wrote:
>
>> 
>> 
>> On 2021-06-23 06:11, Marton Balint wrote:
>>> The early return caused isses for the "add" mode (got fixed in
>>> c95dfe5cce98cde3e7fb14fbd04b3897f3927cec) and the "select" mode needs a 
>>> similar
>>> fix. It is probably better to fully remove the check, since all modes work
>>> correctly with NULL metadata.
>> 
>> Doesn't select mode imply the presence of a dictionary?
>
> Select mode selects frames with metadata, if there is no metadata the frame 
> should NOT be selected, but currently it is.

Will apply.

Regards,
Marton
diff mbox series

Patch

diff --git a/libavfilter/f_metadata.c b/libavfilter/f_metadata.c
index e7c7b00118..d0a78b00d0 100644
--- a/libavfilter/f_metadata.c
+++ b/libavfilter/f_metadata.c
@@ -308,9 +308,6 @@  static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
     AVDictionary **metadata = &frame->metadata;
     AVDictionaryEntry *e;
 
-    if (!*metadata && s->mode != METADATA_ADD)
-        return ff_filter_frame(outlink, frame);
-
     e = av_dict_get(*metadata, !s->key ? "" : s->key, NULL,
                     !s->key ? AV_DICT_IGNORE_SUFFIX: 0);