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

Side by Side Diff: webrtc/modules/rtp_rtcp/test/testAPI/test_api.cc

Issue 1924443002: Revert of 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) 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/rtp_rtcp/test/testAPI/test_api.h" 11 #include "webrtc/modules/rtp_rtcp/test/testAPI/test_api.h"
12 12
13 #include <algorithm> 13 #include <algorithm>
14 #include <memory>
15 #include <vector> 14 #include <vector>
16 15
17 #include "webrtc/test/null_transport.h" 16 #include "webrtc/test/null_transport.h"
18 17
19 namespace webrtc { 18 namespace webrtc {
20 19
21 void LoopBackTransport::SetSendModule(RtpRtcp* rtp_rtcp_module, 20 void LoopBackTransport::SetSendModule(RtpRtcp* rtp_rtcp_module,
22 RTPPayloadRegistry* payload_registry, 21 RTPPayloadRegistry* payload_registry,
23 RtpReceiver* receiver, 22 RtpReceiver* receiver,
24 ReceiveStatistics* receive_statistics) { 23 ReceiveStatistics* receive_statistics) {
(...skipping 10 matching lines...) Expand all
35 bool LoopBackTransport::SendRtp(const uint8_t* data, 34 bool LoopBackTransport::SendRtp(const uint8_t* data,
36 size_t len, 35 size_t len,
37 const PacketOptions& options) { 36 const PacketOptions& options) {
38 count_++; 37 count_++;
39 if (packet_loss_ > 0) { 38 if (packet_loss_ > 0) {
40 if ((count_ % packet_loss_) == 0) { 39 if ((count_ % packet_loss_) == 0) {
41 return true; 40 return true;
42 } 41 }
43 } 42 }
44 RTPHeader header; 43 RTPHeader header;
45 std::unique_ptr<RtpHeaderParser> parser(RtpHeaderParser::Create()); 44 rtc::scoped_ptr<RtpHeaderParser> parser(RtpHeaderParser::Create());
46 if (!parser->Parse(static_cast<const uint8_t*>(data), len, &header)) { 45 if (!parser->Parse(static_cast<const uint8_t*>(data), len, &header)) {
47 return false; 46 return false;
48 } 47 }
49 PayloadUnion payload_specific; 48 PayloadUnion payload_specific;
50 if (!rtp_payload_registry_->GetPayloadSpecifics(header.payloadType, 49 if (!rtp_payload_registry_->GetPayloadSpecifics(header.payloadType,
51 &payload_specific)) { 50 &payload_specific)) {
52 return false; 51 return false;
53 } 52 }
54 receive_statistics_->IncomingPacket(header, len, false); 53 receive_statistics_->IncomingPacket(header, len, false);
55 if (!rtp_receiver_->IncomingRtpPacket(header, 54 if (!rtp_receiver_->IncomingRtpPacket(header,
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 configuration.audio = true; 93 configuration.audio = true;
95 configuration.clock = &fake_clock_; 94 configuration.clock = &fake_clock_;
96 configuration.outgoing_transport = &null_transport_; 95 configuration.outgoing_transport = &null_transport_;
97 module_.reset(RtpRtcp::CreateRtpRtcp(configuration)); 96 module_.reset(RtpRtcp::CreateRtpRtcp(configuration));
98 rtp_payload_registry_.reset(new RTPPayloadRegistry( 97 rtp_payload_registry_.reset(new RTPPayloadRegistry(
99 RTPPayloadStrategy::CreateStrategy(true))); 98 RTPPayloadStrategy::CreateStrategy(true)));
100 rtp_receiver_.reset(RtpReceiver::CreateAudioReceiver( 99 rtp_receiver_.reset(RtpReceiver::CreateAudioReceiver(
101 &fake_clock_, NULL, NULL, rtp_payload_registry_.get())); 100 &fake_clock_, NULL, NULL, rtp_payload_registry_.get()));
102 } 101 }
103 102
104 std::unique_ptr<RTPPayloadRegistry> rtp_payload_registry_; 103 rtc::scoped_ptr<RTPPayloadRegistry> rtp_payload_registry_;
105 std::unique_ptr<RtpReceiver> rtp_receiver_; 104 rtc::scoped_ptr<RtpReceiver> rtp_receiver_;
106 std::unique_ptr<RtpRtcp> module_; 105 rtc::scoped_ptr<RtpRtcp> module_;
107 uint32_t test_ssrc_; 106 uint32_t test_ssrc_;
108 uint32_t test_timestamp_; 107 uint32_t test_timestamp_;
109 uint16_t test_sequence_number_; 108 uint16_t test_sequence_number_;
110 std::vector<uint32_t> test_csrcs_; 109 std::vector<uint32_t> test_csrcs_;
111 SimulatedClock fake_clock_; 110 SimulatedClock fake_clock_;
112 test::NullTransport null_transport_; 111 test::NullTransport null_transport_;
113 }; 112 };
114 113
115 TEST_F(RtpRtcpAPITest, Basic) { 114 TEST_F(RtpRtcpAPITest, Basic) {
116 module_->SetSequenceNumber(test_sequence_number_); 115 module_->SetSequenceNumber(test_sequence_number_);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 rtx_header.payloadType = kRtxPayloadType; 181 rtx_header.payloadType = kRtxPayloadType;
183 EXPECT_TRUE(rtp_payload_registry_->IsRtx(rtx_header)); 182 EXPECT_TRUE(rtp_payload_registry_->IsRtx(rtx_header));
184 rtx_header.ssrc = 0; 183 rtx_header.ssrc = 0;
185 EXPECT_FALSE(rtp_payload_registry_->IsRtx(rtx_header)); 184 EXPECT_FALSE(rtp_payload_registry_->IsRtx(rtx_header));
186 rtx_header.ssrc = kRtxSsrc; 185 rtx_header.ssrc = kRtxSsrc;
187 rtx_header.payloadType = 0; 186 rtx_header.payloadType = 0;
188 EXPECT_TRUE(rtp_payload_registry_->IsRtx(rtx_header)); 187 EXPECT_TRUE(rtp_payload_registry_->IsRtx(rtx_header));
189 } 188 }
190 189
191 } // namespace webrtc 190 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/test/testAPI/test_api.h ('k') | webrtc/modules/rtp_rtcp/test/testAPI/test_api_audio.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698