In this paper, we assume that the sender supports a two-mode codec with two audio sample files (PCM and GSM). The sender tracks the packet loss status according to the algorithm-loss rate estimation based on variable frame size and switches two audio sample files in accordance with packet loss status. The proposed algorithm smoothes short term variations in loss rates, while responds quickly to real changes in the loss rate of the traffic. The ability of the algorithm is qualified by the agility, stability and avoidance of frequent switching for two sample files.