| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 // This object is only called from the main cast thread. | 48 // This object is only called from the main cast thread. |
| 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 void SendFrameAsPackets(const EncodedFrame& frame); |
| 59 // |capture_time| is only used for scheduling of outgoing packets. | |
| 60 void IncomingEncodedVideoFrame(const EncodedVideoFrame* video_frame, | |
| 61 const base::TimeTicks& capture_time); | |
| 62 | |
| 63 // The audio_frame objects ownership is handled by the main cast thread. | |
| 64 // |recorded_time| is only used for scheduling of outgoing packets. | |
| 65 void IncomingEncodedAudioFrame(const EncodedAudioFrame* audio_frame, | |
| 66 const base::TimeTicks& recorded_time); | |
| 67 | 59 |
| 68 // Return the next sequence number, and increment by one. Enables unique | 60 // Return the next sequence number, and increment by one. Enables unique |
| 69 // incremental sequence numbers for every packet (including retransmissions). | 61 // incremental sequence numbers for every packet (including retransmissions). |
| 70 uint16 NextSequenceNumber(); | 62 uint16 NextSequenceNumber(); |
| 71 | 63 |
| 72 size_t send_packet_count() const { return send_packet_count_; } | 64 size_t send_packet_count() const { return send_packet_count_; } |
| 73 size_t send_octet_count() const { return send_octet_count_; } | 65 size_t send_octet_count() const { return send_octet_count_; } |
| 74 | 66 |
| 75 private: | 67 private: |
| 76 void Cast(bool is_key, | |
| 77 uint32 frame_id, | |
| 78 uint32 reference_frame_id, | |
| 79 uint32 timestamp, | |
| 80 const std::string& data, | |
| 81 const base::TimeTicks& capture_time); | |
| 82 | |
| 83 void BuildCommonRTPheader(Packet* packet, bool marker_bit, uint32 time_stamp); | 68 void BuildCommonRTPheader(Packet* packet, bool marker_bit, uint32 time_stamp); |
| 84 | 69 |
| 85 RtpPacketizerConfig config_; | 70 RtpPacketizerConfig config_; |
| 86 PacedSender* const transport_; // Not owned by this class. | 71 PacedSender* const transport_; // Not owned by this class. |
| 87 PacketStorage* packet_storage_; | 72 PacketStorage* packet_storage_; |
| 88 | 73 |
| 89 uint16 sequence_number_; | 74 uint16 sequence_number_; |
| 90 uint32 rtp_timestamp_; | 75 uint32 rtp_timestamp_; |
| 91 uint16 packet_id_; | 76 uint16 packet_id_; |
| 92 | 77 |
| 93 size_t send_packet_count_; | 78 size_t send_packet_count_; |
| 94 size_t send_octet_count_; | 79 size_t send_octet_count_; |
| 95 }; | 80 }; |
| 96 | 81 |
| 97 } // namespace transport | 82 } // namespace transport |
| 98 } // namespace cast | 83 } // namespace cast |
| 99 } // namespace media | 84 } // namespace media |
| 100 | 85 |
| 101 #endif // MEDIA_CAST_TRANSPORT_RTP_SENDER_RTP_PACKETIZER_RTP_PACKETIZER_H_ | 86 #endif // MEDIA_CAST_TRANSPORT_RTP_SENDER_RTP_PACKETIZER_RTP_PACKETIZER_H_ |
| OLD | NEW |