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

Side by Side Diff: webrtc/modules/video_coding/test/rtp_player.cc

Issue 1942823002: Remove webrtc/base/scoped_ptr.h (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: fix additional scoped_ptr uses that had been added Created 4 years, 7 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
11 #include "webrtc/modules/video_coding/test/rtp_player.h" 11 #include "webrtc/modules/video_coding/test/rtp_player.h"
12 12
13 #include <stdio.h> 13 #include <stdio.h>
14 14
15 #include <cstdlib>
15 #include <map> 16 #include <map>
16 #include <memory> 17 #include <memory>
17 18
18 #include "webrtc/base/constructormagic.h" 19 #include "webrtc/base/constructormagic.h"
19 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" 20 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h"
20 #include "webrtc/modules/rtp_rtcp/include/rtp_payload_registry.h" 21 #include "webrtc/modules/rtp_rtcp/include/rtp_payload_registry.h"
21 #include "webrtc/modules/rtp_rtcp/include/rtp_receiver.h" 22 #include "webrtc/modules/rtp_rtcp/include/rtp_receiver.h"
22 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" 23 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h"
23 #include "webrtc/modules/video_coding/internal_defines.h" 24 #include "webrtc/modules/video_coding/internal_defines.h"
24 #include "webrtc/modules/video_coding/test/test_util.h" 25 #include "webrtc/modules/video_coding/test/test_util.h"
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 lost_packets_(clock, rtt_ms), 336 lost_packets_(clock, rtt_ms),
336 resend_packet_count_(0), 337 resend_packet_count_(0),
337 no_loss_startup_(100), 338 no_loss_startup_(100),
338 end_of_file_(false), 339 end_of_file_(false),
339 reordering_(false), 340 reordering_(false),
340 reorder_buffer_() { 341 reorder_buffer_() {
341 assert(clock); 342 assert(clock);
342 assert(packet_source); 343 assert(packet_source);
343 assert(packet_source->get()); 344 assert(packet_source->get());
344 packet_source_.swap(*packet_source); 345 packet_source_.swap(*packet_source);
345 srand(321); 346 std::srand(321);
346 } 347 }
347 348
348 virtual ~RtpPlayerImpl() {} 349 virtual ~RtpPlayerImpl() {}
349 350
350 virtual int NextPacket(int64_t time_now) { 351 virtual int NextPacket(int64_t time_now) {
351 // Send any packets ready to be resent. 352 // Send any packets ready to be resent.
352 for (RawRtpPacket* packet = lost_packets_.NextPacketToResend(time_now); 353 for (RawRtpPacket* packet = lost_packets_.NextPacketToResend(time_now);
353 packet != NULL; packet = lost_packets_.NextPacketToResend(time_now)) { 354 packet != NULL; packet = lost_packets_.NextPacketToResend(time_now)) {
354 int ret = SendPacket(packet->data(), packet->length()); 355 int ret = SendPacket(packet->data(), packet->length());
355 if (ret > 0) { 356 if (ret > 0) {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 return -1; 429 return -1;
429 } 430 }
430 uint32_t ssrc = header.ssrc; 431 uint32_t ssrc = header.ssrc;
431 if (ssrc_handlers_.RegisterSsrc(ssrc, &lost_packets_, clock_) < 0) { 432 if (ssrc_handlers_.RegisterSsrc(ssrc, &lost_packets_, clock_) < 0) {
432 DEBUG_LOG1("Unable to register ssrc: %d", ssrc); 433 DEBUG_LOG1("Unable to register ssrc: %d", ssrc);
433 return -1; 434 return -1;
434 } 435 }
435 436
436 if (no_loss_startup_ > 0) { 437 if (no_loss_startup_ > 0) {
437 no_loss_startup_--; 438 no_loss_startup_--;
438 } else if ((rand() + 1.0) / (RAND_MAX + 1.0) < loss_rate_) { // NOLINT 439 } else if ((std::rand() + 1.0) / (RAND_MAX + 1.0) <
440 loss_rate_) { // NOLINT
439 uint16_t seq_num = header.sequenceNumber; 441 uint16_t seq_num = header.sequenceNumber;
440 lost_packets_.AddPacket(new RawRtpPacket(data, length, ssrc, seq_num)); 442 lost_packets_.AddPacket(new RawRtpPacket(data, length, ssrc, seq_num));
441 DEBUG_LOG1("Dropped packet: %d!", header.header.sequenceNumber); 443 DEBUG_LOG1("Dropped packet: %d!", header.header.sequenceNumber);
442 return 0; 444 return 0;
443 } 445 }
444 } 446 }
445 447
446 ssrc_handlers_.IncomingPacket(data, length); 448 ssrc_handlers_.IncomingPacket(data, length);
447 return 1; 449 return 1;
448 } 450 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 } 486 }
485 } 487 }
486 488
487 std::unique_ptr<RtpPlayerImpl> impl( 489 std::unique_ptr<RtpPlayerImpl> impl(
488 new RtpPlayerImpl(payload_sink_factory, payload_types, clock, 490 new RtpPlayerImpl(payload_sink_factory, payload_types, clock,
489 &packet_source, loss_rate, rtt_ms, reordering)); 491 &packet_source, loss_rate, rtt_ms, reordering));
490 return impl.release(); 492 return impl.release();
491 } 493 }
492 } // namespace rtpplayer 494 } // namespace rtpplayer
493 } // namespace webrtc 495 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/video_coding/packet_buffer.h ('k') | webrtc/modules/video_processing/util/noise_estimation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698