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

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

Issue 1877253002: Replaced CriticalSectionWrapper with rtc::CriticalSection in rtp_rtcp module (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: git cl format dtmf_queue.cc Created 4 years, 8 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 /* 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.
11 */ 11 */
12 12
13 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_PACKET_HISTORY_H_ 13 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_PACKET_HISTORY_H_
14 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_PACKET_HISTORY_H_ 14 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_PACKET_HISTORY_H_
15 15
16 #include <vector> 16 #include <vector>
17 17
18 #include "webrtc/base/criticalsection.h"
18 #include "webrtc/base/thread_annotations.h" 19 #include "webrtc/base/thread_annotations.h"
19 #include "webrtc/modules/include/module_common_types.h" 20 #include "webrtc/modules/include/module_common_types.h"
20 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" 21 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
21 #include "webrtc/typedefs.h" 22 #include "webrtc/typedefs.h"
22 23
23 namespace webrtc { 24 namespace webrtc {
24 25
25 class Clock; 26 class Clock;
26 class CriticalSectionWrapper;
27 27
28 static const size_t kMaxHistoryCapacity = 9600; 28 static const size_t kMaxHistoryCapacity = 9600;
29 29
30 class RTPPacketHistory { 30 class RTPPacketHistory {
31 public: 31 public:
32 explicit RTPPacketHistory(Clock* clock); 32 explicit 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
(...skipping 27 matching lines...) Expand all
64 64
65 bool HasRTPPacket(uint16_t sequence_number) const; 65 bool HasRTPPacket(uint16_t sequence_number) const;
66 66
67 bool SetSent(uint16_t sequence_number); 67 bool SetSent(uint16_t sequence_number);
68 68
69 private: 69 private:
70 void GetPacket(int index, 70 void GetPacket(int index,
71 uint8_t* packet, 71 uint8_t* packet,
72 size_t* packet_length, 72 size_t* packet_length,
73 int64_t* stored_time_ms) const 73 int64_t* stored_time_ms) const
74 EXCLUSIVE_LOCKS_REQUIRED(*critsect_); 74 EXCLUSIVE_LOCKS_REQUIRED(critsect_);
75 void Allocate(size_t number_to_store) EXCLUSIVE_LOCKS_REQUIRED(*critsect_); 75 void Allocate(size_t number_to_store) EXCLUSIVE_LOCKS_REQUIRED(critsect_);
76 void Free() EXCLUSIVE_LOCKS_REQUIRED(*critsect_); 76 void Free() EXCLUSIVE_LOCKS_REQUIRED(critsect_);
77 void VerifyAndAllocatePacketLength(size_t packet_length, uint32_t start_index) 77 void VerifyAndAllocatePacketLength(size_t packet_length, uint32_t start_index)
78 EXCLUSIVE_LOCKS_REQUIRED(*critsect_); 78 EXCLUSIVE_LOCKS_REQUIRED(critsect_);
79 bool FindSeqNum(uint16_t sequence_number, int32_t* index) const 79 bool FindSeqNum(uint16_t sequence_number, int32_t* index) const
80 EXCLUSIVE_LOCKS_REQUIRED(*critsect_); 80 EXCLUSIVE_LOCKS_REQUIRED(critsect_);
81 int FindBestFittingPacket(size_t size) const 81 int FindBestFittingPacket(size_t size) const
82 EXCLUSIVE_LOCKS_REQUIRED(*critsect_); 82 EXCLUSIVE_LOCKS_REQUIRED(critsect_);
83 83
84 private: 84 private:
85 Clock* clock_; 85 Clock* clock_;
86 rtc::scoped_ptr<CriticalSectionWrapper> critsect_; 86 rtc::CriticalSection critsect_;
87 bool store_ GUARDED_BY(critsect_); 87 bool store_ GUARDED_BY(critsect_);
88 uint32_t prev_index_ GUARDED_BY(critsect_); 88 uint32_t prev_index_ GUARDED_BY(critsect_);
89 89
90 struct StoredPacket { 90 struct StoredPacket {
91 StoredPacket(); 91 StoredPacket();
92 uint16_t sequence_number = 0; 92 uint16_t sequence_number = 0;
93 int64_t time_ms = 0; 93 int64_t time_ms = 0;
94 int64_t send_time = 0; 94 int64_t send_time = 0;
95 StorageType storage_type = kDontRetransmit; 95 StorageType storage_type = kDontRetransmit;
96 bool has_been_retransmitted = false; 96 bool has_been_retransmitted = false;
97 97
98 uint8_t data[IP_PACKET_SIZE]; 98 uint8_t data[IP_PACKET_SIZE];
99 size_t length = 0; 99 size_t length = 0;
100 }; 100 };
101 std::vector<StoredPacket> stored_packets_ GUARDED_BY(critsect_); 101 std::vector<StoredPacket> stored_packets_ GUARDED_BY(critsect_);
102 }; 102 };
103 } // namespace webrtc 103 } // namespace webrtc
104 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_PACKET_HISTORY_H_ 104 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_PACKET_HISTORY_H_
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_header_parser.cc ('k') | webrtc/modules/rtp_rtcp/source/rtp_packet_history.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698