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

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: fixing Created 3 years, 8 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 19b98a69f391464d33dbbeb2f07c8c0160a2d996..f969277e88b28a7e44e88cbd02e0d306034526cd 100644
--- a/webrtc/modules/rtp_rtcp/source/rtp_packet_history.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtp_packet_history.cc
@@ -162,11 +162,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);
@@ -200,7 +201,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();
@@ -208,7 +210,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