Use same logic in audio and video.