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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 EXPECT_FALSE(rtp_header.is_key_frame); | 56 EXPECT_FALSE(rtp_header.is_key_frame); |
57 EXPECT_EQ(expected_frame_id_, rtp_header.frame_id); | 57 EXPECT_EQ(expected_frame_id_, rtp_header.frame_id); |
58 EXPECT_EQ(expected_packet_id_, rtp_header.packet_id); | 58 EXPECT_EQ(expected_packet_id_, rtp_header.packet_id); |
59 EXPECT_EQ(expected_number_of_packets_ - 1, rtp_header.max_packet_id); | 59 EXPECT_EQ(expected_number_of_packets_ - 1, rtp_header.max_packet_id); |
60 EXPECT_TRUE(rtp_header.is_reference); | 60 EXPECT_TRUE(rtp_header.is_reference); |
61 EXPECT_EQ(expected_frame_id_ - 1u, rtp_header.reference_frame_id); | 61 EXPECT_EQ(expected_frame_id_ - 1u, rtp_header.reference_frame_id); |
62 } | 62 } |
63 | 63 |
64 virtual bool SendPacket(PacketRef packet, const base::Closure& cb) OVERRIDE { | 64 virtual bool SendPacket(PacketRef packet, const base::Closure& cb) OVERRIDE { |
65 ++packets_sent_; | 65 ++packets_sent_; |
66 RtpHeaderParser parser(packet->data.data(), packet->data.size()); | 66 RtpHeaderParser parser(&packet->data[0], packet->data.size()); |
67 RtpCastTestHeader rtp_header; | 67 RtpCastTestHeader rtp_header; |
68 parser.Parse(&rtp_header); | 68 parser.Parse(&rtp_header); |
69 VerifyRtpHeader(rtp_header); | 69 VerifyRtpHeader(rtp_header); |
70 ++sequence_number_; | 70 ++sequence_number_; |
71 ++expected_packet_id_; | 71 ++expected_packet_id_; |
72 return true; | 72 return true; |
73 } | 73 } |
74 | 74 |
75 size_t number_of_packets_received() const { return packets_sent_; } | 75 size_t number_of_packets_received() const { return packets_sent_; } |
76 | 76 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 video_frame_.reference_time = testing_clock_.NowTicks(); | 164 video_frame_.reference_time = testing_clock_.NowTicks(); |
165 rtp_packetizer_->SendFrameAsPackets(video_frame_); | 165 rtp_packetizer_->SendFrameAsPackets(video_frame_); |
166 RunTasks(33 + 1); | 166 RunTasks(33 + 1); |
167 EXPECT_EQ(expected_num_of_packets, rtp_packetizer_->send_packet_count()); | 167 EXPECT_EQ(expected_num_of_packets, rtp_packetizer_->send_packet_count()); |
168 EXPECT_EQ(kFrameSize, rtp_packetizer_->send_octet_count()); | 168 EXPECT_EQ(kFrameSize, rtp_packetizer_->send_octet_count()); |
169 EXPECT_EQ(expected_num_of_packets, transport_->number_of_packets_received()); | 169 EXPECT_EQ(expected_num_of_packets, transport_->number_of_packets_received()); |
170 } | 170 } |
171 | 171 |
172 } // namespace cast | 172 } // namespace cast |
173 } // namespace media | 173 } // namespace media |
OLD | NEW |