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

Steve Lhomme git at videolan.org
Tue Dec 18 18:14:45 CET 2018


vlc/vlc-3.0 | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon Dec 17 11:38:26 2018 +0100| [c013eedd88afd1593ce6a519b26f314aa247afc1] | committer: Hugo Beauzée-Luyssen

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

Replaces the timestamp FIFO.

(cherry picked from commit 9b35183b84b986fccc2c5668ceaae269108f4fd5)
Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>

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

 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 c78a1a14b1..748aa8143a 100644
--- a/modules/codec/dav1d.c
+++ b/modules/codec/dav1d.c
@@ -76,7 +76,6 @@ struct decoder_sys_t
 {
     Dav1dSettings s;
     Dav1dContext *c;
-    timestamp_fifo_t *ts_fifo;
 };
 
 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;
         }
+        mtime_t pts = block->i_pts == VLC_TS_INVALID ? block->i_dts : block->i_pts;
+        p_data->m.timestamp = pts;
     }
 
     Dav1dPicture img = { 0 };
 
     int i_ret = VLCDEC_SUCCESS;
-    mtime_t pts = block ? (block->i_pts == VLC_TS_INVALID ? block->i_dts : block->i_pts) : VLC_TS_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