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

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

Issue 1921233002: Replace the remaining scoped_ptr with unique_ptr in webrtc/modules/ (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: 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) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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 <map> 11 #include <map>
12 #include <memory>
12 #include <set> 13 #include <set>
13 14
14 #include "testing/gmock/include/gmock/gmock.h" 15 #include "testing/gmock/include/gmock/gmock.h"
15 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
16 17
17 #include "webrtc/common_types.h" 18 #include "webrtc/common_types.h"
18 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" 19 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h"
19 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" 20 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
20 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet.h" 21 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet.h"
21 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/nack.h" 22 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/nack.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 receiver_ = receiver; 62 receiver_ = receiver;
62 } 63 }
63 void SimulateNetworkDelay(int64_t delay_ms, SimulatedClock* clock) { 64 void SimulateNetworkDelay(int64_t delay_ms, SimulatedClock* clock) {
64 clock_ = clock; 65 clock_ = clock;
65 delay_ms_ = delay_ms; 66 delay_ms_ = delay_ms;
66 } 67 }
67 bool SendRtp(const uint8_t* data, 68 bool SendRtp(const uint8_t* data,
68 size_t len, 69 size_t len,
69 const PacketOptions& options) override { 70 const PacketOptions& options) override {
70 RTPHeader header; 71 RTPHeader header;
71 rtc::scoped_ptr<RtpHeaderParser> parser(RtpHeaderParser::Create()); 72 std::unique_ptr<RtpHeaderParser> parser(RtpHeaderParser::Create());
72 EXPECT_TRUE(parser->Parse(static_cast<const uint8_t*>(data), len, &header)); 73 EXPECT_TRUE(parser->Parse(static_cast<const uint8_t*>(data), len, &header));
73 ++rtp_packets_sent_; 74 ++rtp_packets_sent_;
74 last_rtp_header_ = header; 75 last_rtp_header_ = header;
75 return true; 76 return true;
76 } 77 }
77 bool SendRtcp(const uint8_t* data, size_t len) override { 78 bool SendRtcp(const uint8_t* data, size_t len) override {
78 test::RtcpPacketParser parser; 79 test::RtcpPacketParser parser;
79 parser.Parse(static_cast<const uint8_t*>(data), len); 80 parser.Parse(static_cast<const uint8_t*>(data), len);
80 last_nack_list_ = parser.nack_item()->last_nack_list(); 81 last_nack_list_ = parser.nack_item()->last_nack_list();
81 82
(...skipping 26 matching lines...) Expand all
108 config.rtt_stats = &rtt_stats_; 109 config.rtt_stats = &rtt_stats_;
109 110
110 impl_.reset(new ModuleRtpRtcpImpl(config)); 111 impl_.reset(new ModuleRtpRtcpImpl(config));
111 impl_->SetRTCPStatus(RtcpMode::kCompound); 112 impl_->SetRTCPStatus(RtcpMode::kCompound);
112 113
113 transport_.SimulateNetworkDelay(kOneWayNetworkDelayMs, clock); 114 transport_.SimulateNetworkDelay(kOneWayNetworkDelayMs, clock);
114 } 115 }
115 116
116 RtcpPacketTypeCounter packets_sent_; 117 RtcpPacketTypeCounter packets_sent_;
117 RtcpPacketTypeCounter packets_received_; 118 RtcpPacketTypeCounter packets_received_;
118 rtc::scoped_ptr<ReceiveStatistics> receive_statistics_; 119 std::unique_ptr<ReceiveStatistics> receive_statistics_;
119 SendTransport transport_; 120 SendTransport transport_;
120 RtcpRttStatsTestImpl rtt_stats_; 121 RtcpRttStatsTestImpl rtt_stats_;
121 rtc::scoped_ptr<ModuleRtpRtcpImpl> impl_; 122 std::unique_ptr<ModuleRtpRtcpImpl> impl_;
122 uint32_t remote_ssrc_; 123 uint32_t remote_ssrc_;
123 124
124 void SetRemoteSsrc(uint32_t ssrc) { 125 void SetRemoteSsrc(uint32_t ssrc) {
125 remote_ssrc_ = ssrc; 126 remote_ssrc_ = ssrc;
126 impl_->SetRemoteSSRC(ssrc); 127 impl_->SetRemoteSSRC(ssrc);
127 } 128 }
128 129
129 void RtcpPacketTypesCounterUpdated( 130 void RtcpPacketTypesCounterUpdated(
130 uint32_t ssrc, 131 uint32_t ssrc,
131 const RtcpPacketTypeCounter& packet_counter) override { 132 const RtcpPacketTypeCounter& packet_counter) override {
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 EXPECT_EQ(6U, receiver_.RtcpSent().unique_nack_requests); 543 EXPECT_EQ(6U, receiver_.RtcpSent().unique_nack_requests);
543 EXPECT_THAT(receiver_.LastNackListSent(), ElementsAre(11, 18, 20, 21)); 544 EXPECT_THAT(receiver_.LastNackListSent(), ElementsAre(11, 18, 20, 21));
544 545
545 // Send module receives the request. 546 // Send module receives the request.
546 EXPECT_EQ(2U, sender_.RtcpReceived().nack_packets); 547 EXPECT_EQ(2U, sender_.RtcpReceived().nack_packets);
547 EXPECT_EQ(8U, sender_.RtcpReceived().nack_requests); 548 EXPECT_EQ(8U, sender_.RtcpReceived().nack_requests);
548 EXPECT_EQ(6U, sender_.RtcpReceived().unique_nack_requests); 549 EXPECT_EQ(6U, sender_.RtcpReceived().unique_nack_requests);
549 EXPECT_EQ(75, sender_.RtcpReceived().UniqueNackRequestsInPercent()); 550 EXPECT_EQ(75, sender_.RtcpReceived().UniqueNackRequestsInPercent());
550 } 551 }
551 } // namespace webrtc 552 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_receiver_video.cc ('k') | webrtc/modules/rtp_rtcp/source/rtp_sender.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698