rtpstorage: Add more debug messages
authorOlivier Crête <olivier.crete@collabora.com>
Thu, 21 Mar 2019 21:24:42 +0000 (17:24 -0400)
committerOlivier Crête <olivier.crete@collabora.com>
Tue, 26 Mar 2019 23:41:06 +0000 (19:41 -0400)
gst/rtp/gstrtpstorage.c
gst/rtp/rtpstorage.c
gst/rtp/rtpstoragestream.c

index 20116e5..4be1aec 100644 (file)
@@ -102,6 +102,8 @@ gst_rtp_storage_set_property (GObject * object, guint prop_id,
 
   switch (prop_id) {
     case PROP_SIZE_TIME:
+      GST_DEBUG_OBJECT (self, "RTP storage size set to %" GST_TIME_FORMAT,
+          GST_TIME_ARGS (g_value_get_uint64 (value)));
       rtp_storage_set_size (self->storage, g_value_get_uint64 (value));
       break;
     default:
index 2708f77..f96667e 100644 (file)
@@ -85,13 +85,17 @@ rtp_storage_get_packets_for_recovery (RtpStorage * self, gint fec_pt,
   STORAGE_UNLOCK (self);
 
   if (NULL == stream) {
-    GST_ERROR_OBJECT (self, "Cant find ssrc = 0x%x", ssrc);
+    GST_ERROR_OBJECT (self, "Cant find ssrc = 0x08%x", ssrc);
   } else {
     STREAM_LOCK (stream);
     if (stream->queue.length > 0) {
+      GST_LOG_OBJECT (self, "Looking for recovery packets for fec_pt=%u around"
+          " lost_seq=%u for ssrc=%08x", fec_pt, lost_seq, ssrc);
       ret =
           rtp_storage_stream_get_packets_for_recovery (stream, fec_pt,
           lost_seq);
+    } else {
+      GST_DEBUG_OBJECT (self, "Empty RTP storage for ssrc=%08x", ssrc);
     }
     STREAM_UNLOCK (stream);
   }
@@ -116,6 +120,8 @@ rtp_storage_get_redundant_packet (RtpStorage * self, guint32 ssrc,
     STREAM_LOCK (stream);
     if (stream->queue.length > 0) {
       ret = rtp_storage_stream_get_redundant_packet (stream, lost_seq);
+    } else {
+      GST_DEBUG_OBJECT (self, "Empty RTP storage for ssrc=%08x", ssrc);
     }
     STREAM_UNLOCK (stream);
   }
@@ -135,6 +141,10 @@ rtp_storage_do_put_recovered_packet (RtpStorage * self,
 
   g_assert (stream);
 
+  GST_LOG_OBJECT (self,
+      "Storing recovered RTP packet with ssrc=%08x pt=%u seq=%u %"
+      GST_PTR_FORMAT, ssrc, pt, seq, buffer);
+
   STREAM_LOCK (stream);
   rtp_storage_stream_add_item (stream, buffer, pt, seq);
   STREAM_UNLOCK (stream);
@@ -186,6 +196,10 @@ rtp_storage_append_buffer (RtpStorage * self, GstBuffer * buf)
 
   STORAGE_UNLOCK (self);
 
+  GST_LOG_OBJECT (self,
+      "Storing RTP packet with ssrc=%08x pt=%u seq=%u %" GST_PTR_FORMAT,
+      ssrc, pt, seq, buf);
+
   STREAM_LOCK (stream);
 
   /* Saving the buffer, now the storage owns it */
index c4d09bb..2bdec5e 100644 (file)
@@ -76,6 +76,10 @@ rtp_storage_stream_resize (RtpStorageStream * stream, GstClockTime size_time)
 
   for (i = 0; i < too_old_buffers_num; ++i) {
     RtpStorageItem *item = g_queue_pop_tail (&stream->queue);
+
+    GST_TRACE ("Removing %u/%u buffers, pt=%d seq=%d for ssrc=%08x",
+        i, too_old_buffers_num, item->pt, item->seq, stream->ssrc);
+
     rtp_storage_item_free (item);
   }
 }
@@ -198,6 +202,9 @@ rtp_storage_stream_get_packets_for_recovery (RtpStorageStream * stream,
     GstBufferList *ret = gst_buffer_list_new_sized (ret_length);
     GList *it;
 
+    GST_LOG ("Found %u buffers with lost seq=%d for ssrc=%08x, creating %"
+        GST_PTR_FORMAT, ret_length, lost_seq, stream->ssrc, ret);
+
     for (it = start; it != end->prev; it = it->prev)
       gst_buffer_list_add (ret,
           gst_buffer_ref (((RtpStorageItem *) it->data)->buffer));
@@ -214,8 +221,13 @@ rtp_storage_stream_get_redundant_packet (RtpStorageStream * stream,
   GList *it;
   for (it = stream->queue.head; it; it = it->next) {
     RtpStorageItem *item = it->data;
-    if (item->seq == lost_seq)
+    if (item->seq == lost_seq) {
+      GST_LOG ("Found buffer pt=%u seq=%u for ssrc=%08x %" GST_PTR_FORMAT,
+          item->pt, item->seq, stream->ssrc, item->buffer);
       return gst_buffer_ref (item->buffer);
+    }
   }
+  GST_DEBUG ("Could not find packet with seq=%u for ssrc=%08x",
+      lost_seq, stream->ssrc);
   return NULL;
 }