[vlc-commits] dav1d: pass the PTS in the frame metadata and get it back from the decoder

Steve Lhomme git at videolan.org
Sun Dec 16 13:38:30 CET 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Dec 14 15:11:14 2018 +0100| [9b35183b84b986fccc2c5668ceaae269108f4fd5] | committer: Steve Lhomme

dav1d: pass the PTS in the frame metadata and get it back from the decoder

Replaces the timestamp FIFO.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9b35183b84b986fccc2c5668ceaae269108f4fd5
---

 modules/codec/dav1d.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/modules/codec/dav1d.c b/modules/codec/dav1d.c
index 40c5d295d0..74f5984574 100644
--- a/modules/codec/dav1d.c
+++ b/modules/codec/dav1d.c
@@ -76,7 +76,6 @@ typedef struct
 {
     Dav1dSettings s;
     Dav1dContext *c;
-    timestamp_fifo_t *ts_fifo;
 } decoder_sys_t;
 
 static const struct
@@ -171,7 +170,6 @@ static void FlushDecoder(decoder_t *dec)
 {
     decoder_sys_t *p_sys = dec->p_sys;
     dav1d_flush(p_sys->c);
-    timestamp_FifoEmpty(p_sys->ts_fifo);
 }
 
 static void release_block(const uint8_t *buf, void *b)
@@ -206,13 +204,13 @@ static int Decode(decoder_t *dec, block_t *block)
             block_Release(block);
             return VLCDEC_ECRITICAL;
         }
+        vlc_tick_t pts = block->i_pts == VLC_TICK_INVALID ? block->i_dts : block->i_pts;
+        p_data->m.timestamp = pts;
     }
 
     Dav1dPicture img = { 0 };
 
     int i_ret = VLCDEC_SUCCESS;
-    vlc_tick_t pts = block ? (block->i_pts == VLC_TICK_INVALID ? block->i_dts : block->i_pts) : VLC_TICK_INVALID;
-    timestamp_FifoPut(p_sys->ts_fifo, pts);
     int res;
     do {
         res = dav1d_send_data(p_sys->c, p_data);
@@ -235,7 +233,7 @@ static int Decode(decoder_t *dec, block_t *block)
                 break;
             }
             pic->b_progressive = true; /* codec does not support interlacing */
-            pic->date = timestamp_FifoGet(p_sys->ts_fifo);
+            pic->date = img.m.timestamp;
             /* TODO udpate the color primaries and such */
             decoder_QueueVideo(dec, pic);
             dav1d_picture_unref(&img);
@@ -277,10 +275,6 @@ static int OpenDecoder(vlc_object_t *p_this)
     p_sys->s.allocator.alloc_picture_callback = NewPicture;
     p_sys->s.allocator.release_picture_callback = FreePicture;
 
-    p_sys->ts_fifo = timestamp_FifoNew( 32 );
-    if (unlikely(p_sys->ts_fifo == NULL))
-        return VLC_EGENERIC;
-
     if (dav1d_open(&p_sys->c, &p_sys->s) < 0)
     {
         msg_Err(p_this, "Could not open the Dav1d decoder");
@@ -318,8 +312,6 @@ static void CloseDecoder(vlc_object_t *p_this)
     /* Flush decoder */
     FlushDecoder(dec);
 
-    timestamp_FifoRelease(p_sys->ts_fifo);
-
     dav1d_close(&p_sys->c);
 }
 



More information about the vlc-commits mailing list