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
3 // found in the LICENSE file.
5 #ifndef MEDIA_CAST_NET_RTP_RTP_PACKETIZER_H_
6 #define MEDIA_CAST_NET_RTP_RTP_PACKETIZER_H_
12 #include "base/time/time.h"
13 #include "media/cast/net/rtp/packet_storage.h"
24 struct RtpPacketizerConfig
{
25 RtpPacketizerConfig();
26 ~RtpPacketizerConfig();
30 uint16 max_payload_length
;
31 uint16 sequence_number
;
37 // This object is only called from the main cast thread.
38 // This class break encoded audio and video frames into packets and add an RTP
39 // header to each packet.
42 RtpPacketizer(PacedSender
* const transport
,
43 PacketStorage
* packet_storage
,
44 RtpPacketizerConfig rtp_packetizer_config
);
47 void SendFrameAsPackets(const EncodedFrame
& frame
);
49 // Return the next sequence number, and increment by one. Enables unique
50 // incremental sequence numbers for every packet (including retransmissions).
51 uint16
NextSequenceNumber();
53 size_t send_packet_count() const { return send_packet_count_
; }
54 size_t send_octet_count() const { return send_octet_count_
; }
57 void BuildCommonRTPheader(Packet
* packet
, bool marker_bit
, uint32 time_stamp
);
59 RtpPacketizerConfig config_
;
60 PacedSender
* const transport_
; // Not owned by this class.
61 PacketStorage
* packet_storage_
;
63 uint16 sequence_number_
;
64 uint32 rtp_timestamp_
;
67 size_t send_packet_count_
;
68 size_t send_octet_count_
;
74 #endif // MEDIA_CAST_NET_RTP_RTP_PACKETIZER_H_