summaryrefslogtreecommitdiff
path: root/gst/rtmp2
diff options
context:
space:
mode:
authorJan Alexander Steffens (heftig) <jsteffens@make.tv>2020-02-14 11:49:23 +0100
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>2020-02-21 15:20:41 +0000
commit0044e7a1ba6b02094a8aa5ec7c91d27d1688f6ba (patch)
tree218244f5a6076aba75a027deccab652e23e53a62 /gst/rtmp2
parent11a1de0053e02780a931e2dd28955a55462ed9a9 (diff)
downloadgstreamer-plugins-bad-0044e7a1ba6b02094a8aa5ec7c91d27d1688f6ba.tar.gz
rtmp2: Count in_bytes_acked instead of in_bytes_unacked
This is nicer for statistics.
Diffstat (limited to 'gst/rtmp2')
-rw-r--r--gst/rtmp2/rtmp/rtmpconnection.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/gst/rtmp2/rtmp/rtmpconnection.c b/gst/rtmp2/rtmp/rtmpconnection.c
index 8863d32a6..b43865809 100644
--- a/gst/rtmp2/rtmp/rtmpconnection.c
+++ b/gst/rtmp2/rtmp/rtmpconnection.c
@@ -80,7 +80,7 @@ struct _GstRtmpConnection
guint32 out_window_ack_size;
guint64 in_bytes_total;
- guint64 in_bytes_unacked;
+ guint64 in_bytes_acked;
};
@@ -409,6 +409,7 @@ gst_rtmp_connection_input_ready (GInputStream * is, gpointer user_data)
gssize ret;
guint oldsize;
GError *error = NULL;
+ guint64 bytes_since_ack;
GST_TRACE_OBJECT (sc, "input ready");
@@ -446,8 +447,8 @@ gst_rtmp_connection_input_ready (GInputStream * is, gpointer user_data)
GST_TRACE_OBJECT (sc, "read %" G_GSIZE_FORMAT " bytes", ret);
sc->in_bytes_total += ret;
- sc->in_bytes_unacked += ret;
- if (sc->in_bytes_unacked >= sc->in_window_ack_size) {
+ bytes_since_ack = sc->in_bytes_total - sc->in_bytes_acked;
+ if (sc->in_window_ack_size && bytes_since_ack >= sc->in_window_ack_size) {
gst_rtmp_connection_send_ack (sc);
}
@@ -988,15 +989,16 @@ gst_rtmp_connection_expect_command (GstRtmpConnection * connection,
static void
gst_rtmp_connection_send_ack (GstRtmpConnection * connection)
{
+ guint64 in_bytes_total = connection->in_bytes_total;
GstRtmpProtocolControl pc = {
.type = GST_RTMP_MESSAGE_TYPE_ACKNOWLEDGEMENT,
- .param = (guint32) connection->in_bytes_total,
+ .param = (guint32) in_bytes_total,
};
gst_rtmp_connection_queue_message (connection,
gst_rtmp_message_new_protocol_control (&pc));
- connection->in_bytes_unacked = 0;
+ connection->in_bytes_acked = in_bytes_total;
}
static void