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

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

Issue 2885823002: Delete class NullRtpData and function NullObjectRtpData (Closed)
Patch Set: Delete a left-over inherit of NullRtpData. Created 3 years, 6 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) 2017 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2017 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 28 matching lines...) Expand all
39 } 39 }
40 40
41 } // namespace 41 } // namespace
42 42
43 class RtpReceiverTest : public ::testing::Test { 43 class RtpReceiverTest : public ::testing::Test {
44 protected: 44 protected:
45 RtpReceiverTest() 45 RtpReceiverTest()
46 : fake_clock_(123456), 46 : fake_clock_(123456),
47 rtp_receiver_( 47 rtp_receiver_(
48 RtpReceiver::CreateAudioReceiver(&fake_clock_, 48 RtpReceiver::CreateAudioReceiver(&fake_clock_,
49 nullptr, 49 &null_rtp_data_,
50 nullptr, 50 nullptr,
51 &rtp_payload_registry_)) { 51 &rtp_payload_registry_)) {
52 CodecInst voice_codec = {}; 52 CodecInst voice_codec = {};
53 voice_codec.pltype = kPcmuPayloadType; 53 voice_codec.pltype = kPcmuPayloadType;
54 voice_codec.plfreq = 8000; 54 voice_codec.plfreq = 8000;
55 voice_codec.rate = kTestRate; 55 voice_codec.rate = kTestRate;
56 memcpy(voice_codec.plname, "PCMU", 5); 56 memcpy(voice_codec.plname, "PCMU", 5);
57 rtp_receiver_->RegisterReceivePayload(voice_codec); 57 rtp_receiver_->RegisterReceivePayload(voice_codec);
58 } 58 }
59 ~RtpReceiverTest() {} 59 ~RtpReceiverTest() {}
60 60
61 bool FindSourceByIdAndType(const std::vector<RtpSource>& sources, 61 bool FindSourceByIdAndType(const std::vector<RtpSource>& sources,
62 uint32_t source_id, 62 uint32_t source_id,
63 RtpSourceType type, 63 RtpSourceType type,
64 RtpSource* source) { 64 RtpSource* source) {
65 for (size_t i = 0; i < sources.size(); ++i) { 65 for (size_t i = 0; i < sources.size(); ++i) {
66 if (sources[i].source_id() == source_id && 66 if (sources[i].source_id() == source_id &&
67 sources[i].source_type() == type) { 67 sources[i].source_type() == type) {
68 (*source) = sources[i]; 68 (*source) = sources[i];
69 return true; 69 return true;
70 } 70 }
71 } 71 }
72 return false; 72 return false;
73 } 73 }
74 74
75 SimulatedClock fake_clock_; 75 SimulatedClock fake_clock_;
76 NullRtpData null_rtp_data_;
76 RTPPayloadRegistry rtp_payload_registry_; 77 RTPPayloadRegistry rtp_payload_registry_;
77 std::unique_ptr<RtpReceiver> rtp_receiver_; 78 std::unique_ptr<RtpReceiver> rtp_receiver_;
78 }; 79 };
79 80
80 TEST_F(RtpReceiverTest, GetSources) { 81 TEST_F(RtpReceiverTest, GetSources) {
81 int64_t now_ms = fake_clock_.TimeInMilliseconds(); 82 int64_t now_ms = fake_clock_.TimeInMilliseconds();
82 83
83 RTPHeader header; 84 RTPHeader header;
84 header.payloadType = kPcmuPayloadType; 85 header.payloadType = kPcmuPayloadType;
85 header.ssrc = kSsrc1; 86 header.ssrc = kSsrc1;
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 247
247 auto csrc_sources = rtp_receiver_impl->csrc_sources_for_testing(); 248 auto csrc_sources = rtp_receiver_impl->csrc_sources_for_testing();
248 ASSERT_EQ(1u, csrc_sources.size()); 249 ASSERT_EQ(1u, csrc_sources.size());
249 EXPECT_EQ(kCsrc1, csrc_sources.begin()->source_id()); 250 EXPECT_EQ(kCsrc1, csrc_sources.begin()->source_id());
250 EXPECT_EQ(RtpSourceType::CSRC, csrc_sources.begin()->source_type()); 251 EXPECT_EQ(RtpSourceType::CSRC, csrc_sources.begin()->source_type());
251 EXPECT_EQ(fake_clock_.TimeInMilliseconds(), 252 EXPECT_EQ(fake_clock_.TimeInMilliseconds(),
252 csrc_sources.begin()->timestamp_ms()); 253 csrc_sources.begin()->timestamp_ms());
253 } 254 }
254 255
255 } // namespace webrtc 256 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698