| Index: media/cast/transport/rtp_sender/packet_storage/packet_storage.h
|
| diff --git a/media/cast/transport/rtp_sender/packet_storage/packet_storage.h b/media/cast/transport/rtp_sender/packet_storage/packet_storage.h
|
| index 85efc664c48b96f7574d22c456a9c8397651df78..b5981e858463e34a22dc40e971b250bdb6020268 100644
|
| --- a/media/cast/transport/rtp_sender/packet_storage/packet_storage.h
|
| +++ b/media/cast/transport/rtp_sender/packet_storage/packet_storage.h
|
| @@ -23,24 +23,15 @@
|
| namespace transport {
|
|
|
| class StoredPacket;
|
| -
|
| -// StorageIndex contains {frame_id, packet_id}.
|
| -typedef std::pair<uint32, uint16> StorageIndex;
|
| -typedef std::map<StorageIndex, std::pair<PacketKey, PacketRef> > PacketMap;
|
| -
|
| -// Frame IDs are generally stored as 8-bit values when sent over the
|
| -// wire. This means that having a history longer than 255 frames makes
|
| -// no sense.
|
| -const int kMaxStoredFrames = 255;
|
| +typedef std::map<uint32, std::pair<PacketKey, PacketRef> > PacketMap;
|
| +typedef std::multimap<base::TimeTicks, uint32> TimeToPacketMap;
|
|
|
| class PacketStorage {
|
| public:
|
| - PacketStorage(int stored_frames);
|
| + static const unsigned int kMaxStoredPackets = 1000;
|
| +
|
| + PacketStorage(base::TickClock* clock, int max_time_stored_ms);
|
| virtual ~PacketStorage();
|
| -
|
| - // Returns true if this class is configured correctly.
|
| - // (stored frames > 0 && stored_frames < kMaxStoredFrames)
|
| - bool IsValid() const;
|
|
|
| void StorePacket(uint32 frame_id,
|
| uint16 packet_id,
|
| @@ -53,20 +44,15 @@
|
| SendPacketVector* packets_to_resend);
|
|
|
| // Copies packet into the packet list.
|
| - bool GetPacket(uint8 frame_id_8bit,
|
| - uint16 packet_id,
|
| - SendPacketVector* packets);
|
| + bool GetPacket(uint8 frame_id, uint16 packet_id, SendPacketVector* packets);
|
| +
|
| private:
|
| - FRIEND_TEST_ALL_PREFIXES(PacketStorageTest, PacketContent);
|
| + void CleanupOldPackets(base::TimeTicks now);
|
|
|
| - // Same as GetPacket, but takes a 32-bit frame id.
|
| - bool GetPacket32(uint32 frame_id,
|
| - uint16 packet_id,
|
| - SendPacketVector* packets);
|
| - void CleanupOldPackets(uint32 current_frame_id);
|
| -
|
| + base::TickClock* const clock_; // Not owned by this class.
|
| + base::TimeDelta max_time_stored_;
|
| PacketMap stored_packets_;
|
| - int stored_frames_;
|
| + TimeToPacketMap time_to_packet_map_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(PacketStorage);
|
| };
|
|
|