Rescaling is not recommended because to rescale you need perform full video transcoding.
1) Decode H.264.
2) Rescale.
3) Encode H.264.
To resample and transcode video, you can just pass width and height in the player
Code:
session.createStream({name:'stream1',constraints:{audio:true,video:{width:640,height:480}}}).play();
The rescalingshould preserve ratio.
So if your publishing stream is 1280x720 and you request 640x480, it will be rescaled to 640x360 to preserve ratio.
Therefore ratio will be preserved anyway, regardless rescaling.