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

Side by Side Diff: webrtc/call/rtc_event_log_unittest.cc

Issue 2348623003: Unify rtcp packet setters (Closed)
Patch Set: +call/rtc_event_log_unittest Created 4 years, 2 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
« no previous file with comments | « no previous file | webrtc/modules/pacing/packet_router.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 size_t payload_size = packet_size - rtp_packet.headers_size(); 132 size_t payload_size = packet_size - rtp_packet.headers_size();
133 uint8_t* payload = rtp_packet.AllocatePayload(payload_size); 133 uint8_t* payload = rtp_packet.AllocatePayload(payload_size);
134 for (size_t i = 0; i < payload_size; i++) { 134 for (size_t i = 0; i < payload_size; i++) {
135 payload[i] = prng->Rand<uint8_t>(); 135 payload[i] = prng->Rand<uint8_t>();
136 } 136 }
137 return rtp_packet; 137 return rtp_packet;
138 } 138 }
139 139
140 rtc::Buffer GenerateRtcpPacket(Random* prng) { 140 rtc::Buffer GenerateRtcpPacket(Random* prng) {
141 rtcp::ReportBlock report_block; 141 rtcp::ReportBlock report_block;
142 report_block.To(prng->Rand<uint32_t>()); // Remote SSRC. 142 report_block.SetMediaSsrc(prng->Rand<uint32_t>()); // Remote SSRC.
143 report_block.WithFractionLost(prng->Rand(50)); 143 report_block.SetFractionLost(prng->Rand(50));
144 144
145 rtcp::SenderReport sender_report; 145 rtcp::SenderReport sender_report;
146 sender_report.From(prng->Rand<uint32_t>()); // Sender SSRC. 146 sender_report.SetSenderSsrc(prng->Rand<uint32_t>());
147 sender_report.WithNtp( 147 sender_report.SetNtp(NtpTime(prng->Rand<uint32_t>(), prng->Rand<uint32_t>()));
148 NtpTime(prng->Rand<uint32_t>(), prng->Rand<uint32_t>())); 148 sender_report.SetPacketCount(prng->Rand<uint32_t>());
149 sender_report.WithPacketCount(prng->Rand<uint32_t>()); 149 sender_report.AddReportBlock(report_block);
150 sender_report.WithReportBlock(report_block);
151 150
152 return sender_report.Build(); 151 return sender_report.Build();
153 } 152 }
154 153
155 void GenerateVideoReceiveConfig(uint32_t extensions_bitvector, 154 void GenerateVideoReceiveConfig(uint32_t extensions_bitvector,
156 VideoReceiveStream::Config* config, 155 VideoReceiveStream::Config* config,
157 Random* prng) { 156 Random* prng) {
158 // Create a map from a payload type to an encoder name. 157 // Create a map from a payload type to an encoder name.
159 VideoReceiveStream::Decoder decoder; 158 VideoReceiveStream::Decoder decoder;
160 decoder.payload_type = prng->Rand(0, 127); 159 decoder.payload_type = prng->Rand(0, 127);
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 MediaType::VIDEO, rtcp_packet.data(), 451 MediaType::VIDEO, rtcp_packet.data(),
453 rtcp_packet.size()); 452 rtcp_packet.size());
454 453
455 RtcEventLogTestHelper::VerifyLogEndEvent(parsed_log, 3); 454 RtcEventLogTestHelper::VerifyLogEndEvent(parsed_log, 3);
456 455
457 // Clean up temporary file - can be pretty slow. 456 // Clean up temporary file - can be pretty slow.
458 remove(temp_filename.c_str()); 457 remove(temp_filename.c_str());
459 } 458 }
460 459
461 } // namespace webrtc 460 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/pacing/packet_router.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698