NetEq: Removing LastError and LastDecoderError
LastDecoderError was only used in tests. LastError was only used in
conjunction with RemovePayloadType, and always to distinguish between
"decoder not found" and "other error". In AcmReceiver, "decoder not
found" was not treated as an error.
With this change, calling NetEq::RemovePayloadType with a payload type
that is not registered is no longer considered to be an error. This
allows to rewrite the code in AcmReceiver, such that it no longer has
to call LastError.
The internal member variables NetEqImpl::error_code_ and
NetEqImpl::decoder_error_code_ are removed, since they were no longer
read.
Bug: none
Change-Id: Ibfe97265954a2870c3caea4a34aac958351d7ff1
Reviewed-on: https://chromium-review.googlesource.com/535533
Commit-Queue: Henrik Lundin <henrik.lundin@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#18588}
diff --git a/webrtc/modules/audio_coding/acm2/acm_receiver.cc b/webrtc/modules/audio_coding/acm2/acm_receiver.cc
index a2a5eb7..8f21e89 100644
--- a/webrtc/modules/audio_coding/acm2/acm_receiver.cc
+++ b/webrtc/modules/audio_coding/acm2/acm_receiver.cc
@@ -219,8 +219,7 @@
return 0;
}
- if (neteq_->RemovePayloadType(payload_type) != NetEq::kOK &&
- neteq_->LastError() != NetEq::kDecoderNotFound) {
+ if (neteq_->RemovePayloadType(payload_type) != NetEq::kOK) {
LOG(LERROR) << "Cannot remove payload " << static_cast<int>(payload_type);
return -1;
}
@@ -249,8 +248,7 @@
return true;
}
- if (neteq_->RemovePayloadType(rtp_payload_type) != NetEq::kOK &&
- neteq_->LastError() != NetEq::kDecoderNotFound) {
+ if (neteq_->RemovePayloadType(rtp_payload_type) != NetEq::kOK) {
LOG(LERROR) << "AcmReceiver::AddCodec: Could not remove existing decoder"
" for payload type "
<< rtp_payload_type;
@@ -280,9 +278,9 @@
int AcmReceiver::RemoveCodec(uint8_t payload_type) {
rtc::CritScope lock(&crit_sect_);
- if (neteq_->RemovePayloadType(payload_type) != NetEq::kOK &&
- neteq_->LastError() != NetEq::kDecoderNotFound) {
- LOG(LERROR) << "AcmReceiver::RemoveCodec" << static_cast<int>(payload_type);
+ if (neteq_->RemovePayloadType(payload_type) != NetEq::kOK) {
+ LOG(LERROR) << "AcmReceiver::RemoveCodec "
+ << static_cast<int>(payload_type);
return -1;
}
if (last_audio_decoder_ && payload_type == last_audio_decoder_->pltype) {