| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/transport/rtp_sender/rtp_packetizer/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" |
| 11 #include "media/cast/logging/logging_impl.h" |
| 11 #include "media/cast/logging/simple_event_subscriber.h" | 12 #include "media/cast/logging/simple_event_subscriber.h" |
| 13 #include "media/cast/net/pacing/paced_sender.h" |
| 14 #include "media/cast/net/rtp/packet_storage.h" |
| 15 #include "media/cast/net/rtp/rtp_header_parser.h" |
| 12 #include "media/cast/test/fake_single_thread_task_runner.h" | 16 #include "media/cast/test/fake_single_thread_task_runner.h" |
| 13 #include "media/cast/transport/pacing/paced_sender.h" | |
| 14 #include "media/cast/transport/rtp_sender/packet_storage/packet_storage.h" | |
| 15 #include "media/cast/transport/rtp_sender/rtp_packetizer/test/rtp_header_parser.
h" | |
| 16 #include "testing/gmock/include/gmock/gmock.h" | 17 #include "testing/gmock/include/gmock/gmock.h" |
| 17 | 18 |
| 18 namespace media { | 19 namespace media { |
| 19 namespace cast { | 20 namespace cast { |
| 20 namespace transport { | |
| 21 | 21 |
| 22 namespace { | 22 namespace { |
| 23 static const int kPayload = 127; | 23 static const int kPayload = 127; |
| 24 static const uint32 kTimestampMs = 10; | 24 static const uint32 kTimestampMs = 10; |
| 25 static const uint16 kSeqNum = 33; | 25 static const uint16 kSeqNum = 33; |
| 26 static const int kMaxPacketLength = 1500; | 26 static const int kMaxPacketLength = 1500; |
| 27 static const int kSsrc = 0x12345; | 27 static const int kSsrc = 0x12345; |
| 28 static const unsigned int kFrameSize = 5000; | 28 static const unsigned int kFrameSize = 5000; |
| 29 static const uint32 kStartFrameId = UINT32_C(0xffffffff); | |
| 30 } | 29 } |
| 31 | 30 |
| 32 class TestRtpPacketTransport : public PacketSender { | 31 class TestRtpPacketTransport : public PacketSender { |
| 33 public: | 32 public: |
| 34 explicit TestRtpPacketTransport(RtpPacketizerConfig config) | 33 explicit TestRtpPacketTransport(RtpPacketizerConfig config) |
| 35 : config_(config), | 34 : config_(config), |
| 36 sequence_number_(kSeqNum), | 35 sequence_number_(kSeqNum), |
| 37 packets_sent_(0), | 36 packets_sent_(0), |
| 38 expected_number_of_packets_(0), | 37 expected_number_of_packets_(0), |
| 39 expected_packet_id_(0), | 38 expected_packet_id_(0), |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 | 162 |
| 164 testing_clock_.Advance(base::TimeDelta::FromMilliseconds(kTimestampMs)); | 163 testing_clock_.Advance(base::TimeDelta::FromMilliseconds(kTimestampMs)); |
| 165 video_frame_.reference_time = testing_clock_.NowTicks(); | 164 video_frame_.reference_time = testing_clock_.NowTicks(); |
| 166 rtp_packetizer_->SendFrameAsPackets(video_frame_); | 165 rtp_packetizer_->SendFrameAsPackets(video_frame_); |
| 167 RunTasks(33 + 1); | 166 RunTasks(33 + 1); |
| 168 EXPECT_EQ(expected_num_of_packets, rtp_packetizer_->send_packet_count()); | 167 EXPECT_EQ(expected_num_of_packets, rtp_packetizer_->send_packet_count()); |
| 169 EXPECT_EQ(kFrameSize, rtp_packetizer_->send_octet_count()); | 168 EXPECT_EQ(kFrameSize, rtp_packetizer_->send_octet_count()); |
| 170 EXPECT_EQ(expected_num_of_packets, transport_->number_of_packets_received()); | 169 EXPECT_EQ(expected_num_of_packets, transport_->number_of_packets_received()); |
| 171 } | 170 } |
| 172 | 171 |
| 173 } // namespace transport | |
| 174 } // namespace cast | 172 } // namespace cast |
| 175 } // namespace media | 173 } // namespace media |
| OLD | NEW |