diff mbox

[FFmpeg-devel] avformat/apngdec: set pts to AV_NOPTS_VALUE

Message ID 20180628191958.28799-1-cus@passwd.hu
State Accepted
Commit 06a8d7ff00f5c3d13d331a56db839fb825ea6697
Headers show

Commit Message

Marton Balint June 28, 2018, 7:19 p.m. UTC
And let the generic code figure out the proper PTS. This is needed because apng
does not provide seek functions, but after a generic seek (e.g. to file start)
timestamps are not reset which causes broken timestamps when looping apngs,
like in ticket #6121.

Signed-off-by: Marton Balint <cus@passwd.hu>
---
 libavformat/apngdec.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Paul B Mahol June 28, 2018, 8:01 p.m. UTC | #1
On 6/28/18, Marton Balint <cus@passwd.hu> wrote:
> And let the generic code figure out the proper PTS. This is needed because
> apng
> does not provide seek functions, but after a generic seek (e.g. to file
> start)
> timestamps are not reset which causes broken timestamps when looping apngs,
> like in ticket #6121.
>
> Signed-off-by: Marton Balint <cus@passwd.hu>
> ---
>  libavformat/apngdec.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>

Probably ok.
Marton Balint July 2, 2018, 11:46 a.m. UTC | #2
On Thu, 28 Jun 2018, Paul B Mahol wrote:

> On 6/28/18, Marton Balint <cus@passwd.hu> wrote:
>> And let the generic code figure out the proper PTS. This is needed because
>> apng
>> does not provide seek functions, but after a generic seek (e.g. to file
>> start)
>> timestamps are not reset which causes broken timestamps when looping apngs,
>> like in ticket #6121.
>>
>> Signed-off-by: Marton Balint <cus@passwd.hu>
>> ---
>>  libavformat/apngdec.c | 4 +---
>>  1 file changed, 1 insertion(+), 3 deletions(-)
>>
>
> Probably ok.

Thanks, pushed.

Regards,
Marton
diff mbox

Patch

diff --git a/libavformat/apngdec.c b/libavformat/apngdec.c
index ffff03710a..f9a97e5681 100644
--- a/libavformat/apngdec.c
+++ b/libavformat/apngdec.c
@@ -44,7 +44,6 @@  typedef struct APNGDemuxContext {
     int max_fps;
     int default_fps;
 
-    int64_t pkt_pts;
     int pkt_duration;
 
     int is_key_frame;
@@ -390,9 +389,8 @@  static int apng_read_packet(AVFormatContext *s, AVPacket *pkt)
 
         if (ctx->is_key_frame)
             pkt->flags |= AV_PKT_FLAG_KEY;
-        pkt->pts = ctx->pkt_pts;
+        pkt->pts = pkt->dts = AV_NOPTS_VALUE;
         pkt->duration = ctx->pkt_duration;
-        ctx->pkt_pts += ctx->pkt_duration;
         return ret;
     case MKTAG('I', 'E', 'N', 'D'):
         ctx->cur_loop++;