| 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) {
|
|
|