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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 uint32_t expected_frame_id_; | 101 uint32_t expected_frame_id_; |
102 uint32_t expected_rtp_timestamp_; | 102 uint32_t expected_rtp_timestamp_; |
103 | 103 |
104 private: | 104 private: |
105 DISALLOW_COPY_AND_ASSIGN(TestRtpPacketTransport); | 105 DISALLOW_COPY_AND_ASSIGN(TestRtpPacketTransport); |
106 }; | 106 }; |
107 | 107 |
108 class RtpPacketizerTest : public ::testing::Test { | 108 class RtpPacketizerTest : public ::testing::Test { |
109 protected: | 109 protected: |
110 RtpPacketizerTest() | 110 RtpPacketizerTest() |
111 : task_runner_(new test::FakeSingleThreadTaskRunner(&testing_clock_)) { | 111 : testing_clock_(base::TimeTicks()), |
| 112 task_runner_(new test::FakeSingleThreadTaskRunner(&testing_clock_)) { |
112 config_.sequence_number = kSeqNum; | 113 config_.sequence_number = kSeqNum; |
113 config_.ssrc = kSsrc; | 114 config_.ssrc = kSsrc; |
114 config_.payload_type = kPayload; | 115 config_.payload_type = kPayload; |
115 config_.max_payload_length = kMaxPacketLength; | 116 config_.max_payload_length = kMaxPacketLength; |
116 transport_.reset(new TestRtpPacketTransport(config_)); | 117 transport_.reset(new TestRtpPacketTransport(config_)); |
117 pacer_.reset(new PacedSender(kTargetBurstSize, kMaxBurstSize, | 118 pacer_.reset(new PacedSender(kTargetBurstSize, kMaxBurstSize, |
118 &testing_clock_, nullptr, transport_.get(), | 119 &testing_clock_, nullptr, transport_.get(), |
119 task_runner_)); | 120 task_runner_)); |
120 pacer_->RegisterVideoSsrc(config_.ssrc); | 121 pacer_->RegisterVideoSsrc(config_.ssrc); |
121 rtp_packetizer_.reset(new RtpPacketizer( | 122 rtp_packetizer_.reset(new RtpPacketizer( |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 video_frame_.reference_time = testing_clock_.NowTicks(); | 186 video_frame_.reference_time = testing_clock_.NowTicks(); |
186 rtp_packetizer_->SendFrameAsPackets(video_frame_); | 187 rtp_packetizer_->SendFrameAsPackets(video_frame_); |
187 RunTasks(33 + 1); | 188 RunTasks(33 + 1); |
188 EXPECT_EQ(expected_num_of_packets, rtp_packetizer_->send_packet_count()); | 189 EXPECT_EQ(expected_num_of_packets, rtp_packetizer_->send_packet_count()); |
189 EXPECT_EQ(kFrameSize, rtp_packetizer_->send_octet_count()); | 190 EXPECT_EQ(kFrameSize, rtp_packetizer_->send_octet_count()); |
190 EXPECT_EQ(expected_num_of_packets, transport_->number_of_packets_received()); | 191 EXPECT_EQ(expected_num_of_packets, transport_->number_of_packets_received()); |
191 } | 192 } |
192 | 193 |
193 } // namespace cast | 194 } // namespace cast |
194 } // namespace media | 195 } // namespace media |
OLD | NEW |