[vlc-commits] packetizer: hevc: check before replacing xps

Francois Cartegnie git at videolan.org
Tue Jan 30 14:23:54 CET 2018


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Jan 30 14:14:00 2018 +0100| [b6ebaba1a1f0c80392170124e94f63eccb7ddfd8] | committer: Francois Cartegnie

packetizer: hevc: check before replacing xps

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

 modules/packetizer/hevc.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/modules/packetizer/hevc.c b/modules/packetizer/hevc.c
index d5c6b11f14..ec8873af7c 100644
--- a/modules/packetizer/hevc.c
+++ b/modules/packetizer/hevc.c
@@ -375,6 +375,19 @@ static bool InsertXPS(decoder_t *p_dec, uint8_t i_nal_type, uint8_t i_id,
             return false;
     }
 
+    /* Check if we really need to re-decode/replace */
+    if(*pp_nal)
+    {
+        const uint8_t *p_stored = (*pp_nal)->p_buffer;
+        size_t i_stored = (*pp_nal)->i_buffer;
+        hxxx_strip_AnnexB_startcode(&p_stored, &i_stored);
+        const uint8_t *p_new = p_nalb->p_buffer;
+        size_t i_new = p_nalb->i_buffer;
+        hxxx_strip_AnnexB_startcode(&p_new, &i_new);
+        if(i_stored == i_new && !memcmp(p_stored, p_new, i_new))
+            return true;
+    }
+
     /* Free associated decoded version */
     if(*pp_decoded)
     {



More information about the vlc-commits mailing list