rtph263pay: change log level on bitstream parsing messages
authorStian Selnes <stian.selnes@gmail.com>
Tue, 17 Jun 2014 06:52:50 +0000 (08:52 +0200)
committerOlivier CrĂȘte <olivier.crete@collabora.com>
Thu, 25 Aug 2016 22:28:44 +0000 (18:28 -0400)
gst/rtp/gstrtph263pay.c

index 06091fc..1a07ee3 100644 (file)
@@ -770,7 +770,7 @@ gst_rtp_h263_pay_decode_mcbpc_I (guint32 value)
 
   code = value >> 16;
 
-  GST_DEBUG ("value:0x%08x, code:0x%04x", value, code);
+  GST_LOG ("value:0x%08x, code:0x%04x", value, code);
 
   for (i = 0; i < MCBPC_I_LEN; i++) {
     if ((code & mcbpc_I[i][1]) == mcbpc_I[i][0]) {
@@ -795,7 +795,7 @@ gst_rtp_h263_pay_decode_mcbpc_P (guint32 value)
 
   code = value >> 16;
 
-  GST_DEBUG ("value:0x%08x, code:0x%04x", value, code);
+  GST_LOG ("value:0x%08x, code:0x%04x", value, code);
 
   for (i = 0; i < MCBPC_P_LEN; i++) {
     if ((code & mcbpc_P[i][1]) == mcbpc_P[i][0]) {
@@ -820,7 +820,7 @@ gst_rtp_h263_pay_decode_cbpy (guint32 value, const guint8 cbpy_table[16][7])
 
   code = value >> 24;
 
-  GST_DEBUG ("value:0x%08x, code:0x%04x", value, code);
+  GST_LOG ("value:0x%08x, code:0x%04x", value, code);
 
   for (i = 0; i < CBPY_LEN; i++) {
     if ((code & cbpy_table[i][1]) == cbpy_table[i][0]) {
@@ -845,7 +845,7 @@ gst_rtp_h263_pay_decode_mvd (guint32 value)
 
   code = value >> 16;
 
-  GST_DEBUG ("value:0x%08x, code:0x%04x", value, code);
+  GST_LOG ("value:0x%08x, code:0x%04x", value, code);
 
   for (i = 0; i < MVD_LEN; i++) {
     if ((code & mvd[i][1]) == mvd[i][0]) {
@@ -870,7 +870,7 @@ gst_rtp_h263_pay_decode_tcoef (guint32 value)
 
   code = value >> 16;
 
-  GST_DEBUG ("value:0x%08x, code:0x%04x", value, code);
+  GST_LOG ("value:0x%08x, code:0x%04x", value, code);
 
   for (i = 0; i < TCOEF_LEN; i++) {
     if ((code & tcoef[i][1]) == tcoef[i][0]) {
@@ -894,8 +894,8 @@ gst_rtp_h263_pay_move_window_right (GstRtpH263PayContext * context, guint n,
     guint rest_bits, guint8 ** orig_data, guint8 ** data_end)
 {
 
-  GST_DEBUG ("Moving window: 0x%08x from: %p for %d bits, rest_bits: %d",
-      context->window, context->win_end, n, rest_bits);
+  GST_LOG ("Moving window: 0x%08x from: %p for %d bits, rest_bits: %d, data_end %p",
+      context->window, context->win_end, n, rest_bits, *data_end);
 
   if (n == 0)
     return rest_bits;
@@ -937,7 +937,7 @@ gst_rtp_h263_pay_move_window_right (GstRtpH263PayContext * context, guint n,
 
   *orig_data = context->win_end - 4;
 
-  GST_DEBUG
+  GST_LOG
       ("Window moved to %p with value: 0x%08x and orig_data: %p rest_bits: %d",
       context->win_end, context->window, *orig_data, rest_bits);
   return rest_bits;
@@ -985,7 +985,7 @@ gst_rtp_h263_pay_B_mbfinder (GstRtpH263PayContext * context,
     //Step 2 decode MCBPC I
     mb_type_index = gst_rtp_h263_pay_decode_mcbpc_I (context->window);
 
-    GST_DEBUG ("MCBPC index: %d", mb_type_index);
+    GST_LOG ("MCBPC index: %d", mb_type_index);
     if (mb_type_index == -1) {
       GST_ERROR ("MB index shouldn't be -1 in window: %08x", context->window);
       goto beach;
@@ -1004,7 +1004,7 @@ gst_rtp_h263_pay_B_mbfinder (GstRtpH263PayContext * context,
     //Step 3 decode CBPY I
     cbpy_type_index = gst_rtp_h263_pay_decode_cbpy (context->window, cbpy_I);
 
-    GST_DEBUG ("CBPY index: %d", cbpy_type_index);
+    GST_LOG ("CBPY index: %d", cbpy_type_index);
     if (cbpy_type_index == -1) {
       GST_ERROR ("CBPY index shouldn't be -1 in window: %08x", context->window);
       goto beach;
@@ -1017,7 +1017,7 @@ gst_rtp_h263_pay_B_mbfinder (GstRtpH263PayContext * context,
     //Step 4 decode rest of MB
     //MB type 1 and 4 have DQUANT - we store it for packaging purposes
     if (mcbpc_I[mb_type_index][5] == 4) {
-      GST_DEBUG ("Shifting DQUANT");
+      GST_LOG ("Shifting DQUANT");
 
       mac->quant = (context->window >> 30);
 
@@ -1029,7 +1029,7 @@ gst_rtp_h263_pay_B_mbfinder (GstRtpH263PayContext * context,
     last = 0;
     for (i = 0; i < N_BLOCKS; i++) {
 
-      GST_DEBUG ("Decoding INTRADC and TCOEF, i:%d", i);
+      GST_LOG ("Decoding INTRADC and TCOEF, i:%d", i);
       mac->ebit =
           gst_rtp_h263_pay_move_window_right (context, 8, mac->ebit, &mac->end,
           &gob->end);
@@ -1044,7 +1044,7 @@ gst_rtp_h263_pay_B_mbfinder (GstRtpH263PayContext * context,
         while (last == 0) {
           tcoef_type_index = gst_rtp_h263_pay_decode_tcoef (context->window);
 
-          GST_DEBUG ("TCOEF index: %d", tcoef_type_index);
+          GST_LOG ("TCOEF index: %d", tcoef_type_index);
           if (tcoef_type_index == -1) {
             GST_ERROR ("TCOEF index shouldn't be -1 in window: %08x",
                 context->window);
@@ -1077,13 +1077,13 @@ gst_rtp_h263_pay_B_mbfinder (GstRtpH263PayContext * context,
     guint ind;
 
     //Step 1 check COD
-    GST_DEBUG ("Checking for COD");
+    GST_LOG ("Checking for COD");
     if ((context->window & 0x80000000) == 0x80000000) {
       //The MB is not coded
       mac->ebit =
           gst_rtp_h263_pay_move_window_right (context, 1, mac->ebit, &mac->end,
           &gob->end);
-      GST_DEBUG ("COOOOOOOOOOOD = 1");
+      GST_LOG ("COOOOOOOOOOOD = 1");
 
       return mac;
     } else {
@@ -1096,7 +1096,7 @@ gst_rtp_h263_pay_B_mbfinder (GstRtpH263PayContext * context,
     //Step 2 decode MCBPC P
     mb_type_index = gst_rtp_h263_pay_decode_mcbpc_P (context->window);
 
-    GST_DEBUG ("MCBPC index: %d", mb_type_index);
+    GST_LOG ("MCBPC index: %d", mb_type_index);
     if (mb_type_index == -1) {
       GST_ERROR ("MB index shouldn't be -1 in window: %08x", context->window);
       goto beach;
@@ -1114,7 +1114,7 @@ gst_rtp_h263_pay_B_mbfinder (GstRtpH263PayContext * context,
     //Step 3 decode CBPY P
     cbpy_type_index = gst_rtp_h263_pay_decode_cbpy (context->window, cbpy_P);
 
-    GST_DEBUG ("CBPY index: %d", cbpy_type_index);
+    GST_LOG ("CBPY index: %d", cbpy_type_index);
     if (cbpy_type_index == -1) {
       GST_ERROR ("CBPY index shouldn't be -1 in window: %08x", context->window);
       goto beach;
@@ -1125,7 +1125,7 @@ gst_rtp_h263_pay_B_mbfinder (GstRtpH263PayContext * context,
 
     //MB type 1 and 4 have DQUANT - we add it to MB object and jump over
     if (mcbpc_P[mb_type_index][5] == 4 || mcbpc_P[mb_type_index][5] == 1) {
-      GST_DEBUG ("Shifting DQUANT");
+      GST_LOG ("Shifting DQUANT");
 
       mac->quant = context->window >> 30;
 
@@ -1169,12 +1169,12 @@ gst_rtp_h263_pay_B_mbfinder (GstRtpH263PayContext * context,
 
       //if MB type 3 or 4 then INTRADC coef are present in blocks
       if (mcbpc_P[mb_type_index][5] > 2) {
-        GST_DEBUG ("INTRADC coef: %d", i);
+        GST_LOG ("INTRADC coef: %d", i);
         mac->ebit =
             gst_rtp_h263_pay_move_window_right (context, 8, mac->ebit,
             &mac->end, &gob->end);
       } else {
-        GST_DEBUG ("INTRADC coef is not present");
+        GST_LOG ("INTRADC coef is not present");
       }
 
       //check if the block has TCOEF
@@ -1192,7 +1192,7 @@ gst_rtp_h263_pay_B_mbfinder (GstRtpH263PayContext * context,
         while (last == 0) {
           tcoef_type_index = gst_rtp_h263_pay_decode_tcoef (context->window);
 
-          GST_DEBUG ("TCOEF index: %d", tcoef_type_index);
+          GST_LOG ("TCOEF index: %d", tcoef_type_index);
           if (tcoef_type_index == -1) {
             GST_ERROR ("TCOEF index shouldn't be -1 in window: %08x",
                 context->window);
@@ -1512,13 +1512,13 @@ gst_rtp_h263_pay_mode_B_fragment (GstRtpH263Pay * rtph263pay,
   mac = gst_rtp_h263_pay_mb_new (&boundry, 0);
   for (mb = 0; mb < format_props[context->piclayer->ptype_srcformat][1]; mb++) {
 
-    GST_DEBUG ("================ START MB %d =================", mb);
+    GST_LOG ("================ START MB %d =================", mb);
 
     //Find next macroblock boundaries
     ebit = mac->ebit;
     if (!(mac = gst_rtp_h263_pay_B_mbfinder (context, gob, mac, mb))) {
 
-      GST_DEBUG ("Error decoding MB - sbit: %d", 8 - ebit);
+      GST_LOG ("Error decoding MB - sbit: %d", 8 - ebit);
       GST_ERROR ("Error decoding in GOB");
 
       goto decode_error;
@@ -1543,7 +1543,7 @@ gst_rtp_h263_pay_mode_B_fragment (GstRtpH263Pay * rtph263pay,
     }
     GST_DEBUG ("Found MB: mba: %d start: %p end: %p len: %d sbit: %d ebit: %d",
         mac->mba, mac->start, mac->end, mac->length, mac->sbit, mac->ebit);
-    GST_DEBUG ("================ END MB %d =================", mb);
+    GST_LOG ("================ END MB %d =================", mb);
   }
 
   mb = 0;
@@ -1562,6 +1562,8 @@ gst_rtp_h263_pay_mode_B_fragment (GstRtpH263Pay * rtph263pay,
       //GST_DEBUG ("Pushing GOBS %d to %d because payload size is %d", first,
       //    first == mb - 1, payload_len);
 
+      // FIXME: segfault if mb == 0 (first MB is larger than max_payload_size)
+      GST_DEBUG ("Push B mode fragment from mb %d to %d", first, mb - 1);
       if (gst_rtp_h263_pay_B_fragment_push (rtph263pay, context, gob, first,
               mb - 1, &boundry)) {
         GST_ERROR ("Oooops, there was an error sending");
@@ -1580,6 +1582,7 @@ gst_rtp_h263_pay_mode_B_fragment (GstRtpH263Pay * rtph263pay,
   /* Push rest */
   GST_DEBUG ("Remainder first: %d, MB: %d", first, mb);
   if (payload_len != 0) {
+    GST_DEBUG ("Push B mode fragment from mb %d to %d", first, mb - 1);
     if (gst_rtp_h263_pay_B_fragment_push (rtph263pay, context, gob, first,
             mb - 1, &boundry)) {
       GST_ERROR ("Oooops, there was an error sending!");