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

Side by Side Diff: media/cast/net/rtp/packet_storage.h

Issue 560223002: [Cast] Limit frames in flight by duration, and not by number of frames. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tweaks. Created 6 years, 3 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 unified diff | Download patch
OLDNEW
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_RTP_SENDER_PACKET_STORAGE_PACKET_STORAGE_H_ 5 #ifndef MEDIA_CAST_NET_RTP_SENDER_PACKET_STORAGE_PACKET_STORAGE_H_
6 #define MEDIA_CAST_NET_RTP_SENDER_PACKET_STORAGE_PACKET_STORAGE_H_ 6 #define MEDIA_CAST_NET_RTP_SENDER_PACKET_STORAGE_PACKET_STORAGE_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <list>
10 #include <map>
11 #include <vector>
12 9
13 #include "base/basictypes.h" 10 #include "base/basictypes.h"
14 #include "base/memory/linked_ptr.h"
15 #include "base/memory/scoped_ptr.h"
16 #include "base/time/tick_clock.h"
17 #include "base/time/time.h"
18 #include "media/cast/net/cast_transport_config.h"
19 #include "media/cast/net/cast_transport_defines.h"
20 #include "media/cast/net/pacing/paced_sender.h" 11 #include "media/cast/net/pacing/paced_sender.h"
21 12
22 namespace media { 13 namespace media {
23 namespace cast { 14 namespace cast {
24 15
25 // Stores a list of frames. Each frame consists a list of packets.
26 typedef std::deque<SendPacketVector> FrameQueue;
27
28 class PacketStorage { 16 class PacketStorage {
29 public: 17 public:
30 explicit PacketStorage(size_t stored_frames); 18 PacketStorage();
31 virtual ~PacketStorage(); 19 virtual ~PacketStorage();
32 20
33 // Returns true if this class is configured correctly.
34 // (stored frames > 0 && stored_frames < kMaxStoredFrames)
35 bool IsValid() const;
36
37 // Store all of the packets for a frame. 21 // Store all of the packets for a frame.
38 void StoreFrame(uint32 frame_id, const SendPacketVector& packets); 22 void StoreFrame(uint32 frame_id, const SendPacketVector& packets);
39 23
24 // Release all of the packets for a frame.
25 void ReleaseFrame(uint32 frame_id);
26
40 // Returns a list of packets for a frame indexed by a 8-bits ID. 27 // Returns a list of packets for a frame indexed by a 8-bits ID.
41 // It is the lowest 8 bits of a frame ID. 28 // It is the lowest 8 bits of a frame ID.
42 // Returns NULL if the frame cannot be found. 29 // Returns NULL if the frame cannot be found.
43 const SendPacketVector* GetFrame8(uint8 frame_id_8bits) const; 30 const SendPacketVector* GetFrame8(uint8 frame_id_8bits) const;
44 31
45 // Get the number of stored frames. 32 // Get the number of stored frames.
46 size_t GetNumberOfStoredFrames() const; 33 size_t GetNumberOfStoredFrames() const;
47 34
48 private: 35 private:
49 const size_t max_stored_frames_; 36 std::deque<SendPacketVector> frames_;
50 FrameQueue frames_;
51 uint32 first_frame_id_in_list_; 37 uint32 first_frame_id_in_list_;
52 uint32 last_frame_id_in_list_; 38
39 // The number of frames whose packets have been released, but the entry in the
40 // |frames_| queue has not yet been popped.
41 size_t zombie_count_;
53 42
54 DISALLOW_COPY_AND_ASSIGN(PacketStorage); 43 DISALLOW_COPY_AND_ASSIGN(PacketStorage);
55 }; 44 };
56 45
57 } // namespace cast 46 } // namespace cast
58 } // namespace media 47 } // namespace media
59 48
60 #endif // MEDIA_CAST_NET_RTP_SENDER_PACKET_STORAGE_PACKET_STORAGE_H_ 49 #endif // MEDIA_CAST_NET_RTP_SENDER_PACKET_STORAGE_PACKET_STORAGE_H_
OLDNEW
« no previous file with comments | « media/cast/net/cast_transport_sender_impl_unittest.cc ('k') | media/cast/net/rtp/packet_storage.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698