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 // Test helper class that builds rtp packets. | 5 // Test helper class that builds rtp packets. |
6 | 6 |
7 #ifndef MEDIA_CAST_RTP_RECEIVER_RTP_PARSER_TEST_RTP_PACKET_BUILDER_H_ | 7 #ifndef MEDIA_CAST_RTP_RECEIVER_RTP_PARSER_TEST_RTP_PACKET_BUILDER_H_ |
8 #define MEDIA_CAST_RTP_RECEIVER_RTP_PARSER_TEST_RTP_PACKET_BUILDER_H_ | 8 #define MEDIA_CAST_RTP_RECEIVER_RTP_PARSER_TEST_RTP_PACKET_BUILDER_H_ |
9 | 9 |
10 #include "media/cast/rtp_receiver/rtp_receiver_defines.h" | 10 #include "media/cast/rtp_receiver/rtp_receiver_defines.h" |
11 | 11 |
12 namespace media { | 12 namespace media { |
13 namespace cast { | 13 namespace cast { |
14 | 14 |
| 15 // TODO(miu): Consolidate with RtpPacketizer as a single Cast packet |
| 16 // serialization implementation. |
15 class RtpPacketBuilder { | 17 class RtpPacketBuilder { |
16 public: | 18 public: |
17 RtpPacketBuilder(); | 19 RtpPacketBuilder(); |
18 void SetKeyFrame(bool is_key); | 20 void SetKeyFrame(bool is_key); |
19 void SetFrameId(uint32 frame_id); | 21 void SetFrameIds(uint32 frame_id, uint32 reference_frame_id); |
20 void SetPacketId(uint16 packet_id); | 22 void SetPacketId(uint16 packet_id); |
21 void SetMaxPacketId(uint16 max_packet_id); | 23 void SetMaxPacketId(uint16 max_packet_id); |
22 void SetReferenceFrameId(uint32 reference_frame_id, bool is_set); | |
23 void SetTimestamp(uint32 timestamp); | 24 void SetTimestamp(uint32 timestamp); |
24 void SetSequenceNumber(uint16 sequence_number); | 25 void SetSequenceNumber(uint16 sequence_number); |
25 void SetMarkerBit(bool marker); | 26 void SetMarkerBit(bool marker); |
26 void SetPayloadType(int payload_type); | 27 void SetPayloadType(int payload_type); |
27 void SetSsrc(uint32 ssrc); | 28 void SetSsrc(uint32 ssrc); |
28 void BuildHeader(uint8* data, uint32 data_length); | 29 void BuildHeader(uint8* data, uint32 data_length); |
29 | 30 |
30 private: | 31 private: |
31 bool is_key_; | 32 bool is_key_; |
32 uint32 frame_id_; | 33 uint32 frame_id_; |
33 uint16 packet_id_; | 34 uint16 packet_id_; |
34 uint16 max_packet_id_; | 35 uint16 max_packet_id_; |
35 uint32 reference_frame_id_; | 36 uint32 reference_frame_id_; |
36 bool is_reference_set_; | |
37 uint32 timestamp_; | 37 uint32 timestamp_; |
38 uint16 sequence_number_; | 38 uint16 sequence_number_; |
39 bool marker_; | 39 bool marker_; |
40 int payload_type_; | 40 int payload_type_; |
41 uint32 ssrc_; | 41 uint32 ssrc_; |
42 | 42 |
43 void BuildCastHeader(uint8* data, uint32 data_length); | 43 void BuildCastHeader(uint8* data, uint32 data_length); |
44 void BuildCommonHeader(uint8* data, uint32 data_length); | 44 void BuildCommonHeader(uint8* data, uint32 data_length); |
45 | 45 |
46 DISALLOW_COPY_AND_ASSIGN(RtpPacketBuilder); | 46 DISALLOW_COPY_AND_ASSIGN(RtpPacketBuilder); |
47 }; | 47 }; |
48 | 48 |
49 } // namespace cast | 49 } // namespace cast |
50 } // namespace media | 50 } // namespace media |
51 | 51 |
52 #endif // MEDIA_CAST_RTP_RECEIVER_RTP_PARSER_TEST_RTP_PACKET_BUILDER_H_ | 52 #endif // MEDIA_CAST_RTP_RECEIVER_RTP_PARSER_TEST_RTP_PACKET_BUILDER_H_ |
OLD | NEW |