| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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_NET_PACING_PACED_SENDER_H_ | 5 #ifndef MEDIA_CAST_NET_PACING_PACED_SENDER_H_ |
| 6 #define MEDIA_CAST_NET_PACING_PACED_SENDER_H_ | 6 #define MEDIA_CAST_NET_PACING_PACED_SENDER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 // The |external_transport| should only be used by the Cast receiver and for | 82 // The |external_transport| should only be used by the Cast receiver and for |
| 83 // testing. | 83 // testing. |
| 84 PacedSender( | 84 PacedSender( |
| 85 size_t target_burst_size, // Should normally be kTargetBurstSize. | 85 size_t target_burst_size, // Should normally be kTargetBurstSize. |
| 86 size_t max_burst_size, // Should normally be kMaxBurstSize. | 86 size_t max_burst_size, // Should normally be kMaxBurstSize. |
| 87 base::TickClock* clock, | 87 base::TickClock* clock, |
| 88 LoggingImpl* logging, | 88 LoggingImpl* logging, |
| 89 PacketSender* external_transport, | 89 PacketSender* external_transport, |
| 90 const scoped_refptr<base::SingleThreadTaskRunner>& transport_task_runner); | 90 const scoped_refptr<base::SingleThreadTaskRunner>& transport_task_runner); |
| 91 | 91 |
| 92 virtual ~PacedSender(); | 92 ~PacedSender() override; |
| 93 | 93 |
| 94 // These must be called before non-RTCP packets are sent. | 94 // These must be called before non-RTCP packets are sent. |
| 95 void RegisterAudioSsrc(uint32 audio_ssrc); | 95 void RegisterAudioSsrc(uint32 audio_ssrc); |
| 96 void RegisterVideoSsrc(uint32 video_ssrc); | 96 void RegisterVideoSsrc(uint32 video_ssrc); |
| 97 | 97 |
| 98 // Register SSRC that has a higher priority for sending. Multiple SSRCs can | 98 // Register SSRC that has a higher priority for sending. Multiple SSRCs can |
| 99 // be registered. | 99 // be registered. |
| 100 // Note that it is not expected to register many SSRCs with this method. | 100 // Note that it is not expected to register many SSRCs with this method. |
| 101 // Because IsHigherPriority() is determined in linear time. | 101 // Because IsHigherPriority() is determined in linear time. |
| 102 void RegisterPrioritySsrc(uint32 ssrc); | 102 void RegisterPrioritySsrc(uint32 ssrc); |
| 103 | 103 |
| 104 // Returns the total number of bytes sent to the socket when the specified | 104 // Returns the total number of bytes sent to the socket when the specified |
| 105 // packet was just sent. | 105 // packet was just sent. |
| 106 // Returns 0 if the packet cannot be found or not yet sent. | 106 // Returns 0 if the packet cannot be found or not yet sent. |
| 107 int64 GetLastByteSentForPacket(const PacketKey& packet_key); | 107 int64 GetLastByteSentForPacket(const PacketKey& packet_key); |
| 108 | 108 |
| 109 // Returns the total number of bytes sent to the socket when the last payload | 109 // Returns the total number of bytes sent to the socket when the last payload |
| 110 // identified by SSRC is just sent. | 110 // identified by SSRC is just sent. |
| 111 int64 GetLastByteSentForSsrc(uint32 ssrc); | 111 int64 GetLastByteSentForSsrc(uint32 ssrc); |
| 112 | 112 |
| 113 // PacedPacketSender implementation. | 113 // PacedPacketSender implementation. |
| 114 virtual bool SendPackets(const SendPacketVector& packets) override; | 114 bool SendPackets(const SendPacketVector& packets) override; |
| 115 virtual bool ResendPackets(const SendPacketVector& packets, | 115 bool ResendPackets(const SendPacketVector& packets, |
| 116 const DedupInfo& dedup_info) override; | 116 const DedupInfo& dedup_info) override; |
| 117 virtual bool SendRtcpPacket(uint32 ssrc, PacketRef packet) override; | 117 bool SendRtcpPacket(uint32 ssrc, PacketRef packet) override; |
| 118 virtual void CancelSendingPacket(const PacketKey& packet_key) override; | 118 void CancelSendingPacket(const PacketKey& packet_key) override; |
| 119 | 119 |
| 120 private: | 120 private: |
| 121 // Actually sends the packets to the transport. | 121 // Actually sends the packets to the transport. |
| 122 void SendStoredPackets(); | 122 void SendStoredPackets(); |
| 123 void LogPacketEvent(const Packet& packet, CastLoggingEvent event); | 123 void LogPacketEvent(const Packet& packet, CastLoggingEvent event); |
| 124 | 124 |
| 125 // Returns true if retransmission for packet indexed by |packet_key| is | 125 // Returns true if retransmission for packet indexed by |packet_key| is |
| 126 // accepted. |dedup_info| contains information to help deduplicate | 126 // accepted. |dedup_info| contains information to help deduplicate |
| 127 // retransmission. |now| is the current time to save on fetching it from the | 127 // retransmission. |now| is the current time to save on fetching it from the |
| 128 // clock multiple times. | 128 // clock multiple times. |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 // NOTE: Weak pointers must be invalidated before all other member variables. | 210 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 211 base::WeakPtrFactory<PacedSender> weak_factory_; | 211 base::WeakPtrFactory<PacedSender> weak_factory_; |
| 212 | 212 |
| 213 DISALLOW_COPY_AND_ASSIGN(PacedSender); | 213 DISALLOW_COPY_AND_ASSIGN(PacedSender); |
| 214 }; | 214 }; |
| 215 | 215 |
| 216 } // namespace cast | 216 } // namespace cast |
| 217 } // namespace media | 217 } // namespace media |
| 218 | 218 |
| 219 #endif // MEDIA_CAST_NET_PACING_PACED_SENDER_H_ | 219 #endif // MEDIA_CAST_NET_PACING_PACED_SENDER_H_ |
| OLD | NEW |