avformat/rtpenc_jpeg: Check remaining buffer size for SOS