rtph265pay: Accept array_completeness=1
authorJonas Holmberg <jonashg@axis.com>
Mon, 11 Jul 2016 07:46:49 +0000 (09:46 +0200)
committerSebastian Dröge <sebastian@centricular.com>
Mon, 11 Jul 2016 08:49:41 +0000 (11:49 +0300)
When parsing NAL unit type in codec_data, check the 6bits of
NAL_unit_type only and do not require the array_completeness bit to be
0, since the default and mandatory value of array_completeness is 1 for
hvc1.

https://bugzilla.gnome.org/show_bug.cgi?id=768653

gst/rtp/gstrtph265pay.c
tests/check/elements/rtp-payloading.c

index ed1d8b9..b63360e 100644 (file)
@@ -566,7 +566,7 @@ gst_rtp_h265_pay_setcaps (GstRTPBasePayload * basepayload, GstCaps * caps)
     size -= 23;
 
     if (num_arrays > 0) {
-      if (data[0] == (0x00 | 0x20)) {   /* VPS */
+      if ((data[0] & 0x3f) == 0x20) {   /* VPS */
 
         data++;
         num_vps = data[0] << 8 | data[1];
@@ -603,7 +603,7 @@ gst_rtp_h265_pay_setcaps (GstRTPBasePayload * basepayload, GstCaps * caps)
     }
 
     if (num_arrays > 0) {
-      if (data[0] == (0x00 | 0x21)) {   /* SPS */
+      if ((data[0] & 0x3f) == 0x21) {   /* SPS */
 
         data++;
         num_sps = data[0] << 8 | data[1];
@@ -640,7 +640,7 @@ gst_rtp_h265_pay_setcaps (GstRTPBasePayload * basepayload, GstCaps * caps)
     }
 
     if (num_arrays > 0) {
-      if (data[0] == (0x00 | 0x22)) {   /* PPS */
+      if ((data[0] & 0x3f) == 0x22) {   /* PPS */
 
         data++;
         num_pps = data[0] << 8 | data[1];
index 1f864a6..96a601e 100644 (file)
@@ -842,8 +842,10 @@ GST_START_TEST (rtp_h265_list_lt_mtu_hvc1)
   rtp_pipeline_test (rtp_h265_list_lt_mtu_frame_data_hvc1,
       rtp_h265_list_lt_mtu_frame_data_size, rtp_h265_list_lt_mtu_frame_count,
       "video/x-h265,stream-format=(string)hvc1,alignment=(string)au,"
-      "codec_data=(buffer)01640032ffe1002a67640032ac1b1a80a03dff016e02020280000"
-      "003008000000a74300018fff5de5c68600031ffebbcb85001000468ee3830",
+      "codec_data=(buffer)0101c000000080000000000099f000fcfdf8f800000203a000010"
+      "01840010c01ffff01c000000300800000030000030099ac0900a10001003042010101c00"
+      "0000300800000030000030099a00a080f1fe36bbb5377725d602dc040404100000300010"
+      "00003000a0800a2000100074401c172b02240",
       "rtph265pay", "rtph265depay", rtp_h265_list_lt_mtu_bytes_sent_hvc1,
       rtp_h265_list_lt_mtu_mtu_size, TRUE);
 }
@@ -898,8 +900,10 @@ GST_START_TEST (rtp_h265_list_gt_mtu_hvc1)
   rtp_pipeline_test (rtp_h265_list_gt_mtu_frame_data_hvc1,
       rtp_h265_list_gt_mtu_frame_data_size, rtp_h265_list_gt_mtu_frame_count,
       "video/x-h265,stream-format=(string)hvc1,alignment=(string)au,"
-      "codec_data=(buffer)01640032ffe1002a67640032ac1b1a80a03dff016e02020280000"
-      "003008000000a74300018fff5de5c68600031ffebbcb85001000468ee3830",
+      "codec_data=(buffer)0101c000000080000000000099f000fcfdf8f800000203a000010"
+      "01840010c01ffff01c000000300800000030000030099ac0900a10001003042010101c00"
+      "0000300800000030000030099a00a080f1fe36bbb5377725d602dc040404100000300010"
+      "00003000a0800a2000100074401c172b02240",
       "rtph265pay", "rtph265depay", rtp_h265_list_gt_mtu_bytes_sent_hvc1,
       rtp_h265_list_gt_mtu_mtu_size, TRUE);
 }