diff mbox series

[FFmpeg-devel,2/6] avcodec/wmadec: clear pts when returning a frame during flush

Message ID 20221206000308.3739-1-jamrial@gmail.com
State Accepted
Commit c06e88e05c5154cce31f5c12fde1da9b2070979e
Headers show
Series None | expand

Commit Message

James Almer Dec. 6, 2022, 12:03 a.m. UTC
This will be needed for the following commit, after which ff_get_buffer() will
stop setting frame->pts to AV_NOPTS_VALUE.

Signed-off-by: James Almer <jamrial@gmail.com>
---
This one goes before '[PATCH 2/5] Revert "avcodec/decode: use a packet list to
store packet properties"'

 libavcodec/wmadec.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Paul B Mahol Dec. 6, 2022, 8:27 a.m. UTC | #1
On 12/6/22, James Almer <jamrial@gmail.com> wrote:
> This will be needed for the following commit, after which ff_get_buffer()
> will
> stop setting frame->pts to AV_NOPTS_VALUE.

This can not be put into generic code?

>
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
> This one goes before '[PATCH 2/5] Revert "avcodec/decode: use a packet list
> to
> store packet properties"'
>
>  libavcodec/wmadec.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/libavcodec/wmadec.c b/libavcodec/wmadec.c
> index 15d6fb42b2..bc18d18222 100644
> --- a/libavcodec/wmadec.c
> +++ b/libavcodec/wmadec.c
> @@ -845,6 +845,7 @@ static int wma_decode_superframe(AVCodecContext *avctx,
> AVFrame *frame,
>          if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
>              return ret;
>
> +        frame->pts = AV_NOPTS_VALUE;
>          for (i = 0; i < s->avctx->ch_layout.nb_channels; i++)
>              memcpy(frame->extended_data[i], &s->frame_out[i][0],
>                     frame->nb_samples * sizeof(s->frame_out[i][0]));
> --
> 2.38.1
>
> _______________________________________________
> 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".
>
James Almer Dec. 6, 2022, 11:42 a.m. UTC | #2
On 12/6/2022 5:27 AM, Paul B Mahol wrote:
> On 12/6/22, James Almer <jamrial@gmail.com> wrote:
>> This will be needed for the following commit, after which ff_get_buffer()
>> will
>> stop setting frame->pts to AV_NOPTS_VALUE.
> 
> This can not be put into generic code?

Decoders can set pts manually for frames returned after eof (which is 
essentially what I'm doing here), and the generic code can't know the 
decoder was done flushing in order to force something into a frame until 
it effectively gets no frame.
diff mbox series

Patch

diff --git a/libavcodec/wmadec.c b/libavcodec/wmadec.c
index 15d6fb42b2..bc18d18222 100644
--- a/libavcodec/wmadec.c
+++ b/libavcodec/wmadec.c
@@ -845,6 +845,7 @@  static int wma_decode_superframe(AVCodecContext *avctx, AVFrame *frame,
         if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
             return ret;
 
+        frame->pts = AV_NOPTS_VALUE;
         for (i = 0; i < s->avctx->ch_layout.nb_channels; i++)
             memcpy(frame->extended_data[i], &s->frame_out[i][0],
                    frame->nb_samples * sizeof(s->frame_out[i][0]));