Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(647)

Unified Diff: media/cast/transport/rtp_sender/packet_storage/packet_storage.h

Issue 317243007: Cast: reduce the amount of retransmission packets (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: moved FastCopyPacket to RtpSender Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | media/cast/transport/rtp_sender/packet_storage/packet_storage.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..037ead1edf6e78fb2a272435ae4f3fd7c0417e20 100644
--- a/media/cast/transport/rtp_sender/packet_storage/packet_storage.h
+++ b/media/cast/transport/rtp_sender/packet_storage/packet_storage.h
@@ -5,6 +5,7 @@
#ifndef MEDIA_CAST_TRANSPORT_RTP_SENDER_PACKET_STORAGE_PACKET_STORAGE_H_
#define MEDIA_CAST_TRANSPORT_RTP_SENDER_PACKET_STORAGE_PACKET_STORAGE_H_
+#include <deque>
#include <list>
#include <map>
#include <vector>
@@ -22,51 +23,34 @@ namespace media {
namespace cast {
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;
+// Stores a list of frames. Each frame consists a list of packets.
+typedef std::deque<SendPacketVector> FrameQueue;
class PacketStorage {
public:
- PacketStorage(int stored_frames);
+ explicit PacketStorage(size_t stored_frames);
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,
- const PacketKey& key,
- PacketRef packet);
+ // Store all of the packets for a frame.
+ void StoreFrame(uint32 frame_id, const SendPacketVector& packets);
- // Copies all missing packets into the packet list.
- void GetPackets(
- const MissingFramesAndPacketsMap& missing_frames_and_packets,
- SendPacketVector* packets_to_resend);
+ // Returns a list of packets for a frame indexed by a 8-bits ID.
+ // It is the lowest 8 bits of a frame ID.
+ // Returns NULL if the frame cannot be found.
+ const SendPacketVector* GetFrame8(uint8 frame_id_8bits) const;
- // Copies packet into the packet list.
- bool GetPacket(uint8 frame_id_8bit,
- uint16 packet_id,
- SendPacketVector* packets);
- private:
- FRIEND_TEST_ALL_PREFIXES(PacketStorageTest, PacketContent);
+ // Get the number of stored frames.
+ size_t GetNumberOfStoredFrames() const;
- // 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);
-
- PacketMap stored_packets_;
- int stored_frames_;
+ private:
+ const size_t max_stored_frames_;
+ FrameQueue frames_;
+ uint32 first_frame_id_in_list_;
+ uint32 last_frame_id_in_list_;
DISALLOW_COPY_AND_ASSIGN(PacketStorage);
};
« no previous file with comments | « no previous file | media/cast/transport/rtp_sender/packet_storage/packet_storage.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698