$ git clone http://tcclient.ion.nu/tc_client.git
commit edc9b524b9ba623981afdb7961a37af5afcc6ff6
Author: Alicia <...>
Date:   Mon Jun 15 15:01:26 2015 +0200

    Fixed memory alignment in rtmp/amf code (for CPU architectures that are picky about it)

diff --git a/ChangeLog b/ChangeLog
index 9c5dd2e..cb4d238 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,5 @@
 0.34:
+Fixed memory alignment in rtmp/amf code (for CPU architectures that are picky about it)
 tc_client-gtk: fixed windows compatibility (w32_runcmd and strndup)
 tc_client-gtk and camviewer: added some compatibility macros for older libav versions.
 0.33:
diff --git a/amfparser.c b/amfparser.c
index c9829ef..4dd9a14 100644
--- a/amfparser.c
+++ b/amfparser.c
@@ -71,7 +71,9 @@ struct amf* amf_parse(const unsigned char* buf, int len)
       obj=&amf->items[amf->itemcount-1].object;
       // TODO: recurse into unfinished member-objects (unimportant, I haven't seen any objects within objects so far)
       // Add member and set name
-      i=be16(*(short*)buf);
+      unsigned short x;
+      memcpy(&x, buf, sizeof(x));
+      i=be16(x);
       buf=&buf[sizeof(short)];
       if(&buf[i]>=end){printf("Warning: skipping object item with name exceeding RTMP size (0x%x)\n", i);}
       if(&buf[i]<end && buf[i]!=9) // 9=end-of-object
@@ -117,7 +119,9 @@ struct amf* amf_parse(const unsigned char* buf, int len)
         item=&obj->members[obj->membercount-1].value;
       else
         item=amf_newitem(amf);
-      i=be16(*(short*)buf);
+      unsigned short x=0;
+      memcpy(&x, buf, sizeof(x));
+      i=be16(x);
       buf=&buf[sizeof(short)];
       item->type=AMF_STRING;
       item->string.length=i;
diff --git a/amfwriter.c b/amfwriter.c
index 3fc07dc..1946879 100644
--- a/amfwriter.c
+++ b/amfwriter.c
@@ -61,8 +61,8 @@ void amfstring(struct rtmp* msg, const char* string)
   msg->buf=realloc(msg->buf, msg->length);
   unsigned char* type=msg->buf+offset;
   type[0]='\x02';
-  uint16_t* strlength=(uint16_t*)(msg->buf+offset+1);
-  *strlength=be16(len);
+  uint16_t strlength=be16(len);
+  memcpy(msg->buf+offset+1, &strlength, sizeof(strlength));
   memcpy(msg->buf+offset+3, string, len);
 }
 
@@ -81,8 +81,8 @@ void amfobjitem(struct rtmp* msg, char* name)
   int offset=msg->length;
   msg->length+=2+len;
   msg->buf=realloc(msg->buf, msg->length);
-  uint16_t* strlength=(uint16_t*)(msg->buf+offset);
-  *strlength=be16(len);
+  uint16_t strlength=be16(len);
+  memcpy(msg->buf+offset, &strlength, sizeof(strlength));
   memcpy(msg->buf+offset+2, name, len);
 }
 
diff --git a/rtmp.c b/rtmp.c
index b17b704..281c74d 100644
--- a/rtmp.c
+++ b/rtmp.c
@@ -81,6 +81,7 @@ char rtmp_get(int sock, struct rtmp* rtmp)
   // Header format and chunk ID
   unsigned int x=0;
   if(fullread(sock, &x, 1)<1){return 0;}
+  x=le32(x);
   unsigned int chunkid=x&0x3f;
   unsigned int fmt=(x&0xc0)>>6;
   struct chunk* chunk=chunk_get(chunkid);