Try to handle EAGAIN from avcodec_send_packet() properly.