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

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: 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
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..3883e1b868a9e6231a9bd0ba1d6e5444cf492067 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>
@@ -28,45 +29,45 @@ class StoredPacket;
typedef std::pair<uint32, uint16> StorageIndex;
typedef std::map<StorageIndex, std::pair<PacketKey, PacketRef> > PacketMap;
+// Stores a list of frames. Each frame consists a list of packets.
+typedef std::deque<SendPacketVector> FrameList;
miu 2014/06/07 00:59:42 naming nit: FrameQueue or FrameDeque?
Alpha Left Google 2014/06/07 01:15:09 Done.
+
// 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;
+const size_t kMaxStoredFrames = 255;
miu 2014/06/07 00:59:41 You can kill this. This constant is defined in ca
Alpha Left Google 2014/06/07 01:15:09 Done.
class PacketStorage {
public:
- PacketStorage(int stored_frames);
+ PacketStorage(size_t stored_frames);
miu 2014/06/07 00:59:41 Need 'explicit' keyword.
miu 2014/06/07 00:59:41 This pruning/upper-limit would not be necessary if
Alpha Left Google 2014/06/07 01:15:09 I think I'll keep the current design. There is ext
miu 2014/06/07 02:00:09 SGTM for this change. The benefits I see are: 1.
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 a list of packets for a frame.
miu 2014/06/07 00:59:41 nit: s/a list of/all of the/
Alpha Left Google 2014/06/07 01:15:09 Done.
+ 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.
miu 2014/06/07 00:59:41 s/by a 8-bits ID/by the lowest 8 bits of the ID/
Alpha Left Google 2014/06/07 01:15:09 This one unfortunately needs to be 8 bits because
+ // 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);
+ // If there is only one referecne to the packet then copy the
+ // reference and return.
+ // Otherwise return a deep copy of the packet.
+ static PacketRef FastCopyPacket(const PacketRef& packet);
miu 2014/06/07 00:59:41 There's no need for this to be a member of this cl
Alpha Left Google 2014/06/07 01:15:09 There might be other place that needs this. And it
miu 2014/06/07 02:00:09 However, the function is static. It has no way of
+ private:
PacketMap stored_packets_;
miu 2014/06/07 00:59:41 naming nit: Can we call this max_frames_to_keep_ i
miu 2014/06/07 00:59:41 This member is no longer used.
Alpha Left Google 2014/06/07 01:15:09 Done.
Alpha Left Google 2014/06/07 01:15:09 Changed it to max_stored_frames_.
- int stored_frames_;
+ size_t stored_frames_;
miu 2014/06/07 00:59:42 nit: const
Alpha Left Google 2014/06/07 01:15:09 Done.
+
+ FrameList frames_;
+ uint32 first_frame_id_in_list_;
+ uint32 last_frame_id_in_list_;
DISALLOW_COPY_AND_ASSIGN(PacketStorage);
};

Powered by Google App Engine
This is Rietveld 408576698