OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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 | 10 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 void Clear(); | 57 void Clear(); |
58 void PaddingReceived(uint16_t seq_num); | 58 void PaddingReceived(uint16_t seq_num); |
59 | 59 |
60 // Timestamp (not RTP timestamp) of the last received packet/keyframe packet. | 60 // Timestamp (not RTP timestamp) of the last received packet/keyframe packet. |
61 rtc::Optional<int64_t> LastReceivedPacketMs() const; | 61 rtc::Optional<int64_t> LastReceivedPacketMs() const; |
62 rtc::Optional<int64_t> LastReceivedKeyframePacketMs() const; | 62 rtc::Optional<int64_t> LastReceivedKeyframePacketMs() const; |
63 | 63 |
64 int AddRef() const; | 64 int AddRef() const; |
65 int Release() const; | 65 int Release() const; |
66 | 66 |
| 67 size_t size_ GUARDED_BY(crit_); |
| 68 |
67 protected: | 69 protected: |
68 // Both |start_buffer_size| and |max_buffer_size| must be a power of 2. | 70 // Both |start_buffer_size| and |max_buffer_size| must be a power of 2. |
69 PacketBuffer(Clock* clock, | 71 PacketBuffer(Clock* clock, |
70 size_t start_buffer_size, | 72 size_t start_buffer_size, |
71 size_t max_buffer_size, | 73 size_t max_buffer_size, |
72 OnReceivedFrameCallback* frame_callback); | 74 OnReceivedFrameCallback* frame_callback); |
73 | 75 |
74 private: | 76 private: |
75 friend RtpFrameObject; | 77 friend RtpFrameObject; |
76 // Since we want the packet buffer to be as packet type agnostic | 78 // Since we want the packet buffer to be as packet type agnostic |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 | 123 |
122 // Mark all slots used by |frame| as not used. | 124 // Mark all slots used by |frame| as not used. |
123 // Virtual for testing. | 125 // Virtual for testing. |
124 virtual void ReturnFrame(RtpFrameObject* frame); | 126 virtual void ReturnFrame(RtpFrameObject* frame); |
125 | 127 |
126 void UpdateMissingPackets(uint16_t seq_num) EXCLUSIVE_LOCKS_REQUIRED(crit_); | 128 void UpdateMissingPackets(uint16_t seq_num) EXCLUSIVE_LOCKS_REQUIRED(crit_); |
127 | 129 |
128 rtc::CriticalSection crit_; | 130 rtc::CriticalSection crit_; |
129 | 131 |
130 // Buffer size_ and max_size_ must always be a power of two. | 132 // Buffer size_ and max_size_ must always be a power of two. |
131 size_t size_ GUARDED_BY(crit_); | |
132 const size_t max_size_; | 133 const size_t max_size_; |
133 | 134 |
134 // The fist sequence number currently in the buffer. | 135 // The fist sequence number currently in the buffer. |
135 uint16_t first_seq_num_ GUARDED_BY(crit_); | 136 uint16_t first_seq_num_ GUARDED_BY(crit_); |
136 | 137 |
137 // If the packet buffer has received its first packet. | 138 // If the packet buffer has received its first packet. |
138 bool first_packet_received_ GUARDED_BY(crit_); | 139 bool first_packet_received_ GUARDED_BY(crit_); |
139 | 140 |
140 // If the buffer is cleared to |first_seq_num_|. | 141 // If the buffer is cleared to |first_seq_num_|. |
141 bool is_cleared_to_first_seq_num_ GUARDED_BY(crit_); | 142 bool is_cleared_to_first_seq_num_ GUARDED_BY(crit_); |
(...skipping 16 matching lines...) Expand all Loading... |
158 std::set<uint16_t, DescendingSeqNumComp<uint16_t>> missing_packets_ | 159 std::set<uint16_t, DescendingSeqNumComp<uint16_t>> missing_packets_ |
159 GUARDED_BY(crit_); | 160 GUARDED_BY(crit_); |
160 | 161 |
161 mutable volatile int ref_count_ = 0; | 162 mutable volatile int ref_count_ = 0; |
162 }; | 163 }; |
163 | 164 |
164 } // namespace video_coding | 165 } // namespace video_coding |
165 } // namespace webrtc | 166 } // namespace webrtc |
166 | 167 |
167 #endif // WEBRTC_MODULES_VIDEO_CODING_PACKET_BUFFER_H_ | 168 #endif // WEBRTC_MODULES_VIDEO_CODING_PACKET_BUFFER_H_ |
OLD | NEW |