| 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 <memory> |
| 11 |
| 10 #include "base/macros.h" | 12 #include "base/macros.h" |
| 11 #include "base/memory/scoped_ptr.h" | |
| 12 #include "base/test/simple_test_tick_clock.h" | 13 #include "base/test/simple_test_tick_clock.h" |
| 13 #include "media/base/fake_single_thread_task_runner.h" | 14 #include "media/base/fake_single_thread_task_runner.h" |
| 14 #include "media/cast/net/pacing/paced_sender.h" | 15 #include "media/cast/net/pacing/paced_sender.h" |
| 15 #include "media/cast/net/rtp/packet_storage.h" | 16 #include "media/cast/net/rtp/packet_storage.h" |
| 16 #include "media/cast/net/rtp/rtp_parser.h" | 17 #include "media/cast/net/rtp/rtp_parser.h" |
| 17 #include "testing/gmock/include/gmock/gmock.h" | 18 #include "testing/gmock/include/gmock/gmock.h" |
| 18 | 19 |
| 19 namespace media { | 20 namespace media { |
| 20 namespace cast { | 21 namespace cast { |
| 21 | 22 |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 testing_clock_.Advance(base::TimeDelta::FromMilliseconds(1)); | 138 testing_clock_.Advance(base::TimeDelta::FromMilliseconds(1)); |
| 138 task_runner_->RunTasks(); | 139 task_runner_->RunTasks(); |
| 139 } | 140 } |
| 140 } | 141 } |
| 141 | 142 |
| 142 base::SimpleTestTickClock testing_clock_; | 143 base::SimpleTestTickClock testing_clock_; |
| 143 scoped_refptr<FakeSingleThreadTaskRunner> task_runner_; | 144 scoped_refptr<FakeSingleThreadTaskRunner> task_runner_; |
| 144 EncodedFrame video_frame_; | 145 EncodedFrame video_frame_; |
| 145 PacketStorage packet_storage_; | 146 PacketStorage packet_storage_; |
| 146 RtpPacketizerConfig config_; | 147 RtpPacketizerConfig config_; |
| 147 scoped_ptr<TestRtpPacketTransport> transport_; | 148 std::unique_ptr<TestRtpPacketTransport> transport_; |
| 148 scoped_ptr<PacedSender> pacer_; | 149 std::unique_ptr<PacedSender> pacer_; |
| 149 scoped_ptr<RtpPacketizer> rtp_packetizer_; | 150 std::unique_ptr<RtpPacketizer> rtp_packetizer_; |
| 150 | 151 |
| 151 private: | 152 private: |
| 152 DISALLOW_COPY_AND_ASSIGN(RtpPacketizerTest); | 153 DISALLOW_COPY_AND_ASSIGN(RtpPacketizerTest); |
| 153 }; | 154 }; |
| 154 | 155 |
| 155 TEST_F(RtpPacketizerTest, SendStandardPackets) { | 156 TEST_F(RtpPacketizerTest, SendStandardPackets) { |
| 156 size_t expected_num_of_packets = kFrameSize / kMaxPacketLength + 1; | 157 size_t expected_num_of_packets = kFrameSize / kMaxPacketLength + 1; |
| 157 transport_->set_expected_number_of_packets(expected_num_of_packets); | 158 transport_->set_expected_number_of_packets(expected_num_of_packets); |
| 158 transport_->set_rtp_timestamp(video_frame_.rtp_timestamp); | 159 transport_->set_rtp_timestamp(video_frame_.rtp_timestamp); |
| 159 | 160 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 189 video_frame_.reference_time = testing_clock_.NowTicks(); | 190 video_frame_.reference_time = testing_clock_.NowTicks(); |
| 190 rtp_packetizer_->SendFrameAsPackets(video_frame_); | 191 rtp_packetizer_->SendFrameAsPackets(video_frame_); |
| 191 RunTasks(33 + 1); | 192 RunTasks(33 + 1); |
| 192 EXPECT_EQ(expected_num_of_packets, rtp_packetizer_->send_packet_count()); | 193 EXPECT_EQ(expected_num_of_packets, rtp_packetizer_->send_packet_count()); |
| 193 EXPECT_EQ(kFrameSize, rtp_packetizer_->send_octet_count()); | 194 EXPECT_EQ(kFrameSize, rtp_packetizer_->send_octet_count()); |
| 194 EXPECT_EQ(expected_num_of_packets, transport_->number_of_packets_received()); | 195 EXPECT_EQ(expected_num_of_packets, transport_->number_of_packets_received()); |
| 195 } | 196 } |
| 196 | 197 |
| 197 } // namespace cast | 198 } // namespace cast |
| 198 } // namespace media | 199 } // namespace media |
| OLD | NEW |