Reland r8476 "Set decoder output frequency in AudioDecoder::Decode call"
This should be safe to land now that issue 4143 was resolved (in r8492).
This change effectively reverts 8488.
TBR=kwiberg@webrtc.org
Original commit message:
This CL changes the way the decoder sample rate is set and updated. In
practice, it only concerns the iSAC (float) codec.
One single iSAC decoder instance is used for both wideband and
super-wideband decoding, and the instance must be told to switch
output frequency if the payload type changes. This used to be done
through a call to UpdateDecoderSampleRate, but is now instead done in
the Decode call as an extra parameter.
Review URL: https://webrtc-codereview.appspot.com/39289004
Cr-Commit-Position: refs/heads/master@{#8496}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8496 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/webrtc/modules/audio_coding/neteq/neteq_impl.cc b/webrtc/modules/audio_coding/neteq/neteq_impl.cc
index f1a3a90..7370825 100644
--- a/webrtc/modules/audio_coding/neteq/neteq_impl.cc
+++ b/webrtc/modules/audio_coding/neteq/neteq_impl.cc
@@ -1266,7 +1266,7 @@
", ssrc=" << packet->header.ssrc <<
", len=" << packet->payload_length;
decode_length = decoder->DecodeRedundant(
- packet->payload, packet->payload_length,
+ packet->payload, packet->payload_length, fs_hz_,
&decoded_buffer_[*decoded_length], speech_type);
} else {
LOG(LS_VERBOSE) << "Decoding packet: ts=" << packet->header.timestamp <<
@@ -1274,10 +1274,9 @@
", pt=" << static_cast<int>(packet->header.payloadType) <<
", ssrc=" << packet->header.ssrc <<
", len=" << packet->payload_length;
- decode_length = decoder->Decode(packet->payload,
- packet->payload_length,
- &decoded_buffer_[*decoded_length],
- speech_type);
+ decode_length =
+ decoder->Decode(packet->payload, packet->payload_length, fs_hz_,
+ &decoded_buffer_[*decoded_length], speech_type);
}
delete[] packet->payload;
@@ -1607,7 +1606,8 @@
if (decoder) {
const uint8_t* dummy_payload = NULL;
AudioDecoder::SpeechType speech_type;
- length = decoder->Decode(dummy_payload, 0, decoded_buffer, &speech_type);
+ length =
+ decoder->Decode(dummy_payload, 0, fs_hz_, decoded_buffer, &speech_type);
}
assert(mute_factor_array_.get());
normal_->Process(decoded_buffer, length, last_mode_, mute_factor_array_.get(),