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> |
11 | 11 |
12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
13 #include "media/cast/transport/rtp_sender/packet_storage/packet_storage.h" | 13 #include "media/cast/transport/rtp_sender/packet_storage/packet_storage.h" |
14 | 14 |
15 namespace base { | 15 namespace base { |
16 | |
17 class TickClock; | 16 class TickClock; |
18 } | 17 } |
19 | 18 |
20 namespace media { | 19 namespace media { |
21 namespace cast { | 20 namespace cast { |
22 | 21 |
23 class LoggingImpl; | |
24 | |
25 namespace transport { | 22 namespace transport { |
26 | 23 |
27 class PacedSender; | 24 class PacedSender; |
28 | 25 |
29 struct RtpPacketizerConfig { | 26 struct RtpPacketizerConfig { |
30 RtpPacketizerConfig(); | 27 RtpPacketizerConfig(); |
31 ~RtpPacketizerConfig(); | 28 ~RtpPacketizerConfig(); |
32 | 29 |
33 // General. | 30 // General. |
34 bool audio; | 31 bool audio; |
(...skipping 13 matching lines...) Expand all Loading... |
48 AudioCodec audio_codec; | 45 AudioCodec audio_codec; |
49 }; | 46 }; |
50 | 47 |
51 // This object is only called from the main cast thread. | 48 // This object is only called from the main cast thread. |
52 // 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 |
53 // header to each packet. | 50 // header to each packet. |
54 class RtpPacketizer { | 51 class RtpPacketizer { |
55 public: | 52 public: |
56 RtpPacketizer(PacedSender* const transport, | 53 RtpPacketizer(PacedSender* const transport, |
57 PacketStorage* packet_storage, | 54 PacketStorage* packet_storage, |
58 RtpPacketizerConfig rtp_packetizer_config, | 55 RtpPacketizerConfig rtp_packetizer_config); |
59 base::TickClock* clock, | |
60 LoggingImpl* logging); | |
61 ~RtpPacketizer(); | 56 ~RtpPacketizer(); |
62 | 57 |
63 // 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. |
64 void IncomingEncodedVideoFrame(const EncodedVideoFrame* video_frame, | 59 void IncomingEncodedVideoFrame(const EncodedVideoFrame* video_frame, |
65 const base::TimeTicks& capture_time); | 60 const base::TimeTicks& capture_time); |
66 | 61 |
67 // The audio_frame objects ownership is handled by the main cast thread. | 62 // The audio_frame objects ownership is handled by the main cast thread. |
68 void IncomingEncodedAudioFrame(const EncodedAudioFrame* audio_frame, | 63 void IncomingEncodedAudioFrame(const EncodedAudioFrame* audio_frame, |
69 const base::TimeTicks& recorded_time); | 64 const base::TimeTicks& recorded_time); |
70 | 65 |
(...skipping 14 matching lines...) Expand all Loading... |
85 uint32 reference_frame_id, | 80 uint32 reference_frame_id, |
86 uint32 timestamp, | 81 uint32 timestamp, |
87 const std::string& data, | 82 const std::string& data, |
88 const base::TimeTicks& capture_time); | 83 const base::TimeTicks& capture_time); |
89 | 84 |
90 void BuildCommonRTPheader(Packet* packet, bool marker_bit, uint32 time_stamp); | 85 void BuildCommonRTPheader(Packet* packet, bool marker_bit, uint32 time_stamp); |
91 | 86 |
92 RtpPacketizerConfig config_; | 87 RtpPacketizerConfig config_; |
93 PacedSender* const transport_; // Not owned by this class. | 88 PacedSender* const transport_; // Not owned by this class. |
94 PacketStorage* packet_storage_; | 89 PacketStorage* packet_storage_; |
95 base::TickClock* const clock_; // Not owned by this class. | |
96 LoggingImpl* const logging_; // Not owned by this class. | |
97 | 90 |
98 base::TimeTicks time_last_sent_rtp_timestamp_; | 91 base::TimeTicks time_last_sent_rtp_timestamp_; |
99 uint16 sequence_number_; | 92 uint16 sequence_number_; |
100 uint32 rtp_timestamp_; | 93 uint32 rtp_timestamp_; |
101 uint16 packet_id_; | 94 uint16 packet_id_; |
102 | 95 |
103 int send_packets_count_; | 96 int send_packets_count_; |
104 size_t send_octet_count_; | 97 size_t send_octet_count_; |
105 }; | 98 }; |
106 | 99 |
107 } // namespace transport | 100 } // namespace transport |
108 } // namespace cast | 101 } // namespace cast |
109 } // namespace media | 102 } // namespace media |
110 | 103 |
111 #endif // MEDIA_CAST_TRANSPORT_RTP_SENDER_RTP_PACKETIZER_RTP_PACKETIZER_H_ | 104 #endif // MEDIA_CAST_TRANSPORT_RTP_SENDER_RTP_PACKETIZER_RTP_PACKETIZER_H_ |
OLD | NEW |