[vlc-commits] codec: hxxx: parse nal only when asked for

Thomas Guillem git at videolan.org
Thu Apr 20 15:09:56 CEST 2017


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Apr 20 11:10:04 2017 +0200| [e727f85933f55279543aa1241ca4b60365a2a361] | committer: Thomas Guillem

codec: hxxx: parse nal only when asked for

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

 modules/codec/hxxx_helper.c | 16 ++++++++++------
 modules/codec/hxxx_helper.h |  4 ++++
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/modules/codec/hxxx_helper.c b/modules/codec/hxxx_helper.c
index 8e907db46a..a7571e2b5f 100644
--- a/modules/codec/hxxx_helper.c
+++ b/modules/codec/hxxx_helper.c
@@ -358,7 +358,8 @@ helper_process_block_xvcc2annexb(struct hxxx_helper *hh, block_t *p_block,
                                  bool *p_config_changed)
 {
     assert(helper_nal_length_valid(hh));
-    *p_config_changed = false;
+    if (p_config_changed != NULL)
+        *p_config_changed = false;
     h264_AVC_to_AnnexB(p_block->p_buffer, p_block->i_buffer,
                        hh->i_nal_length_size);
     return p_block;
@@ -368,12 +369,15 @@ static block_t *
 helper_process_block_h264_annexb(struct hxxx_helper *hh, block_t *p_block,
                                  bool *p_config_changed)
 {
-    int i_ret = h264_helper_parse_nal(hh, p_block->p_buffer, p_block->i_buffer,
-                                      0, p_config_changed);
-    if (i_ret != VLC_SUCCESS)
+    if (p_config_changed != NULL)
     {
-        block_Release(p_block);
-        return NULL;
+        int i_ret = h264_helper_parse_nal(hh, p_block->p_buffer,
+                                          p_block->i_buffer, 0, p_config_changed);
+        if (i_ret != VLC_SUCCESS)
+        {
+            block_Release(p_block);
+            return NULL;
+        }
     }
     return p_block;
 }
diff --git a/modules/codec/hxxx_helper.h b/modules/codec/hxxx_helper.h
index a83f45535d..44bb57a12d 100644
--- a/modules/codec/hxxx_helper.h
+++ b/modules/codec/hxxx_helper.h
@@ -59,6 +59,10 @@ struct hxxx_helper
             size_t i_annexb_config_nal;
         } hevc;
     };
+
+    /* Process the block: do the AnnexB <-> xvcC conversion if needed. If
+     * p_config_changed is not NULL, parse nals to detect a SPS/PPS or a video
+     * size change. */
     block_t * (*pf_process_block)(struct hxxx_helper *hh, block_t *p_block,
                                   bool *p_config_changed);
 };



More information about the vlc-commits mailing list