$ git clone http://tcclient.ion.nu/tc_client.git
commit 9f8535f703ae99333dc68ad2e4e2c3de841231c0
Author: Alicia <...>
Date:   Wed Oct 5 14:23:33 2016 +0200

    tc_client-gtk: stop trying to send video data if our media stream was closed.

diff --git a/ChangeLog b/ChangeLog
index 05b592d..2c9cace 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -13,6 +13,7 @@ tc_client-gtk: changed the greenscreen postprocessor to use libcamera for the ba
 tc_client-gtk: turn URLs mentioned in chat into clickable links.
 tc_client-gtk: reimplemented automatic scrolling using a state to keep track of whether the GtkTextView is scrolled to the bottom and using gtk_text_view_scroll_to_mark() to scroll.
 tc_client-gtk: when keeping HTTP cookies, use separate cookies per account and one for no account to avoid serverside issues.
+tc_client-gtk: stop trying to send video data if our media stream was closed.
 tc_client-gtk and camviewer: updated to libavcodec's avcodec_{send,receive}_{frame,packet} API.
 libcamera(v4l2): cache the frame and if there is no data to be read, return the cache instead of blocking.
 0.39:
diff --git a/utilities/gtk/camviewer.c b/utilities/gtk/camviewer.c
index a160d5f..8afac83 100644
--- a/utilities/gtk/camviewer.c
+++ b/utilities/gtk/camviewer.c
@@ -146,6 +146,12 @@ void printchat(const char* text, const char* color, unsigned int offset, const c
   chatview_autoscroll(chatview);
 }
 
+void togglecam_cancel(void)
+{
+  GtkCheckMenuItem* item=GTK_CHECK_MENU_ITEM(gtk_builder_get_object(gui, "menuitem_broadcast_camera"));
+  gtk_check_menu_item_set_active(item, 0);
+}
+
 unsigned int cameventsource=0;
 char buf[1024];
 gboolean handledata(GIOChannel* iochannel, GIOCondition condition, gpointer datap)
@@ -544,6 +550,11 @@ gboolean handledata(GIOChannel* iochannel, GIOCondition condition, gpointer data
     camera_remove(&buf[10], 0);
     return 1;
   }
+  if(!strcmp(buf, "Outgoing media stream was closed"))
+  {
+    togglecam_cancel();
+    return 1;
+  }
   if(!strncmp(buf, "Room topic: ", 12) ||
      (space && (!strcmp(space, " is not logged in") || !strncmp(space, " is logged in as ", 17))))
   {
@@ -587,12 +598,6 @@ void audiothread(int fd)
 }
 #endif
 
-void togglecam_cancel(void)
-{
-  GtkCheckMenuItem* item=GTK_CHECK_MENU_ITEM(gtk_builder_get_object(gui, "menuitem_broadcast_camera"));
-  gtk_check_menu_item_set_active(item, 0);
-}
-
 void togglecam(GtkCheckMenuItem* item, struct viddata* data)
 {
   if(!gtk_check_menu_item_get_active(item))