Don't print a warning if RTPPacketHistory::SetStorePacketStatus is called

twice with the same settings.

Without this change, setting up a call with the new video API will
print a trace warning.

R=stefan@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/8859004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@5566 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
mflodman@webrtc.org 2014-02-18 14:51:00 +00:00
parent 2086e0fbf3
commit c320027d6a

View File

@ -37,7 +37,7 @@ RTPPacketHistory::~RTPPacketHistory() {
delete critsect_; delete critsect_;
} }
void RTPPacketHistory::SetStorePacketsStatus(bool enable, void RTPPacketHistory::SetStorePacketsStatus(bool enable,
uint16_t number_to_store) { uint16_t number_to_store) {
if (enable) { if (enable) {
Allocate(number_to_store); Allocate(number_to_store);
@ -50,8 +50,11 @@ void RTPPacketHistory::Allocate(uint16_t number_to_store) {
assert(number_to_store > 0); assert(number_to_store > 0);
CriticalSectionScoped cs(critsect_); CriticalSectionScoped cs(critsect_);
if (store_) { if (store_) {
WEBRTC_TRACE(kTraceWarning, kTraceRtpRtcp, -1, if (number_to_store != stored_packets_.size()) {
"SetStorePacketsStatus already set, number: %d", number_to_store); WEBRTC_TRACE(kTraceWarning, kTraceRtpRtcp, -1,
"SetStorePacketsStatus already set, number: %d",
number_to_store);
}
return; return;
} }
@ -71,7 +74,7 @@ void RTPPacketHistory::Free() {
} }
std::vector<std::vector<uint8_t> >::iterator it; std::vector<std::vector<uint8_t> >::iterator it;
for (it = stored_packets_.begin(); it != stored_packets_.end(); ++it) { for (it = stored_packets_.begin(); it != stored_packets_.end(); ++it) {
it->clear(); it->clear();
} }
@ -207,7 +210,7 @@ bool RTPPacketHistory::HasRTPPacket(uint16_t sequence_number) const {
if (!found) { if (!found) {
return false; return false;
} }
uint16_t length = stored_lengths_.at(index); uint16_t length = stored_lengths_.at(index);
if (length == 0 || length > max_packet_length_) { if (length == 0 || length > max_packet_length_) {
// Invalid length. // Invalid length.
@ -243,16 +246,16 @@ bool RTPPacketHistory::GetPacketAndSetSendTime(uint16_t sequence_number,
} }
if (length > *packet_length) { if (length > *packet_length) {
WEBRTC_TRACE(kTraceWarning, kTraceRtpRtcp, -1, WEBRTC_TRACE(kTraceWarning, kTraceRtpRtcp, -1,
"Input buffer too short for packet %u", sequence_number); "Input buffer too short for packet %u", sequence_number);
return false; return false;
} }
// Verify elapsed time since last retrieve. // Verify elapsed time since last retrieve.
int64_t now = clock_->TimeInMilliseconds(); int64_t now = clock_->TimeInMilliseconds();
if (min_elapsed_time_ms > 0 && if (min_elapsed_time_ms > 0 &&
((now - stored_send_times_.at(index)) < min_elapsed_time_ms)) { ((now - stored_send_times_.at(index)) < min_elapsed_time_ms)) {
WEBRTC_TRACE(kTraceStream, kTraceRtpRtcp, -1, WEBRTC_TRACE(kTraceStream, kTraceRtpRtcp, -1,
"Skip getting packet %u, packet recently resent.", sequence_number); "Skip getting packet %u, packet recently resent.", sequence_number);
return false; return false;
} }