Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Unified Diff: webrtc/modules/audio_coding/codecs/isac/audio_decoder_isac_t_impl.h

Issue 2020353003: AudioDecoderIsacT: Require caller to always specify sample rate (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_coding/codecs/isac/audio_decoder_isac_t_impl.h
diff --git a/webrtc/modules/audio_coding/codecs/isac/audio_decoder_isac_t_impl.h b/webrtc/modules/audio_coding/codecs/isac/audio_decoder_isac_t_impl.h
index 431632112ac7333bb3582409c2cdb8ce9d9199ae..e19f882006576bf334bd7bcf3d9a9eda590d61c2 100644
--- a/webrtc/modules/audio_coding/codecs/isac/audio_decoder_isac_t_impl.h
+++ b/webrtc/modules/audio_coding/codecs/isac/audio_decoder_isac_t_impl.h
@@ -18,32 +18,16 @@
namespace webrtc {
template <typename T>
-AudioDecoderIsacT<T>::AudioDecoderIsacT()
- : AudioDecoderIsacT(rtc::Optional<int>(), nullptr) {}
-
-template <typename T>
-AudioDecoderIsacT<T>::AudioDecoderIsacT(
- const rtc::scoped_refptr<LockedIsacBandwidthInfo>& bwinfo)
- : AudioDecoderIsacT(rtc::Optional<int>(), bwinfo) {}
-
-template <typename T>
AudioDecoderIsacT<T>::AudioDecoderIsacT(int sample_rate_hz)
- : AudioDecoderIsacT(rtc::Optional<int>(sample_rate_hz), nullptr) {}
+ : AudioDecoderIsacT(sample_rate_hz, nullptr) {}
template <typename T>
AudioDecoderIsacT<T>::AudioDecoderIsacT(
int sample_rate_hz,
const rtc::scoped_refptr<LockedIsacBandwidthInfo>& bwinfo)
- : AudioDecoderIsacT(rtc::Optional<int>(sample_rate_hz), bwinfo) {}
-
-template <typename T>
-AudioDecoderIsacT<T>::AudioDecoderIsacT(
- rtc::Optional<int> sample_rate_hz,
- const rtc::scoped_refptr<LockedIsacBandwidthInfo>& bwinfo)
: sample_rate_hz_(sample_rate_hz), bwinfo_(bwinfo) {
- RTC_CHECK(!sample_rate_hz || *sample_rate_hz == 16000 ||
- *sample_rate_hz == 32000)
- << "Unsupported sample rate " << *sample_rate_hz;
+ RTC_CHECK(sample_rate_hz == 16000 || sample_rate_hz == 32000)
+ << "Unsupported sample rate " << sample_rate_hz;
RTC_CHECK_EQ(0, T::Create(&isac_state_));
T::DecoderInit(isac_state_);
if (bwinfo_) {
@@ -51,9 +35,7 @@ AudioDecoderIsacT<T>::AudioDecoderIsacT(
T::GetBandwidthInfo(isac_state_, &bi);
bwinfo_->Set(bi);
}
- if (sample_rate_hz_) {
- RTC_CHECK_EQ(0, T::SetDecSampRate(isac_state_, *sample_rate_hz_));
- }
+ RTC_CHECK_EQ(0, T::SetDecSampRate(isac_state_, sample_rate_hz_));
}
template <typename T>
@@ -67,14 +49,7 @@ int AudioDecoderIsacT<T>::DecodeInternal(const uint8_t* encoded,
int sample_rate_hz,
int16_t* decoded,
SpeechType* speech_type) {
- if (sample_rate_hz_) {
- RTC_CHECK_EQ(*sample_rate_hz_, sample_rate_hz);
- } else {
- RTC_CHECK(sample_rate_hz == 16000 || sample_rate_hz == 32000)
- << "Unsupported sample rate " << sample_rate_hz;
- sample_rate_hz_ = rtc::Optional<int>(sample_rate_hz);
- RTC_CHECK_EQ(0, T::SetDecSampRate(isac_state_, *sample_rate_hz_));
- }
+ RTC_CHECK_EQ(sample_rate_hz_, sample_rate_hz);
int16_t temp_type = 1; // Default is speech.
int ret =
T::DecodeInternal(isac_state_, encoded, encoded_len, decoded, &temp_type);
@@ -121,8 +96,7 @@ int AudioDecoderIsacT<T>::ErrorCode() {
template <typename T>
int AudioDecoderIsacT<T>::SampleRateHz() const {
- RTC_CHECK(sample_rate_hz_) << "Sample rate not set yet!";
- return *sample_rate_hz_;
+ return sample_rate_hz_;
}
template <typename T>

Powered by Google App Engine
This is Rietveld 408576698