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

Unified Diff: webrtc/modules/rtp_rtcp/source/rtp_packet_history.cc

Issue 2766323006: Correcting the amount of padding when send side bwe includes RTP overhead.
Patch Set: update Created 3 years, 9 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/rtp_rtcp/source/rtp_packet_history.cc
diff --git a/webrtc/modules/rtp_rtcp/source/rtp_packet_history.cc b/webrtc/modules/rtp_rtcp/source/rtp_packet_history.cc
index c4edc732b8fceb61b16c5323463e672f11593d17..4e708fa6264ef0672dd22999e195ed2ce74b1baa 100644
--- a/webrtc/modules/rtp_rtcp/source/rtp_packet_history.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtp_packet_history.cc
@@ -161,11 +161,12 @@ std::unique_ptr<RtpPacketToSend> RtpPacketHistory::GetPacket(int index) const {
}
std::unique_ptr<RtpPacketToSend> RtpPacketHistory::GetBestFittingPacket(
- size_t packet_length) const {
+ size_t packet_length,
+ bool include_header) const {
rtc::CritScope cs(&critsect_);
if (!store_)
return nullptr;
- int index = FindBestFittingPacket(packet_length);
+ int index = FindBestFittingPacket(packet_length, include_header);
if (index < 0)
return nullptr;
return GetPacket(index);
@@ -199,7 +200,8 @@ bool RtpPacketHistory::FindSeqNum(uint16_t sequence_number, int* index) const {
stored_packets_[*index].packet;
}
-int RtpPacketHistory::FindBestFittingPacket(size_t size) const {
+int RtpPacketHistory::FindBestFittingPacket(size_t size,
+ bool include_header) const {
if (size < kMinPacketRequestBytes || stored_packets_.empty())
return -1;
size_t min_diff = std::numeric_limits<size_t>::max();
@@ -207,7 +209,10 @@ int RtpPacketHistory::FindBestFittingPacket(size_t size) const {
for (size_t i = 0; i < stored_packets_.size(); ++i) {
if (!stored_packets_[i].packet)
continue;
- size_t stored_size = stored_packets_[i].packet->size();
+ size_t stored_size = include_header
+ ? stored_packets_[i].packet->size()
+ : stored_packets_[i].packet->size() -
+ stored_packets_[i].packet->headers_size();
size_t diff =
(stored_size > size) ? (stored_size - size) : (size - stored_size);
if (diff < min_diff) {

Powered by Google App Engine
This is Rietveld 408576698