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}
This commit is contained in:
Henrik Lundin
2017-06-14 12:29:03 +02:00
committed by Commit Bot
parent 2b3aa14ee2
commit c417d9e558
8 changed files with 51 additions and 180 deletions

View File

@ -18,21 +18,14 @@ namespace webrtc {
namespace test {
void DefaultNetEqTestErrorCallback::OnInsertPacketError(
int error_code,
const NetEqInput::PacketData& packet) {
if (error_code == NetEq::kUnknownRtpPayloadType) {
std::cerr << "RTP Payload type "
<< static_cast<int>(packet.header.payloadType) << " is unknown."
<< std::endl;
} else {
std::cerr << "InsertPacket returned error code " << error_code << std::endl;
}
std::cerr << "InsertPacket returned an error." << std::endl;
std::cerr << "Packet data: " << packet.ToString() << std::endl;
FATAL();
}
void DefaultNetEqTestErrorCallback::OnGetAudioError(int error_code) {
std::cerr << "GetAudio returned error code " << error_code << std::endl;
void DefaultNetEqTestErrorCallback::OnGetAudioError() {
std::cerr << "GetAudio returned an error." << std::endl;
FATAL();
}
@ -70,8 +63,7 @@ int64_t NetEqTest::Run() {
rtc::ArrayView<const uint8_t>(packet_data->payload),
static_cast<uint32_t>(packet_data->time_ms * sample_rate_hz_ / 1000));
if (error != NetEq::kOK && callbacks_.error_callback) {
callbacks_.error_callback->OnInsertPacketError(neteq_->LastError(),
*packet_data);
callbacks_.error_callback->OnInsertPacketError(*packet_data);
}
if (callbacks_.post_insert_packet) {
callbacks_.post_insert_packet->AfterInsertPacket(*packet_data,
@ -91,7 +83,7 @@ int64_t NetEqTest::Run() {
RTC_CHECK(!muted) << "The code does not handle enable_muted_state";
if (error != NetEq::kOK) {
if (callbacks_.error_callback) {
callbacks_.error_callback->OnGetAudioError(neteq_->LastError());
callbacks_.error_callback->OnGetAudioError();
}
} else {
sample_rate_hz_ = out_frame.sample_rate_hz_;