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

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtp_packet_history.h

Issue 1340573002: Refactor RTPPacketHistory to use a packet struct. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: remove max packet size as a parameter Created 5 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
« no previous file with comments | « no previous file | webrtc/modules/rtp_rtcp/source/rtp_packet_history.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 * 9 *
10 * Class for storing RTP packets. 10 * Class for storing RTP packets.
(...skipping 21 matching lines...) Expand all
32 RTPPacketHistory(Clock* clock); 32 RTPPacketHistory(Clock* clock);
33 ~RTPPacketHistory(); 33 ~RTPPacketHistory();
34 34
35 void SetStorePacketsStatus(bool enable, uint16_t number_to_store); 35 void SetStorePacketsStatus(bool enable, uint16_t number_to_store);
36 36
37 bool StorePackets() const; 37 bool StorePackets() const;
38 38
39 // Stores RTP packet. 39 // Stores RTP packet.
40 int32_t PutRTPPacket(const uint8_t* packet, 40 int32_t PutRTPPacket(const uint8_t* packet,
41 size_t packet_length, 41 size_t packet_length,
42 size_t max_packet_length,
43 int64_t capture_time_ms, 42 int64_t capture_time_ms,
44 StorageType type); 43 StorageType type);
45 44
46 // Gets stored RTP packet corresponding to the input sequence number. 45 // Gets stored RTP packet corresponding to the input sequence number.
47 // The packet is copied to the buffer pointed to by ptr_rtp_packet. 46 // The packet is copied to the buffer pointed to by ptr_rtp_packet.
48 // The rtp_packet_length should show the available buffer size. 47 // The rtp_packet_length should show the available buffer size.
49 // Returns true if packet is found. 48 // Returns true if packet is found.
50 // rtp_packet_length: returns the copied packet length on success. 49 // rtp_packet_length: returns the copied packet length on success.
51 // min_elapsed_time_ms: the minimum time that must have elapsed since the last 50 // min_elapsed_time_ms: the minimum time that must have elapsed since the last
52 // time the packet was resent (parameter is ignored if set to zero). 51 // time the packet was resent (parameter is ignored if set to zero).
(...skipping 28 matching lines...) Expand all
81 bool FindSeqNum(uint16_t sequence_number, int32_t* index) const 80 bool FindSeqNum(uint16_t sequence_number, int32_t* index) const
82 EXCLUSIVE_LOCKS_REQUIRED(*critsect_); 81 EXCLUSIVE_LOCKS_REQUIRED(*critsect_);
83 int FindBestFittingPacket(size_t size) const 82 int FindBestFittingPacket(size_t size) const
84 EXCLUSIVE_LOCKS_REQUIRED(*critsect_); 83 EXCLUSIVE_LOCKS_REQUIRED(*critsect_);
85 84
86 private: 85 private:
87 Clock* clock_; 86 Clock* clock_;
88 rtc::scoped_ptr<CriticalSectionWrapper> critsect_; 87 rtc::scoped_ptr<CriticalSectionWrapper> critsect_;
89 bool store_ GUARDED_BY(critsect_); 88 bool store_ GUARDED_BY(critsect_);
90 uint32_t prev_index_ GUARDED_BY(critsect_); 89 uint32_t prev_index_ GUARDED_BY(critsect_);
91 size_t max_packet_length_ GUARDED_BY(critsect_);
92 90
93 std::vector<std::vector<uint8_t> > stored_packets_ GUARDED_BY(critsect_); 91 struct StoredPacket {
94 std::vector<uint16_t> stored_seq_nums_ GUARDED_BY(critsect_); 92 StoredPacket();
95 std::vector<size_t> stored_lengths_ GUARDED_BY(critsect_); 93 uint16_t sequence_number = 0;
96 std::vector<int64_t> stored_times_ GUARDED_BY(critsect_); 94 int64_t time_ms = 0;
97 std::vector<int64_t> stored_send_times_ GUARDED_BY(critsect_); 95 int64_t send_time = 0;
98 std::vector<StorageType> stored_types_ GUARDED_BY(critsect_); 96 StorageType storage_type = kDontStore;
97
98 uint8_t data[IP_PACKET_SIZE];
99 size_t length = 0;
100 };
101 std::vector<StoredPacket> stored_packets_ GUARDED_BY(critsect_);
99 }; 102 };
100 } // namespace webrtc 103 } // namespace webrtc
101 #endif // WEBRTC_MODULES_RTP_RTCP_RTP_PACKET_HISTORY_H_ 104 #endif // WEBRTC_MODULES_RTP_RTCP_RTP_PACKET_HISTORY_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/rtp_rtcp/source/rtp_packet_history.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698