[FFmpeg-devel] avfilter/af_asetnsamples: fix last frame props

Submitted by Marton Balint on Dec. 25, 2018, 9:37 p.m.

Details

Message ID 20181225213717.17393-1-cus@passwd.hu
State Accepted
Headers show

Commit Message

Marton Balint Dec. 25, 2018, 9:37 p.m.
Frame properties were not copied, so e.g. PTS was not set for the last frame.

Regression since ef3babb2c70f564dc1634b3f29c6e35a2b2dc239.

Signed-off-by: Marton Balint <cus@passwd.hu>
---
 libavfilter/af_asetnsamples.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Marton Balint Dec. 30, 2018, 6:57 p.m.
On Tue, 25 Dec 2018, Marton Balint wrote:

> Frame properties were not copied, so e.g. PTS was not set for the last frame.
>
> Regression since ef3babb2c70f564dc1634b3f29c6e35a2b2dc239.
>
> Signed-off-by: Marton Balint <cus@passwd.hu>
> ---
> libavfilter/af_asetnsamples.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/libavfilter/af_asetnsamples.c b/libavfilter/af_asetnsamples.c
> index e8daec8d8f..ea20d66ac5 100644
> --- a/libavfilter/af_asetnsamples.c
> +++ b/libavfilter/af_asetnsamples.c
> @@ -76,6 +76,12 @@ static int activate(AVFilterContext *ctx)
>             return AVERROR(ENOMEM);
>         }
> 
> +        ret = av_frame_copy_props(pad_frame, frame);
> +        if (ret < 0) {
> +            av_frame_free(&frame);
> +            return ret;
> +        }
> +
>         av_samples_copy(pad_frame->extended_data, frame->extended_data,
>                         0, 0, frame->nb_samples, frame->channels, frame->format);
>         av_samples_set_silence(pad_frame->extended_data, frame->nb_samples,

Ping, will apply soon.

Regards,
Marton
Nicolas George Dec. 30, 2018, 7 p.m.
Marton Balint (2018-12-25):
> Frame properties were not copied, so e.g. PTS was not set for the last frame.
> 
> Regression since ef3babb2c70f564dc1634b3f29c6e35a2b2dc239.
> 
> Signed-off-by: Marton Balint <cus@passwd.hu>
> ---
>  libavfilter/af_asetnsamples.c | 6 ++++++
>  1 file changed, 6 insertions(+)

Sorry, it slipped my mind. LGTM, but I do not maintain that file.

Regards,
Marton Balint Dec. 30, 2018, 8:06 p.m.
On Sun, 30 Dec 2018, Nicolas George wrote:

> Marton Balint (2018-12-25):
>> Frame properties were not copied, so e.g. PTS was not set for the last frame.
>>
>> Regression since ef3babb2c70f564dc1634b3f29c6e35a2b2dc239.
>>
>> Signed-off-by: Marton Balint <cus@passwd.hu>
>> ---
>>  libavfilter/af_asetnsamples.c | 6 ++++++
>>  1 file changed, 6 insertions(+)
>
> Sorry, it slipped my mind. LGTM, but I do not maintain that file.

Thanks, applied with an additional fix to free pad_frame as well on error.

Regards,
Marton

Patch hide | download patch | download mbox

diff --git a/libavfilter/af_asetnsamples.c b/libavfilter/af_asetnsamples.c
index e8daec8d8f..ea20d66ac5 100644
--- a/libavfilter/af_asetnsamples.c
+++ b/libavfilter/af_asetnsamples.c
@@ -76,6 +76,12 @@  static int activate(AVFilterContext *ctx)
             return AVERROR(ENOMEM);
         }
 
+        ret = av_frame_copy_props(pad_frame, frame);
+        if (ret < 0) {
+            av_frame_free(&frame);
+            return ret;
+        }
+
         av_samples_copy(pad_frame->extended_data, frame->extended_data,
                         0, 0, frame->nb_samples, frame->channels, frame->format);
         av_samples_set_silence(pad_frame->extended_data, frame->nb_samples,