rtmp: Read and handle incoming packets while writing data

This makes sure all incoming packets are read and handled (and reacted
to) while sending an FLV stream over RTMP to a server. If there were
enough incoming data to fill the TCP buffers, this could potentially
make things block at unexpected places. For the upcoming RTMPT support,
we need to consume all incoming data before we can send the next
request.

Signed-off-by: Martin Storsjö <martin@martin.st>
