in RtpPacketizers separate case 'frame fits into single packet'.

Assumption extra needed bytes for single packet needs is sum
of extra bytes for first and last packet
moved up to RTPSenderVideo from individual packetizers.
There it can be fixed.

Bug: webrtc:9868
Change-Id: I24c80ffa5c174afd3fe3e92fa86ef75560bb961e
Reviewed-on: https://webrtc-review.googlesource.com/c/105662
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25160}
This commit is contained in:
Danil Chapovalov
2018-10-12 17:51:22 +02:00
committed by Commit Bot
parent 1a35fbd9c3
commit fcebe0e1ca
7 changed files with 80 additions and 32 deletions

View File

@ -63,6 +63,11 @@ std::vector<int> RtpPacketizer::SplitAboutEqually(
RTC_DCHECK_GE(limits.last_packet_reduction_len, 0);
std::vector<int> result;
if (limits.max_payload_len >=
limits.single_packet_reduction_len + payload_len) {
result.push_back(payload_len);
return result;
}
if (limits.max_payload_len - limits.first_packet_reduction_len < 1 ||
limits.max_payload_len - limits.last_packet_reduction_len < 1) {
// Capacity is not enough to put a single byte into one of the packets.
@ -77,6 +82,10 @@ std::vector<int> RtpPacketizer::SplitAboutEqually(
// Integer divisions with rounding up.
int num_packets_left =
(total_bytes + limits.max_payload_len - 1) / limits.max_payload_len;
if (num_packets_left == 1) {
// Single packet is a special case handled above.
num_packets_left = 2;
}
if (payload_len < num_packets_left) {
// Edge case where limits force to have more packets than there are payload