| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 // If all its previous packets have been inserted into the packet buffer. | 92 // If all its previous packets have been inserted into the packet buffer. |
| 93 bool continuous = false; | 93 bool continuous = false; |
| 94 | 94 |
| 95 // If this packet has been used to create a frame already. | 95 // If this packet has been used to create a frame already. |
| 96 bool frame_created = false; | 96 bool frame_created = false; |
| 97 }; | 97 }; |
| 98 | 98 |
| 99 Clock* const clock_; | 99 Clock* const clock_; |
| 100 | 100 |
| 101 // Tries to expand the buffer. | 101 // Tries to expand the buffer. |
| 102 bool ExpandBufferSize() EXCLUSIVE_LOCKS_REQUIRED(crit_); | 102 bool ExpandBufferSize() RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_); |
| 103 | 103 |
| 104 // Test if all previous packets has arrived for the given sequence number. | 104 // Test if all previous packets has arrived for the given sequence number. |
| 105 bool PotentialNewFrame(uint16_t seq_num) const | 105 bool PotentialNewFrame(uint16_t seq_num) const |
| 106 EXCLUSIVE_LOCKS_REQUIRED(crit_); | 106 RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_); |
| 107 | 107 |
| 108 // Test if all packets of a frame has arrived, and if so, creates a frame. | 108 // Test if all packets of a frame has arrived, and if so, creates a frame. |
| 109 // Returns a vector of received frames. | 109 // Returns a vector of received frames. |
| 110 std::vector<std::unique_ptr<RtpFrameObject>> FindFrames(uint16_t seq_num) | 110 std::vector<std::unique_ptr<RtpFrameObject>> FindFrames(uint16_t seq_num) |
| 111 EXCLUSIVE_LOCKS_REQUIRED(crit_); | 111 RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_); |
| 112 | 112 |
| 113 // Copy the bitstream for |frame| to |destination|. | 113 // Copy the bitstream for |frame| to |destination|. |
| 114 // Virtual for testing. | 114 // Virtual for testing. |
| 115 virtual bool GetBitstream(const RtpFrameObject& frame, uint8_t* destination); | 115 virtual bool GetBitstream(const RtpFrameObject& frame, uint8_t* destination); |
| 116 | 116 |
| 117 // Get the packet with sequence number |seq_num|. | 117 // Get the packet with sequence number |seq_num|. |
| 118 // Virtual for testing. | 118 // Virtual for testing. |
| 119 virtual VCMPacket* GetPacket(uint16_t seq_num) | 119 virtual VCMPacket* GetPacket(uint16_t seq_num) |
| 120 EXCLUSIVE_LOCKS_REQUIRED(crit_); | 120 RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_); |
| 121 | 121 |
| 122 // Mark all slots used by |frame| as not used. | 122 // Mark all slots used by |frame| as not used. |
| 123 // Virtual for testing. | 123 // Virtual for testing. |
| 124 virtual void ReturnFrame(RtpFrameObject* frame); | 124 virtual void ReturnFrame(RtpFrameObject* frame); |
| 125 | 125 |
| 126 void UpdateMissingPackets(uint16_t seq_num) EXCLUSIVE_LOCKS_REQUIRED(crit_); | 126 void UpdateMissingPackets(uint16_t seq_num) |
| 127 RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_); |
| 127 | 128 |
| 128 rtc::CriticalSection crit_; | 129 rtc::CriticalSection crit_; |
| 129 | 130 |
| 130 // Buffer size_ and max_size_ must always be a power of two. | 131 // Buffer size_ and max_size_ must always be a power of two. |
| 131 size_t size_ GUARDED_BY(crit_); | 132 size_t size_ RTC_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_ RTC_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_ RTC_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_ RTC_GUARDED_BY(crit_); |
| 142 | 143 |
| 143 // Buffer that holds the inserted packets. | 144 // Buffer that holds the inserted packets. |
| 144 std::vector<VCMPacket> data_buffer_ GUARDED_BY(crit_); | 145 std::vector<VCMPacket> data_buffer_ RTC_GUARDED_BY(crit_); |
| 145 | 146 |
| 146 // Buffer that holds the information about which slot that is currently in use | 147 // Buffer that holds the information about which slot that is currently in use |
| 147 // and information needed to determine the continuity between packets. | 148 // and information needed to determine the continuity between packets. |
| 148 std::vector<ContinuityInfo> sequence_buffer_ GUARDED_BY(crit_); | 149 std::vector<ContinuityInfo> sequence_buffer_ RTC_GUARDED_BY(crit_); |
| 149 | 150 |
| 150 // Called when a received frame is found. | 151 // Called when a received frame is found. |
| 151 OnReceivedFrameCallback* const received_frame_callback_; | 152 OnReceivedFrameCallback* const received_frame_callback_; |
| 152 | 153 |
| 153 // Timestamp (not RTP timestamp) of the last received packet/keyframe packet. | 154 // Timestamp (not RTP timestamp) of the last received packet/keyframe packet. |
| 154 rtc::Optional<int64_t> last_received_packet_ms_ GUARDED_BY(crit_); | 155 rtc::Optional<int64_t> last_received_packet_ms_ RTC_GUARDED_BY(crit_); |
| 155 rtc::Optional<int64_t> last_received_keyframe_packet_ms_ GUARDED_BY(crit_); | 156 rtc::Optional<int64_t> last_received_keyframe_packet_ms_ |
| 157 RTC_GUARDED_BY(crit_); |
| 156 | 158 |
| 157 rtc::Optional<uint16_t> newest_inserted_seq_num_ GUARDED_BY(crit_); | 159 rtc::Optional<uint16_t> newest_inserted_seq_num_ RTC_GUARDED_BY(crit_); |
| 158 std::set<uint16_t, DescendingSeqNumComp<uint16_t>> missing_packets_ | 160 std::set<uint16_t, DescendingSeqNumComp<uint16_t>> missing_packets_ |
| 159 GUARDED_BY(crit_); | 161 RTC_GUARDED_BY(crit_); |
| 160 | 162 |
| 161 mutable volatile int ref_count_ = 0; | 163 mutable volatile int ref_count_ = 0; |
| 162 }; | 164 }; |
| 163 | 165 |
| 164 } // namespace video_coding | 166 } // namespace video_coding |
| 165 } // namespace webrtc | 167 } // namespace webrtc |
| 166 | 168 |
| 167 #endif // WEBRTC_MODULES_VIDEO_CODING_PACKET_BUFFER_H_ | 169 #endif // WEBRTC_MODULES_VIDEO_CODING_PACKET_BUFFER_H_ |
| OLD | NEW |