A method for controlling an average encoding rate by an electronic device, comprising: obtaining a speech signal (402, 502); framing the speech signal to produce a current frame; determining a first average rate based on past frames;determining whether the first average rate is greater than a target rate or whether the first average rate is less than or equal to the target rate; controlling the average encoding rate by controlling a first threshold, wherein the first threshold is for classifying a frame as a clean frame or a noisy frame, and wherein, in the case where the first average rate is greater than the target rate, controlling the first threshold comprises increasing the first threshold to classify more frames as noisy, if the first threshold is not greater than or equal to a first threshold maximum, or, in the case where the first average rate is less than or equal to the target rate, controlling the first threshold comprises decreasing the first threshold; selecting a first frame adjustment threshold set when a metric associated with the current frame is not greater than the first threshold, or selecting a second frame adjustment threshold set when the metric is greater than the first threshold, wherein the first frame adjustment threshold set is configured to result in fewer adjustments to frame classification than the second frame adjustment threshold set, wherein a frame adjustment threshold indicates whether to adjust a frame type for a given frame; classifying the frame based on the first threshold and the selected frame adjustment threshold set; selecting an encoder to encode the current frame based on the frame type or the adjusted frame type; and sending an encoded speech signal. obtaining a speech signal (402, 502); framing the speech signal to produce a current frame; determining a first average rate based on past frames;determining whether the first average rate is greater than a target rate or whether the first average rate is less than or equal to the target rate; controlling the average encoding rate by controlling a first threshold, wherein the first threshold is for classifying a frame as a clean frame or a noisy frame, and wherein, in the case where the first average rate is greater than the target rate, controlling the first threshold comprises increasing the first threshold to classify more frames as noisy, if the first threshold is not greater than or equal to a first threshold maximum, or, in the case where the first average rate is less than or equal to the target rate, controlling the first threshold comprises decreasing the first threshold; selecting a first frame adjustment threshold set when a metric associated with the current frame is not greater than the first threshold, or selecting a second frame adjustment threshold set when the metric is greater than the first threshold, wherein the first frame adjustment threshold set is configured to result in fewer adjustments to frame classification than the second frame adjustment threshold set, wherein a frame adjustment threshold indicates whether to adjust a frame type for a given frame; classifying the frame based on the first threshold and the selected frame adjustment threshold set; selecting an encoder to encode the current frame based on the frame type or the adjusted frame type; and sending an encoded speech signal.