[vlc-commits] packetizer: hxxx: store prefixed in both and fix double prefix

Francois Cartegnie git at videolan.org
Wed Jan 17 16:13:19 CET 2018


vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Jan 17 10:34:14 2018 +0100| [aed4a645b8dc01155bb2b89b1792d194e9dabbea] | committer: Jean-Baptiste Kempf

packetizer: hxxx: store prefixed in both and fix double prefix

generated double prefix in h264 extra in prev commit

(cherry picked from commit 6a796df0b256e3684f6013b7088aa10853e9a72c)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/packetizer/h264.c |  8 +++-----
 modules/packetizer/hevc.c | 14 +++-----------
 2 files changed, 6 insertions(+), 16 deletions(-)

diff --git a/modules/packetizer/h264.c b/modules/packetizer/h264.c
index e92247fbd5..7386b07c36 100644
--- a/modules/packetizer/h264.c
+++ b/modules/packetizer/h264.c
@@ -246,16 +246,14 @@ static void ActivateSets( decoder_t *p_dec, const h264_sequence_parameter_set_t
 
             if( p_spsblock && p_ppsblock )
             {
-                size_t i_alloc = p_ppsblock->i_buffer + p_spsblock->i_buffer + 8;
+                size_t i_alloc = p_ppsblock->i_buffer + p_spsblock->i_buffer;
                 p_dec->fmt_out.p_extra = malloc( i_alloc );
                 if( p_dec->fmt_out.p_extra )
                 {
                     uint8_t*p_buf = p_dec->fmt_out.p_extra;
                     p_dec->fmt_out.i_extra = i_alloc;
-                    memcpy( &p_buf[0], annexb_startcode4, 4 );
-                    memcpy( &p_buf[4], p_spsblock->p_buffer, p_spsblock->i_buffer );
-                    memcpy( &p_buf[4 + p_spsblock->i_buffer], annexb_startcode4, 4 );
-                    memcpy( &p_buf[8 + p_spsblock->i_buffer], p_ppsblock->p_buffer,
+                    memcpy( &p_buf[0], p_spsblock->p_buffer, p_spsblock->i_buffer );
+                    memcpy( &p_buf[p_spsblock->i_buffer], p_ppsblock->p_buffer,
                             p_ppsblock->i_buffer );
                 }
             }
diff --git a/modules/packetizer/hevc.c b/modules/packetizer/hevc.c
index 21a8ec5e3e..7f8c930317 100644
--- a/modules/packetizer/hevc.c
+++ b/modules/packetizer/hevc.c
@@ -430,12 +430,6 @@ static bool InsertXPS(decoder_t *p_dec, uint8_t i_nal_type, uint8_t i_id,
         }
 
         *pp_nal = block_Duplicate((block_t *)p_nalb);
-        if(*pp_nal)
-        {
-            size_t off = p_nalb->i_buffer - i_buffer;
-            (*pp_nal)->p_buffer += off;
-            (*pp_nal)->i_buffer -= off;
-        }
 
         return true;
     }
@@ -466,16 +460,14 @@ static bool XPSReady(decoder_sys_t *p_sys)
 static void AppendAsAnnexB(const block_t *p_block,
                            uint8_t **pp_dst, size_t *pi_dst)
 {
-    if(SIZE_MAX - p_block->i_buffer < *pi_dst ||
-       SIZE_MAX - 4 < *pi_dst + p_block->i_buffer)
+    if(SIZE_MAX - p_block->i_buffer < *pi_dst )
         return;
 
-    size_t i_realloc = p_block->i_buffer + 4 + *pi_dst;
+    size_t i_realloc = p_block->i_buffer + *pi_dst;
     uint8_t *p_realloc = realloc(*pp_dst, i_realloc);
     if(p_realloc)
     {
-        memcpy(&p_realloc[*pi_dst], annexb_startcode4, 4);
-        memcpy(&p_realloc[*pi_dst + 4], p_block->p_buffer, p_block->i_buffer);
+        memcpy(&p_realloc[*pi_dst], p_block->p_buffer, p_block->i_buffer);
         *pi_dst = i_realloc;
         *pp_dst = p_realloc;
     }



More information about the vlc-commits mailing list