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 #ifndef MEDIA_CAST_TRANSPORT_RTP_SENDER_RTP_PACKETIZER_RTP_PACKETIZER_H_ | 5 #ifndef MEDIA_CAST_TRANSPORT_RTP_SENDER_RTP_PACKETIZER_RTP_PACKETIZER_H_ |
6 #define MEDIA_CAST_TRANSPORT_RTP_SENDER_RTP_PACKETIZER_RTP_PACKETIZER_H_ | 6 #define MEDIA_CAST_TRANSPORT_RTP_SENDER_RTP_PACKETIZER_RTP_PACKETIZER_H_ |
7 | 7 |
8 #include <cmath> | 8 #include <cmath> |
9 #include <list> | 9 #include <list> |
10 #include <map> | 10 #include <map> |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 // This class break encoded audio and video frames into packets and add an RTP | 49 // This class break encoded audio and video frames into packets and add an RTP |
50 // header to each packet. | 50 // header to each packet. |
51 class RtpPacketizer { | 51 class RtpPacketizer { |
52 public: | 52 public: |
53 RtpPacketizer(PacedSender* const transport, | 53 RtpPacketizer(PacedSender* const transport, |
54 PacketStorage* packet_storage, | 54 PacketStorage* packet_storage, |
55 RtpPacketizerConfig rtp_packetizer_config); | 55 RtpPacketizerConfig rtp_packetizer_config); |
56 ~RtpPacketizer(); | 56 ~RtpPacketizer(); |
57 | 57 |
58 // The video_frame objects ownership is handled by the main cast thread. | 58 // The video_frame objects ownership is handled by the main cast thread. |
| 59 // |capture_time| is only used for scheduling of outgoing packets. |
59 void IncomingEncodedVideoFrame(const EncodedVideoFrame* video_frame, | 60 void IncomingEncodedVideoFrame(const EncodedVideoFrame* video_frame, |
60 const base::TimeTicks& capture_time); | 61 const base::TimeTicks& capture_time); |
61 | 62 |
62 // The audio_frame objects ownership is handled by the main cast thread. | 63 // The audio_frame objects ownership is handled by the main cast thread. |
| 64 // |recorded_time| is only used for scheduling of outgoing packets. |
63 void IncomingEncodedAudioFrame(const EncodedAudioFrame* audio_frame, | 65 void IncomingEncodedAudioFrame(const EncodedAudioFrame* audio_frame, |
64 const base::TimeTicks& recorded_time); | 66 const base::TimeTicks& recorded_time); |
65 | 67 |
66 bool LastSentTimestamp(base::TimeTicks* time_sent, | |
67 uint32* rtp_timestamp) const; | |
68 | |
69 // Return the next sequence number, and increment by one. Enables unique | 68 // Return the next sequence number, and increment by one. Enables unique |
70 // incremental sequence numbers for every packet (including retransmissions). | 69 // incremental sequence numbers for every packet (including retransmissions). |
71 uint16 NextSequenceNumber(); | 70 uint16 NextSequenceNumber(); |
72 | 71 |
73 int send_packets_count() { return send_packets_count_; } | 72 size_t send_packet_count() const { return send_packet_count_; } |
74 | 73 size_t send_octet_count() const { return send_octet_count_; } |
75 size_t send_octet_count() { return send_octet_count_; } | |
76 | 74 |
77 private: | 75 private: |
78 void Cast(bool is_key, | 76 void Cast(bool is_key, |
79 uint32 frame_id, | 77 uint32 frame_id, |
80 uint32 reference_frame_id, | 78 uint32 reference_frame_id, |
81 uint32 timestamp, | 79 uint32 timestamp, |
82 const std::string& data, | 80 const std::string& data, |
83 const base::TimeTicks& capture_time); | 81 const base::TimeTicks& capture_time); |
84 | 82 |
85 void BuildCommonRTPheader(Packet* packet, bool marker_bit, uint32 time_stamp); | 83 void BuildCommonRTPheader(Packet* packet, bool marker_bit, uint32 time_stamp); |
86 | 84 |
87 RtpPacketizerConfig config_; | 85 RtpPacketizerConfig config_; |
88 PacedSender* const transport_; // Not owned by this class. | 86 PacedSender* const transport_; // Not owned by this class. |
89 PacketStorage* packet_storage_; | 87 PacketStorage* packet_storage_; |
90 | 88 |
91 base::TimeTicks time_last_sent_rtp_timestamp_; | |
92 uint16 sequence_number_; | 89 uint16 sequence_number_; |
93 uint32 rtp_timestamp_; | 90 uint32 rtp_timestamp_; |
94 uint16 packet_id_; | 91 uint16 packet_id_; |
95 | 92 |
96 int send_packets_count_; | 93 size_t send_packet_count_; |
97 size_t send_octet_count_; | 94 size_t send_octet_count_; |
98 }; | 95 }; |
99 | 96 |
100 } // namespace transport | 97 } // namespace transport |
101 } // namespace cast | 98 } // namespace cast |
102 } // namespace media | 99 } // namespace media |
103 | 100 |
104 #endif // MEDIA_CAST_TRANSPORT_RTP_SENDER_RTP_PACKETIZER_RTP_PACKETIZER_H_ | 101 #endif // MEDIA_CAST_TRANSPORT_RTP_SENDER_RTP_PACKETIZER_RTP_PACKETIZER_H_ |
OLD | NEW |