OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "media/cast/net/rtp/rtp_packetizer.h" | 5 #include "media/cast/net/rtp/rtp_packetizer.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/test/simple_test_tick_clock.h" | 10 #include "base/test/simple_test_tick_clock.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 int expected_packet_id_; | 95 int expected_packet_id_; |
96 uint32 expected_frame_id_; | 96 uint32 expected_frame_id_; |
97 uint32 expectd_rtp_timestamp_; | 97 uint32 expectd_rtp_timestamp_; |
98 | 98 |
99 DISALLOW_COPY_AND_ASSIGN(TestRtpPacketTransport); | 99 DISALLOW_COPY_AND_ASSIGN(TestRtpPacketTransport); |
100 }; | 100 }; |
101 | 101 |
102 class RtpPacketizerTest : public ::testing::Test { | 102 class RtpPacketizerTest : public ::testing::Test { |
103 protected: | 103 protected: |
104 RtpPacketizerTest() | 104 RtpPacketizerTest() |
105 : task_runner_(new test::FakeSingleThreadTaskRunner(&testing_clock_)), | 105 : task_runner_(new test::FakeSingleThreadTaskRunner(&testing_clock_)) { |
106 video_frame_(), | |
107 packet_storage_(200) { | |
108 config_.sequence_number = kSeqNum; | 106 config_.sequence_number = kSeqNum; |
109 config_.ssrc = kSsrc; | 107 config_.ssrc = kSsrc; |
110 config_.payload_type = kPayload; | 108 config_.payload_type = kPayload; |
111 config_.max_payload_length = kMaxPacketLength; | 109 config_.max_payload_length = kMaxPacketLength; |
112 transport_.reset(new TestRtpPacketTransport(config_)); | 110 transport_.reset(new TestRtpPacketTransport(config_)); |
113 pacer_.reset(new PacedSender(kTargetBurstSize, | 111 pacer_.reset(new PacedSender(kTargetBurstSize, |
114 kMaxBurstSize, | 112 kMaxBurstSize, |
115 &testing_clock_, | 113 &testing_clock_, |
116 &logging_, | 114 &logging_, |
117 transport_.get(), | 115 transport_.get(), |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 video_frame_.reference_time = testing_clock_.NowTicks(); | 170 video_frame_.reference_time = testing_clock_.NowTicks(); |
173 rtp_packetizer_->SendFrameAsPackets(video_frame_); | 171 rtp_packetizer_->SendFrameAsPackets(video_frame_); |
174 RunTasks(33 + 1); | 172 RunTasks(33 + 1); |
175 EXPECT_EQ(expected_num_of_packets, rtp_packetizer_->send_packet_count()); | 173 EXPECT_EQ(expected_num_of_packets, rtp_packetizer_->send_packet_count()); |
176 EXPECT_EQ(kFrameSize, rtp_packetizer_->send_octet_count()); | 174 EXPECT_EQ(kFrameSize, rtp_packetizer_->send_octet_count()); |
177 EXPECT_EQ(expected_num_of_packets, transport_->number_of_packets_received()); | 175 EXPECT_EQ(expected_num_of_packets, transport_->number_of_packets_received()); |
178 } | 176 } |
179 | 177 |
180 } // namespace cast | 178 } // namespace cast |
181 } // namespace media | 179 } // namespace media |
OLD | NEW |