$ git clone http://tcclient.ion.nu/tc_client.git
commit b6e0583d9f0f5deee4bc6d476d22ef4d3482fffd
Author: Alicia <...>
Date: Wed Oct 5 00:32:33 2016 +0200
Improved the RTMP acknowledgement code: counting the format 3 headers which were previously skipped, setting a more reasonable acknowledgement interval at startup and giving the server some margin before dropping outgoing video packets.
diff --git a/ChangeLog b/ChangeLog
index 7fc29b3..757c900 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
0.40:
Moved the backward compatibility code for avcodec_{send,receive}_{frame,packet} into a separate source file to avoid pulling libavcodec into utilities that don't use it.
+Improved the RTMP acknowledgement code: counting the format 3 headers which were previously skipped, setting a more reasonable acknowledgement interval at startup and giving the server some margin before dropping outgoing video packets.
tc_client-gtk: merged camera_remove() and camera_removebynick() into a single function, merged the deallocation of camera data into camera_free()
tc_client-gtk: moved the postprocessing code into its own source file.
tc_client-gtk: added greenscreen postprocessor.
diff --git a/client.c b/client.c
index 091acf9..b9f15bf 100644
--- a/client.c
+++ b/client.c
@@ -1,6 +1,6 @@
/*
tc_client, a simple non-flash client for tinychat(.com)
- Copyright (C) 2014-2015 alicia@ion.nu
+ Copyright (C) 2014-2016 alicia@ion.nu
Copyright (C) 2014-2015 Jade Lea
Copyright (C) 2015 Pamela Hiatt
@@ -861,6 +861,15 @@ int main(int argc, char** argv)
printf("%s%s", (i==2?"":", "), nick);
if(amf_comparestrings_c(&amfin->items[0].string, "registered"))
{
+ // Tell the server how often to let us know it got our packets
+ struct rtmp setbw={
+ .type=RTMP_SERVER_BW,
+ .chunkid=2,
+ .length=4,
+ .msgid=0,
+ .buf="\x00\x00\x40\x00" // Every 0x4000 bytes
+ };
+ rtmp_send(sock, &setbw);
char* key=getkey(id, channel);
curl_easy_cleanup(curl); // At this point we should be done with HTTP requests
curl=0;
diff --git a/rtmp.c b/rtmp.c
index 5541761..6e5b54c 100644
--- a/rtmp.c
+++ b/rtmp.c
@@ -39,7 +39,7 @@ unsigned int chunksize_in=128;
int rtmplog=-1;
#endif
-#define ackwindow 0x20200
+#define ackwindow (0x4000*2)
uint32_t rtmpsent=0;
uint32_t rtmpack=ackwindow;
@@ -209,7 +209,7 @@ void rtmp_send(int sock, struct rtmp* rtmp)
if(len>128)
{
w=write(sock, pos, 128);
- w+=write(sock, &basicheader, 1);
+ w+=rwrite(sock, &basicheader, 1);
len-=128;
}else{
w=write(sock, pos, len);