Cleanup: move some stuff into process_video_frame().