Chromium Code Reviews| Index: media/cast/net/pacing/paced_sender.h |
| diff --git a/media/cast/net/pacing/paced_sender.h b/media/cast/net/pacing/paced_sender.h |
| index c9f0512eb0ca9212af029e28169bd465a8980c83..096954b723664889513b4552e230a89a874344a6 100644 |
| --- a/media/cast/net/pacing/paced_sender.h |
| +++ b/media/cast/net/pacing/paced_sender.h |
| @@ -5,7 +5,7 @@ |
| #ifndef MEDIA_CAST_NET_PACING_PACED_SENDER_H_ |
| #define MEDIA_CAST_NET_PACING_PACED_SENDER_H_ |
| -#include <list> |
| +#include <map> |
| #include <vector> |
| #include "base/basictypes.h" |
| @@ -69,6 +69,12 @@ class PacedSender : public PacedPacketSender, |
| void RegisterAudioSsrc(uint32 audio_ssrc); |
| void RegisterVideoSsrc(uint32 video_ssrc); |
| + // Register SSRC that has a higher priority for sending. Multiple SSRCs can |
| + // be registered. |
| + // Note that it is not expected to register many SSRCs with this method. |
| + // Because IsHigherPriority() is done in linear time. |
|
miu
2014/07/16 22:55:56
nit: s/done/determined/
Alpha Left Google
2014/07/17 00:12:56
Done.
|
| + void RegisterPrioritySsrc(uint32 ssrc); |
| + |
| // PacedPacketSender implementation. |
| virtual bool SendPackets(const SendPacketVector& packets) OVERRIDE; |
| virtual bool ResendPackets(const SendPacketVector& packets, |
| @@ -111,13 +117,22 @@ class PacedSender : public PacedPacketSender, |
| PacketRef GetNextPacket(PacketType* packet_type, |
| PacketKey* packet_key); |
| + // Returns true if the packet should have a higher priority. |
| + bool IsHighPriority(const PacketKey& packet_key) const; |
| + |
| base::TickClock* const clock_; // Not owned by this class. |
| LoggingImpl* const logging_; // Not owned by this class. |
| PacketSender* transport_; // Not owned by this class. |
| scoped_refptr<base::SingleThreadTaskRunner> transport_task_runner_; |
| uint32 audio_ssrc_; |
| uint32 video_ssrc_; |
| - std::map<PacketKey, std::pair<PacketType, PacketRef> > packet_list_; |
| + |
| + // Set of SSRCs that have higher priority. This is a vector instead of a |
| + // set because there's only very few in it (most likely 1). |
| + std::vector<uint32> priority_ssrcs_; |
| + typedef std::map<PacketKey, std::pair<PacketType, PacketRef> > PacketList; |
| + PacketList packet_list_; |
| + PacketList priority_packet_list_; |
| std::map<PacketKey, base::TimeTicks> sent_time_; |
| std::map<PacketKey, base::TimeTicks> sent_time_buffer_; |