Better state management for HTTP encoder / Fix RTSP