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

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtp_fec_unittest.cc

Issue 2275443002: Minor fixes in FEC and RtpSender{,Video}. (pt. 2) (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@header_reader_writer-pt1-move_copy_column
Patch Set: Rebase. Created 4 years, 3 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 RTC_DCHECK_GT(num_media_packets, 0); 869 RTC_DCHECK_GT(num_media_packets, 0);
870 int sequence_number = start_seq_num; 870 int sequence_number = start_seq_num;
871 int time_stamp = random_.Rand<int>(); 871 int time_stamp = random_.Rand<int>();
872 872
873 for (int i = 0; i < num_media_packets; ++i) { 873 for (int i = 0; i < num_media_packets; ++i) {
874 std::unique_ptr<ForwardErrorCorrection::Packet> media_packet( 874 std::unique_ptr<ForwardErrorCorrection::Packet> media_packet(
875 new ForwardErrorCorrection::Packet()); 875 new ForwardErrorCorrection::Packet());
876 constexpr uint32_t kMinPacketSize = kRtpHeaderSize; 876 constexpr uint32_t kMinPacketSize = kRtpHeaderSize;
877 const uint32_t kMaxPacketSize = IP_PACKET_SIZE - kRtpHeaderSize - 877 const uint32_t kMaxPacketSize = IP_PACKET_SIZE - kRtpHeaderSize -
878 kTransportOverhead - 878 kTransportOverhead -
879 ForwardErrorCorrection::PacketOverhead(); 879 fec_.MaxPacketOverhead();
880 media_packet->length = random_.Rand(kMinPacketSize, kMaxPacketSize); 880 media_packet->length = random_.Rand(kMinPacketSize, kMaxPacketSize);
881 881
882 // Generate random values for the first 2 bytes 882 // Generate random values for the first 2 bytes
883 media_packet->data[0] = random_.Rand<uint8_t>(); 883 media_packet->data[0] = random_.Rand<uint8_t>();
884 media_packet->data[1] = random_.Rand<uint8_t>(); 884 media_packet->data[1] = random_.Rand<uint8_t>();
885 885
886 // The first two bits are assumed to be 10 by the FEC encoder. 886 // The first two bits are assumed to be 10 by the FEC encoder.
887 // In fact the FEC decoder will set the two first bits to 10 regardless of 887 // In fact the FEC decoder will set the two first bits to 10 regardless of
888 // what they actually were. Set the first two bits to 10 so that a memcmp 888 // what they actually were. Set the first two bits to 10 so that a memcmp
889 // can be performed for the whole restored packet. 889 // can be performed for the whole restored packet.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
925 PacketList* dst) { 925 PacketList* dst) {
926 RTC_DCHECK_GT(n, 0); 926 RTC_DCHECK_GT(n, 0);
927 int i = 0; 927 int i = 0;
928 for (const auto& packet : src) { 928 for (const auto& packet : src) {
929 if (i % n == 0) { 929 if (i % n == 0) {
930 dst->emplace_back(new ForwardErrorCorrection::Packet(*packet)); 930 dst->emplace_back(new ForwardErrorCorrection::Packet(*packet));
931 } 931 }
932 ++i; 932 ++i;
933 } 933 }
934 } 934 }
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/producer_fec_unittest.cc ('k') | webrtc/modules/rtp_rtcp/source/rtp_sender.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698