Switch to base/logging.h in neteq_impl.cc
This change includes base/logging.h instead of the old and deprecated system_wrappers/interface/logging.h. This requires some changes of the actual logging invocations. For reference the following regexps where used (in Eclipse) for a few of the replacements: find: LOG_FERR1\(\s*([^,]*),\s*([^,]*),\s*(.*)\); replace: LOG($1) << "$2 " << $3; find: LOG_FERR2\(\s*([^,]*),\s*([^,]*),\s*([^,]*),\s*(.*)\); replace: LOG($1) << "$2 " << $3 << " " << $4; BUG=4735 R=minyue@webrtc.org Review URL: https://webrtc-codereview.appspot.com/50229004 . Cr-Commit-Position: refs/heads/master@{#9669}
This commit is contained in:
@ -12,6 +12,7 @@
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "webrtc/base/logging.h"
|
||||
#include "webrtc/modules/audio_coding/codecs/audio_decoder.h"
|
||||
#include "webrtc/modules/audio_coding/codecs/cng/include/webrtc_cng.h"
|
||||
#include "webrtc/modules/audio_coding/neteq/decoder_database.h"
|
||||
@ -44,6 +45,7 @@ int ComfortNoise::UpdateParameters(Packet* packet) {
|
||||
delete packet;
|
||||
if (ret < 0) {
|
||||
internal_error_code_ = WebRtcCng_GetErrorCodeDec(cng_inst);
|
||||
LOG(LS_ERROR) << "WebRtcCng_UpdateSid produced " << internal_error_code_;
|
||||
return kInternalError;
|
||||
}
|
||||
return kOK;
|
||||
@ -56,6 +58,7 @@ int ComfortNoise::Generate(size_t requested_length,
|
||||
fs_hz_ == 48000);
|
||||
// Not adapted for multi-channel yet.
|
||||
if (output->Channels() != 1) {
|
||||
LOG(LS_ERROR) << "No multi-channel support";
|
||||
return kMultiChannelNotSupported;
|
||||
}
|
||||
|
||||
@ -70,6 +73,7 @@ int ComfortNoise::Generate(size_t requested_length,
|
||||
// Get the decoder from the database.
|
||||
AudioDecoder* cng_decoder = decoder_database_->GetActiveCngDecoder();
|
||||
if (!cng_decoder) {
|
||||
LOG(LS_ERROR) << "Unknwown payload type";
|
||||
return kUnknownPayloadType;
|
||||
}
|
||||
CNG_dec_inst* cng_inst = cng_decoder->CngDecoderInstance();
|
||||
@ -81,6 +85,7 @@ int ComfortNoise::Generate(size_t requested_length,
|
||||
// Error returned.
|
||||
output->Zeros(requested_length);
|
||||
internal_error_code_ = WebRtcCng_GetErrorCodeDec(cng_inst);
|
||||
LOG(LS_ERROR) << "WebRtcCng_Generate produced " << internal_error_code_;
|
||||
return kInternalError;
|
||||
}
|
||||
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
#include <assert.h>
|
||||
#include <utility> // pair
|
||||
|
||||
#include "webrtc/base/logging.h"
|
||||
#include "webrtc/modules/audio_coding/codecs/audio_decoder.h"
|
||||
|
||||
namespace webrtc {
|
||||
@ -249,6 +250,8 @@ int DecoderDatabase::CheckPayloadTypes(const PacketList& packet_list) const {
|
||||
for (it = packet_list.begin(); it != packet_list.end(); ++it) {
|
||||
if (decoders_.find((*it)->header.payloadType) == decoders_.end()) {
|
||||
// Payload type is not found.
|
||||
LOG(LS_WARNING) << "CheckPayloadTypes: unknown RTP payload type "
|
||||
<< static_cast<int>((*it)->header.payloadType);
|
||||
return kDecoderNotFound;
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,6 +13,9 @@
|
||||
#include <assert.h>
|
||||
#include <algorithm> // max
|
||||
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/base/logging.h"
|
||||
|
||||
// Modify the code to obtain backwards bit-exactness. Once bit-exactness is no
|
||||
// longer required, this #define should be removed (and the code that it
|
||||
// enables).
|
||||
@ -67,10 +70,10 @@ int DtmfBuffer::ParseEvent(uint32_t rtp_timestamp,
|
||||
const uint8_t* payload,
|
||||
size_t payload_length_bytes,
|
||||
DtmfEvent* event) {
|
||||
if (!payload || !event) {
|
||||
return kInvalidPointer;
|
||||
}
|
||||
CHECK(payload);
|
||||
CHECK(event);
|
||||
if (payload_length_bytes < 4) {
|
||||
LOG(LS_WARNING) << "ParseEvent payload too short";
|
||||
return kPayloadTooShort;
|
||||
}
|
||||
|
||||
@ -98,6 +101,7 @@ int DtmfBuffer::InsertEvent(const DtmfEvent& event) {
|
||||
if (event.event_no < 0 || event.event_no > 15 ||
|
||||
event.volume < 0 || event.volume > 36 ||
|
||||
event.duration <= 0 || event.duration > 65535) {
|
||||
LOG(LS_WARNING) << "InsertEvent invalid parameters";
|
||||
return kInvalidEventParameters;
|
||||
}
|
||||
DtmfList::iterator it = buffer_.begin();
|
||||
|
||||
@ -77,12 +77,6 @@ TEST(DtmfBuffer, ParseEvent) {
|
||||
EXPECT_EQ(timestamp, event.timestamp);
|
||||
EXPECT_EQ(volume, event.volume);
|
||||
|
||||
EXPECT_EQ(DtmfBuffer::kInvalidPointer,
|
||||
DtmfBuffer::ParseEvent(timestamp, NULL, 4, &event));
|
||||
|
||||
EXPECT_EQ(DtmfBuffer::kInvalidPointer,
|
||||
DtmfBuffer::ParseEvent(timestamp, payload_ptr, 4, NULL));
|
||||
|
||||
EXPECT_EQ(DtmfBuffer::kPayloadTooShort,
|
||||
DtmfBuffer::ParseEvent(timestamp, payload_ptr, 3, &event));
|
||||
}
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "webrtc/base/logging.h"
|
||||
#include "webrtc/common_audio/signal_processing/include/signal_processing_library.h"
|
||||
#include "webrtc/modules/audio_coding/codecs/audio_decoder.h"
|
||||
#include "webrtc/modules/audio_coding/neteq/accelerate.h"
|
||||
@ -40,7 +41,6 @@
|
||||
#include "webrtc/modules/audio_coding/neteq/timestamp_scaler.h"
|
||||
#include "webrtc/modules/interface/module_common_types.h"
|
||||
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
|
||||
#include "webrtc/system_wrappers/interface/logging.h"
|
||||
|
||||
// Modify the code to obtain backwards bit-exactness. Once bit-exactness is no
|
||||
// longer required, this #define should be removed (and the code that it
|
||||
@ -102,7 +102,6 @@ NetEqImpl::NetEqImpl(const NetEq::Config& config,
|
||||
"Changing to 8000 Hz.";
|
||||
fs = 8000;
|
||||
}
|
||||
LOG(LS_VERBOSE) << "Create NetEqImpl object with fs = " << fs << ".";
|
||||
fs_hz_ = fs;
|
||||
fs_mult_ = fs / 8000;
|
||||
output_size_samples_ = kOutputSizeMs * 8 * fs_mult_;
|
||||
@ -113,9 +112,7 @@ NetEqImpl::NetEqImpl(const NetEq::Config& config,
|
||||
}
|
||||
}
|
||||
|
||||
NetEqImpl::~NetEqImpl() {
|
||||
LOG(LS_INFO) << "Deleting NetEqImpl object.";
|
||||
}
|
||||
NetEqImpl::~NetEqImpl() = default;
|
||||
|
||||
int NetEqImpl::InsertPacket(const WebRtcRTPHeader& rtp_header,
|
||||
const uint8_t* payload,
|
||||
@ -130,7 +127,6 @@ int NetEqImpl::InsertPacket(const WebRtcRTPHeader& rtp_header,
|
||||
int error = InsertPacketInternal(rtp_header, payload, length_bytes,
|
||||
receive_timestamp, false);
|
||||
if (error != 0) {
|
||||
LOG_FERR1(LS_WARNING, InsertPacketInternal, error);
|
||||
error_code_ = error;
|
||||
return kFail;
|
||||
}
|
||||
@ -151,7 +147,6 @@ int NetEqImpl::InsertSyncPacket(const WebRtcRTPHeader& rtp_header,
|
||||
rtp_header, kSyncPayload, sizeof(kSyncPayload), receive_timestamp, true);
|
||||
|
||||
if (error != 0) {
|
||||
LOG_FERR1(LS_WARNING, InsertPacketInternal, error);
|
||||
error_code_ = error;
|
||||
return kFail;
|
||||
}
|
||||
@ -168,7 +163,6 @@ int NetEqImpl::GetAudio(size_t max_length, int16_t* output_audio,
|
||||
LOG(LS_VERBOSE) << "Produced " << *samples_per_channel <<
|
||||
" samples/channel for " << *num_channels << " channel(s)";
|
||||
if (error != 0) {
|
||||
LOG_FERR1(LS_WARNING, GetAudioInternal, error);
|
||||
error_code_ = error;
|
||||
return kFail;
|
||||
}
|
||||
@ -181,11 +175,10 @@ int NetEqImpl::GetAudio(size_t max_length, int16_t* output_audio,
|
||||
int NetEqImpl::RegisterPayloadType(enum NetEqDecoder codec,
|
||||
uint8_t rtp_payload_type) {
|
||||
CriticalSectionScoped lock(crit_sect_.get());
|
||||
LOG_API2(static_cast<int>(rtp_payload_type), codec);
|
||||
LOG(LS_VERBOSE) << "RegisterPayloadType "
|
||||
<< static_cast<int>(rtp_payload_type) << " " << codec;
|
||||
int ret = decoder_database_->RegisterPayload(rtp_payload_type, codec);
|
||||
if (ret != DecoderDatabase::kOK) {
|
||||
LOG_FERR2(LS_WARNING, RegisterPayload, static_cast<int>(rtp_payload_type),
|
||||
codec);
|
||||
switch (ret) {
|
||||
case DecoderDatabase::kInvalidRtpPayloadType:
|
||||
error_code_ = kInvalidRtpPayloadType;
|
||||
@ -209,7 +202,8 @@ int NetEqImpl::RegisterExternalDecoder(AudioDecoder* decoder,
|
||||
uint8_t rtp_payload_type,
|
||||
int sample_rate_hz) {
|
||||
CriticalSectionScoped lock(crit_sect_.get());
|
||||
LOG_API2(static_cast<int>(rtp_payload_type), codec);
|
||||
LOG(LS_VERBOSE) << "RegisterExternalDecoder "
|
||||
<< static_cast<int>(rtp_payload_type) << " " << codec;
|
||||
if (!decoder) {
|
||||
LOG(LS_ERROR) << "Cannot register external decoder with NULL pointer";
|
||||
assert(false);
|
||||
@ -218,8 +212,6 @@ int NetEqImpl::RegisterExternalDecoder(AudioDecoder* decoder,
|
||||
int ret = decoder_database_->InsertExternal(rtp_payload_type, codec,
|
||||
sample_rate_hz, decoder);
|
||||
if (ret != DecoderDatabase::kOK) {
|
||||
LOG_FERR2(LS_WARNING, InsertExternal, static_cast<int>(rtp_payload_type),
|
||||
codec);
|
||||
switch (ret) {
|
||||
case DecoderDatabase::kInvalidRtpPayloadType:
|
||||
error_code_ = kInvalidRtpPayloadType;
|
||||
@ -246,7 +238,6 @@ int NetEqImpl::RegisterExternalDecoder(AudioDecoder* decoder,
|
||||
|
||||
int NetEqImpl::RemovePayloadType(uint8_t rtp_payload_type) {
|
||||
CriticalSectionScoped lock(crit_sect_.get());
|
||||
LOG_API1(static_cast<int>(rtp_payload_type));
|
||||
int ret = decoder_database_->Remove(rtp_payload_type);
|
||||
if (ret == DecoderDatabase::kOK) {
|
||||
return kOK;
|
||||
@ -255,7 +246,6 @@ int NetEqImpl::RemovePayloadType(uint8_t rtp_payload_type) {
|
||||
} else {
|
||||
error_code_ = kOtherError;
|
||||
}
|
||||
LOG_FERR1(LS_WARNING, Remove, static_cast<int>(rtp_payload_type));
|
||||
return kFail;
|
||||
}
|
||||
|
||||
@ -389,7 +379,7 @@ int NetEqImpl::LastDecoderError() {
|
||||
|
||||
void NetEqImpl::FlushBuffers() {
|
||||
CriticalSectionScoped lock(crit_sect_.get());
|
||||
LOG_API0();
|
||||
LOG(LS_VERBOSE) << "FlushBuffers";
|
||||
packet_buffer_->Flush();
|
||||
assert(sync_buffer_.get());
|
||||
assert(expand_.get());
|
||||
@ -517,7 +507,6 @@ int NetEqImpl::InsertPacketInternal(const WebRtcRTPHeader& rtp_header,
|
||||
if (decoder_database_->IsRed(main_header.payloadType)) {
|
||||
assert(!is_sync_packet); // We had a sanity check for this.
|
||||
if (payload_splitter_->SplitRed(&packet_list) != PayloadSplitter::kOK) {
|
||||
LOG_FERR1(LS_WARNING, SplitRed, packet_list.size());
|
||||
PacketBuffer::DeleteAllPackets(&packet_list);
|
||||
return kRedundancySplitError;
|
||||
}
|
||||
@ -532,7 +521,6 @@ int NetEqImpl::InsertPacketInternal(const WebRtcRTPHeader& rtp_header,
|
||||
// Check payload types.
|
||||
if (decoder_database_->CheckPayloadTypes(packet_list) ==
|
||||
DecoderDatabase::kDecoderNotFound) {
|
||||
LOG_FERR1(LS_WARNING, CheckPayloadTypes, packet_list.size());
|
||||
PacketBuffer::DeleteAllPackets(&packet_list);
|
||||
return kUnknownRtpPayloadType;
|
||||
}
|
||||
@ -556,13 +544,10 @@ int NetEqImpl::InsertPacketInternal(const WebRtcRTPHeader& rtp_header,
|
||||
current_packet->payload_length,
|
||||
&event);
|
||||
if (ret != DtmfBuffer::kOK) {
|
||||
LOG_FERR2(LS_WARNING, ParseEvent, ret,
|
||||
current_packet->payload_length);
|
||||
PacketBuffer::DeleteAllPackets(&packet_list);
|
||||
return kDtmfParsingError;
|
||||
}
|
||||
if (dtmf_buffer_->InsertEvent(event) != DtmfBuffer::kOK) {
|
||||
LOG_FERR0(LS_WARNING, InsertEvent);
|
||||
PacketBuffer::DeleteAllPackets(&packet_list);
|
||||
return kDtmfInsertError;
|
||||
}
|
||||
@ -578,7 +563,6 @@ int NetEqImpl::InsertPacketInternal(const WebRtcRTPHeader& rtp_header,
|
||||
// Check for FEC in packets, and separate payloads into several packets.
|
||||
int ret = payload_splitter_->SplitFec(&packet_list, decoder_database_.get());
|
||||
if (ret != PayloadSplitter::kOK) {
|
||||
LOG_FERR1(LS_WARNING, SplitFec, packet_list.size());
|
||||
PacketBuffer::DeleteAllPackets(&packet_list);
|
||||
switch (ret) {
|
||||
case PayloadSplitter::kUnknownPayloadType:
|
||||
@ -593,7 +577,6 @@ int NetEqImpl::InsertPacketInternal(const WebRtcRTPHeader& rtp_header,
|
||||
// sync-packets.
|
||||
ret = payload_splitter_->SplitAudio(&packet_list, *decoder_database_);
|
||||
if (ret != PayloadSplitter::kOK) {
|
||||
LOG_FERR1(LS_WARNING, SplitAudio, packet_list.size());
|
||||
PacketBuffer::DeleteAllPackets(&packet_list);
|
||||
switch (ret) {
|
||||
case PayloadSplitter::kUnknownPayloadType:
|
||||
@ -630,9 +613,7 @@ int NetEqImpl::InsertPacketInternal(const WebRtcRTPHeader& rtp_header,
|
||||
// Reset DSP timestamp etc. if packet buffer flushed.
|
||||
new_codec_ = true;
|
||||
update_sample_rate_and_channels = true;
|
||||
LOG_F(LS_WARNING) << "Packet buffer flushed";
|
||||
} else if (ret != PacketBuffer::kOK) {
|
||||
LOG_FERR1(LS_WARNING, InsertPacketList, packet_list.size());
|
||||
PacketBuffer::DeleteAllPackets(&packet_list);
|
||||
return kOtherError;
|
||||
}
|
||||
@ -716,7 +697,6 @@ int NetEqImpl::GetAudioInternal(size_t max_length,
|
||||
int return_value = GetDecision(&operation, &packet_list, &dtmf_event,
|
||||
&play_dtmf);
|
||||
if (return_value != 0) {
|
||||
LOG_FERR1(LS_WARNING, GetDecision, return_value);
|
||||
assert(false);
|
||||
last_mode_ = kModeError;
|
||||
return return_value;
|
||||
@ -807,7 +787,7 @@ int NetEqImpl::GetAudioInternal(size_t max_length,
|
||||
break;
|
||||
}
|
||||
case kUndefined: {
|
||||
LOG_F(LS_ERROR) << "Invalid operation kUndefined.";
|
||||
LOG(LS_ERROR) << "Invalid operation kUndefined.";
|
||||
assert(false); // This should not happen.
|
||||
last_mode_ = kModeError;
|
||||
return kInvalidOperation;
|
||||
@ -834,15 +814,17 @@ int NetEqImpl::GetAudioInternal(size_t max_length,
|
||||
num_output_samples_per_channel = static_cast<int>(
|
||||
max_length / sync_buffer_->Channels());
|
||||
}
|
||||
int samples_from_sync = static_cast<int>(
|
||||
sync_buffer_->GetNextAudioInterleaved(num_output_samples_per_channel,
|
||||
output));
|
||||
const int samples_from_sync =
|
||||
static_cast<int>(sync_buffer_->GetNextAudioInterleaved(
|
||||
num_output_samples_per_channel, output));
|
||||
*num_channels = static_cast<int>(sync_buffer_->Channels());
|
||||
LOG(LS_VERBOSE) << "Sync buffer (" << *num_channels << " channel(s)):" <<
|
||||
" insert " << algorithm_buffer_->Size() << " samples, extract " <<
|
||||
samples_from_sync << " samples";
|
||||
if (samples_from_sync != output_size_samples_) {
|
||||
LOG_F(LS_ERROR) << "samples_from_sync != output_size_samples_";
|
||||
LOG(LS_ERROR) << "samples_from_sync (" << samples_from_sync
|
||||
<< ") != output_size_samples_ (" << output_size_samples_
|
||||
<< ")";
|
||||
// TODO(minyue): treatment of under-run, filling zeros
|
||||
memset(output, 0, num_output_samples * sizeof(int16_t));
|
||||
*samples_per_channel = output_size_samples_;
|
||||
@ -983,7 +965,7 @@ int NetEqImpl::GetDecision(Operations* operation,
|
||||
} else {
|
||||
assert(header);
|
||||
if (!header) {
|
||||
LOG_F(LS_ERROR) << "Packet missing where it shouldn't.";
|
||||
LOG(LS_ERROR) << "Packet missing where it shouldn't.";
|
||||
return -1;
|
||||
}
|
||||
timestamp_ = header->timestamp;
|
||||
@ -1129,7 +1111,6 @@ int NetEqImpl::GetDecision(Operations* operation,
|
||||
|
||||
extracted_samples = ExtractPackets(required_samples, packet_list);
|
||||
if (extracted_samples < 0) {
|
||||
LOG_F(LS_WARNING) << "Failed to extract packets from buffer.";
|
||||
return kPacketBufferCorruption;
|
||||
}
|
||||
}
|
||||
@ -1165,7 +1146,8 @@ int NetEqImpl::Decode(PacketList* packet_list, Operations* operation,
|
||||
decoder = decoder_database_->GetDecoder(payload_type);
|
||||
assert(decoder);
|
||||
if (!decoder) {
|
||||
LOG_FERR1(LS_WARNING, GetDecoder, static_cast<int>(payload_type));
|
||||
LOG(LS_WARNING) << "Unknown payload type "
|
||||
<< static_cast<int>(payload_type);
|
||||
PacketBuffer::DeleteAllPackets(packet_list);
|
||||
return kDecoderNotFound;
|
||||
}
|
||||
@ -1177,7 +1159,8 @@ int NetEqImpl::Decode(PacketList* packet_list, Operations* operation,
|
||||
->GetDecoderInfo(payload_type);
|
||||
assert(decoder_info);
|
||||
if (!decoder_info) {
|
||||
LOG_FERR1(LS_WARNING, GetDecoderInfo, static_cast<int>(payload_type));
|
||||
LOG(LS_WARNING) << "Unknown payload type "
|
||||
<< static_cast<int>(payload_type);
|
||||
PacketBuffer::DeleteAllPackets(packet_list);
|
||||
return kDecoderNotFound;
|
||||
}
|
||||
@ -1239,11 +1222,12 @@ int NetEqImpl::Decode(PacketList* packet_list, Operations* operation,
|
||||
// Got some error code from the decoder.
|
||||
decoder_error_code_ = error_code;
|
||||
return_value = kDecoderErrorCode;
|
||||
LOG(LS_WARNING) << "Decoder returned error code: " << error_code;
|
||||
} else {
|
||||
// Decoder does not implement error codes. Return generic error.
|
||||
return_value = kOtherDecoderError;
|
||||
LOG(LS_WARNING) << "Decoder error (no error code)";
|
||||
}
|
||||
LOG_FERR2(LS_WARNING, DecodeLoop, error_code, packet_list->size());
|
||||
*operation = kExpand; // Do expansion to get data instead.
|
||||
}
|
||||
if (*speech_type != AudioDecoder::kComfortNoise) {
|
||||
@ -1329,14 +1313,14 @@ int NetEqImpl::DecodeLoop(PacketList* packet_list, Operations* operation,
|
||||
<< decoder_frame_length_ << " samples per channel)";
|
||||
} else if (decode_length < 0) {
|
||||
// Error.
|
||||
LOG_FERR2(LS_WARNING, Decode, decode_length, payload_length);
|
||||
LOG(LS_WARNING) << "Decode " << decode_length << " " << payload_length;
|
||||
*decoded_length = -1;
|
||||
PacketBuffer::DeleteAllPackets(packet_list);
|
||||
break;
|
||||
}
|
||||
if (*decoded_length > static_cast<int>(decoded_buffer_length_)) {
|
||||
// Guard against overflow.
|
||||
LOG_F(LS_WARNING) << "Decoded too much.";
|
||||
LOG(LS_WARNING) << "Decoded too much.";
|
||||
PacketBuffer::DeleteAllPackets(packet_list);
|
||||
return kDecodedTooMuch;
|
||||
}
|
||||
@ -1614,7 +1598,6 @@ int NetEqImpl::DoRfc3389Cng(PacketList* packet_list, bool play_dtmf) {
|
||||
// UpdateParameters() deletes |packet|.
|
||||
if (comfort_noise_->UpdateParameters(packet) ==
|
||||
ComfortNoise::kInternalError) {
|
||||
LOG_FERR0(LS_WARNING, UpdateParameters);
|
||||
algorithm_buffer_->Zeros(output_size_samples_);
|
||||
return -comfort_noise_->internal_error_code();
|
||||
}
|
||||
@ -1627,11 +1610,9 @@ int NetEqImpl::DoRfc3389Cng(PacketList* packet_list, bool play_dtmf) {
|
||||
dtmf_tone_generator_->Reset();
|
||||
}
|
||||
if (cn_return == ComfortNoise::kInternalError) {
|
||||
LOG_FERR1(LS_WARNING, comfort_noise_->Generate, cn_return);
|
||||
decoder_error_code_ = comfort_noise_->internal_error_code();
|
||||
return kComfortNoiseErrorCode;
|
||||
} else if (cn_return == ComfortNoise::kUnknownPayloadType) {
|
||||
LOG_FERR1(LS_WARNING, comfort_noise_->Generate, cn_return);
|
||||
return kUnknownRtpPayloadType;
|
||||
}
|
||||
return 0;
|
||||
@ -1800,6 +1781,7 @@ int NetEqImpl::ExtractPackets(int required_samples, PacketList* packet_list) {
|
||||
const RTPHeader* header = packet_buffer_->NextRtpHeader();
|
||||
assert(header);
|
||||
if (!header) {
|
||||
LOG(LS_ERROR) << "Packet buffer unexpectedly empty.";
|
||||
return -1;
|
||||
}
|
||||
uint32_t first_timestamp = header->timestamp;
|
||||
@ -1813,8 +1795,7 @@ int NetEqImpl::ExtractPackets(int required_samples, PacketList* packet_list) {
|
||||
// |header| may be invalid after the |packet_buffer_| operation.
|
||||
header = NULL;
|
||||
if (!packet) {
|
||||
LOG_FERR1(LS_ERROR, GetNextPacket, discard_count) <<
|
||||
"Should always be able to extract a packet here";
|
||||
LOG(LS_ERROR) << "Should always be able to extract a packet here";
|
||||
assert(false); // Should always be able to extract a packet here.
|
||||
return -1;
|
||||
}
|
||||
@ -1850,9 +1831,8 @@ int NetEqImpl::ExtractPackets(int required_samples, PacketList* packet_list) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
LOG_FERR1(LS_WARNING, GetDecoder,
|
||||
static_cast<int>(packet->header.payloadType))
|
||||
<< "Could not find a decoder for a packet about to be extracted.";
|
||||
LOG(LS_WARNING) << "Unknown payload type "
|
||||
<< static_cast<int>(packet->header.payloadType);
|
||||
assert(false);
|
||||
}
|
||||
if (packet_duration <= 0) {
|
||||
@ -1899,7 +1879,7 @@ void NetEqImpl::UpdatePlcComponents(int fs_hz, size_t channels) {
|
||||
}
|
||||
|
||||
void NetEqImpl::SetSampleRateAndChannels(int fs_hz, size_t channels) {
|
||||
LOG_API2(fs_hz, channels);
|
||||
LOG(LS_VERBOSE) << "SetSampleRateAndChannels " << fs_hz << " " << channels;
|
||||
// TODO(hlundin): Change to an enumerator and skip assert.
|
||||
assert(fs_hz == 8000 || fs_hz == 16000 || fs_hz == 32000 || fs_hz == 48000);
|
||||
assert(channels > 0);
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
|
||||
#include <algorithm> // find_if()
|
||||
|
||||
#include "webrtc/base/logging.h"
|
||||
#include "webrtc/modules/audio_coding/codecs/audio_decoder.h"
|
||||
#include "webrtc/modules/audio_coding/neteq/decoder_database.h"
|
||||
|
||||
@ -58,6 +59,7 @@ int PacketBuffer::InsertPacket(Packet* packet) {
|
||||
if (packet) {
|
||||
delete packet;
|
||||
}
|
||||
LOG(LS_WARNING) << "InsertPacket invalid packet";
|
||||
return kInvalidPacket;
|
||||
}
|
||||
|
||||
@ -66,6 +68,7 @@ int PacketBuffer::InsertPacket(Packet* packet) {
|
||||
if (buffer_.size() >= max_number_of_packets_) {
|
||||
// Buffer is full. Flush it.
|
||||
Flush();
|
||||
LOG(LS_WARNING) << "Packet buffer flushed";
|
||||
return_val = kFlushed;
|
||||
}
|
||||
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "webrtc/base/logging.h"
|
||||
#include "webrtc/modules/audio_coding/neteq/decoder_database.h"
|
||||
|
||||
namespace webrtc {
|
||||
@ -88,6 +89,7 @@ int PayloadSplitter::SplitRed(PacketList* packet_list) {
|
||||
// The block lengths in the RED headers do not match the overall packet
|
||||
// length. Something is corrupt. Discard this and the remaining
|
||||
// payloads from this packet.
|
||||
LOG(LS_WARNING) << "SplitRed length mismatch";
|
||||
while (new_it != new_packets.end()) {
|
||||
// Payload should not have been allocated yet.
|
||||
assert(!(*new_it)->payload);
|
||||
@ -130,6 +132,7 @@ int PayloadSplitter::SplitFec(PacketList* packet_list,
|
||||
const DecoderDatabase::DecoderInfo* info =
|
||||
decoder_database->GetDecoderInfo(payload_type);
|
||||
if (!info) {
|
||||
LOG(LS_WARNING) << "SplitFec unknown payload type";
|
||||
return kUnknownPayloadType;
|
||||
}
|
||||
// No splitting for a sync-packet.
|
||||
@ -171,6 +174,7 @@ int PayloadSplitter::SplitFec(PacketList* packet_list,
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
LOG(LS_WARNING) << "SplitFec wrong payload type";
|
||||
return kFecSplitError;
|
||||
}
|
||||
}
|
||||
@ -222,6 +226,7 @@ int PayloadSplitter::SplitAudio(PacketList* packet_list,
|
||||
const DecoderDatabase::DecoderInfo* info =
|
||||
decoder_database.GetDecoderInfo(packet->header.payloadType);
|
||||
if (!info) {
|
||||
LOG(LS_WARNING) << "SplitAudio unknown payload type";
|
||||
return kUnknownPayloadType;
|
||||
}
|
||||
// No splitting for a sync-packet.
|
||||
@ -297,6 +302,7 @@ int PayloadSplitter::SplitAudio(PacketList* packet_list,
|
||||
size_t bytes_per_frame;
|
||||
int timestamps_per_frame;
|
||||
if (packet->payload_length >= 950) {
|
||||
LOG(LS_WARNING) << "SplitAudio too large iLBC payload";
|
||||
return kTooLargePayload;
|
||||
}
|
||||
if (packet->payload_length % 38 == 0) {
|
||||
@ -308,6 +314,7 @@ int PayloadSplitter::SplitAudio(PacketList* packet_list,
|
||||
bytes_per_frame = 50;
|
||||
timestamps_per_frame = 240;
|
||||
} else {
|
||||
LOG(LS_WARNING) << "SplitAudio invalid iLBC payload";
|
||||
return kFrameSplitError;
|
||||
}
|
||||
int ret = SplitByFrames(packet, bytes_per_frame, timestamps_per_frame,
|
||||
@ -402,6 +409,7 @@ int PayloadSplitter::SplitByFrames(const Packet* packet,
|
||||
uint32_t timestamps_per_frame,
|
||||
PacketList* new_packets) {
|
||||
if (packet->payload_length % bytes_per_frame != 0) {
|
||||
LOG(LS_WARNING) << "SplitByFrames length mismatch";
|
||||
return kFrameSplitError;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user