Encodes frames synchronously, on the calling thread. Keeps one RGBA scratch buffer and reuses it for every frame, so a
sampled frame allocates only its JPEG.
Encodes one frame: converts it to I420 when it is in another buffer type, then scales, rotates and encodes it.
Throws when the frame is empty or its buffer is shorter than its size implies.
Encodes frames synchronously, on the calling thread. Keeps one RGBA scratch buffer and reuses it for every frame, so a sampled frame allocates only its JPEG.