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