[vlc-commits] [Git][videolan/vlc][master] 2 commits: tests: packetizer: hxxx: check stripping

Steve Lhomme (@robUx4) gitlab at videolan.org
Sun Nov 10 09:21:09 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
042b30c9 by François Cartegnie at 2024-11-10T08:49:14+00:00
tests: packetizer: hxxx: check stripping

- - - - -
58106d71 by François Cartegnie at 2024-11-10T08:49:14+00:00
tests: hxxx_helper: check for configuration change on SPS update

- - - - -


2 changed files:

- test/modules/codec/hxxx_helper.c
- test/modules/packetizer/hxxx.c


Changes:

=====================================
test/modules/codec/hxxx_helper.c
=====================================
@@ -167,6 +167,54 @@ static int test_extrainit(vlc_fourcc_t codec,
     return 0;
 }
 
+static int test_configuration_change(vlc_fourcc_t codec,
+                                     const uint8_t *p_annexb, size_t i_annexb,
+                                     size_t i_borkoffset)
+{
+    fprintf(stderr,"test_configuration_change\n");
+
+    struct hxxx_helper hlpr;
+    hxxx_helper_init(&hlpr, NULL, codec, 0, 0);
+
+    block_t *b = block_Alloc(i_annexb);
+    if(!b)
+        return 1;
+    memcpy(b->p_buffer, p_annexb, i_annexb);
+
+    dump_hex("in", b->p_buffer, b->i_buffer);
+
+    assert(!hxxx_helper_has_new_config(&hlpr));
+    b = hxxx_helper_process_block(&hlpr, b);
+    if(!b)
+        return 1;
+
+    /* now have a config */
+    assert(hxxx_helper_has_new_config(&hlpr));
+
+    b = hxxx_helper_process_block(&hlpr, b);
+    if(!b)
+        return 1;
+
+    /* should not have a new config */
+    assert(!hxxx_helper_has_new_config(&hlpr));
+
+    /* patch our SPS */
+    b->p_buffer[i_borkoffset] = ~ b->p_buffer[i_borkoffset];
+    dump_hex("in new", b->p_buffer, b->i_buffer);
+    b = hxxx_helper_process_block(&hlpr, b);
+    if(!b)
+        return 1;
+
+    /* now have a new SPS/PPS config */
+    assert(hxxx_helper_has_new_config(&hlpr));
+
+    block_Release(b);
+
+    hxxx_helper_clean(&hlpr);
+
+    return 0;
+}
+
 static int test_any(struct hxxx_helper *hlpr,
                     const uint8_t *p_in, size_t i_in,
                     const uint8_t *p_out, size_t i_out,
@@ -268,6 +316,14 @@ static int test_annexb(void)
                 test_extradata_raw_h265_hvc1, sizeof(test_extradata_raw_h265_hvc1));
     if(ret) return ret;
 
+    ret = test_configuration_change(VLC_CODEC_H264,
+                test_samples_raw_h264_annexb, sizeof(test_samples_raw_h264_annexb), 4+2); // poke constraints
+    if(ret) return ret;
+
+    ret = test_configuration_change(VLC_CODEC_HEVC,
+                test_samples_raw_h265_annexb, sizeof(test_samples_raw_h265_annexb), 4+2); // poke profiletieridc
+    if(ret) return ret;
+
     return 0;
 }
 


=====================================
test/modules/packetizer/hxxx.c
=====================================
@@ -194,6 +194,12 @@ static void test_annexb( void )
     const uint8_t test7_avcdata2[]   = { 0, 0 };
     const uint8_t test7_avcdata4[]   = { 0, 0, 0, 0 };
 
+    /* padding/trailing zeroes stripping */
+    const uint8_t test8_annexbdata[] = { 0, 0, 0, 0, 0, 1, 0xff, 0, 0, 0, 0, 0, 1, 0xff, 0 };
+    const uint8_t test8_avcdata1[]   = { 1, 0xff, 1, 0xff };
+    const uint8_t test8_avcdata2[]   = { 0, 1, 0xff, 0, 1, 0xff };
+    const uint8_t test8_avcdata4[]   = { 0, 0, 0, 1, 0xff, 0, 0, 0, 1, 0xff };
+
     runtest(4, "empty nal test", testannexbin);
     runtest(2, "single nal test", testannexbin);
     runtest(3, "single nal test, startcode 3", testannexbin);
@@ -208,8 +214,9 @@ static void test_annexb( void )
     runtest(5, "IT 4 bytes prefixed nal only (4 prefix optz)", test_iterators);
     runtest(6, "startcode repeat / empty nal", test_iterators);
     runtest(7, "IT empty nal", test_iterators);
+    runtest(8, "IT zeroes stripping", test_iterators);
 
-    printf("\nTEST 8 borkage test\n");\
+    printf("\nTEST 9 borkage test\n");\
     rgi_res[0] = 0;
     rgi_res[1] = rgi_res[2] = 1;
     p_res[0] = NULL;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/e319ababe49e11a39ba1d6e4895b54fcfead3733...58106d711f3b308bef363df7f1bf7914ae916a84

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/e319ababe49e11a39ba1d6e4895b54fcfead3733...58106d711f3b308bef363df7f1bf7914ae916a84
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list