Chromium Code Reviews| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 72 // The sequence number of the packet. | 72 // The sequence number of the packet. |
| 73 uint16_t seq_num = 0; | 73 uint16_t seq_num = 0; |
| 74 | 74 |
| 75 // If this is the first packet of the frame. | 75 // If this is the first packet of the frame. |
| 76 bool frame_begin = false; | 76 bool frame_begin = false; |
| 77 | 77 |
| 78 // If this is the last packet of the frame. | 78 // If this is the last packet of the frame. |
| 79 bool frame_end = false; | 79 bool frame_end = false; |
| 80 | 80 |
| 81 // If this slot is currently used. | 81 // If this slot is currently used. |
| 82 bool used = false; | 82 bool used = false; |
|
danilchap
2016/10/07 18:25:37
seq_buffer[index].used = true <=> data_buffer[inde
danilchap
2016/10/19 09:25:10
please ack if you disagree
philipel
2016/10/19 13:08:50
seq_buffer[index].used = true <=> data_buffer[inde
| |
| 83 | 83 |
| 84 // If all its previous packets have been inserted into the packet buffer. | 84 // If all its previous packets have been inserted into the packet buffer. |
| 85 bool continuous = false; | 85 bool continuous = false; |
| 86 | 86 |
| 87 // If this packet has been used to create a frame already. | 87 // If this packet has been used to create a frame already. |
| 88 bool frame_created = false; | 88 bool frame_created = false; |
| 89 }; | 89 }; |
| 90 | 90 |
| 91 Clock* const clock_; | 91 Clock* const clock_; |
| 92 | 92 |
| 93 // Tries to expand the buffer. | 93 // Tries to expand the buffer. |
| 94 bool ExpandBufferSize() EXCLUSIVE_LOCKS_REQUIRED(crit_); | 94 bool ExpandBufferSize() EXCLUSIVE_LOCKS_REQUIRED(crit_); |
| 95 | 95 |
| 96 // Test if all previous packets has arrived for the given sequence number. | 96 // Test if all previous packets has arrived for the given sequence number. |
| 97 bool IsContinuous(uint16_t seq_num) const EXCLUSIVE_LOCKS_REQUIRED(crit_); | 97 bool PotentialNewFrame(uint16_t seq_num) const |
| 98 EXCLUSIVE_LOCKS_REQUIRED(crit_); | |
| 98 | 99 |
| 99 // Test if all packets of a frame has arrived, and if so, creates a frame. | 100 // Test if all packets of a frame has arrived, and if so, creates a frame. |
| 100 // May create multiple frames per invocation. | 101 // May create multiple frames per invocation. |
| 101 void FindFrames(uint16_t seq_num) EXCLUSIVE_LOCKS_REQUIRED(crit_); | 102 void FindFrames(uint16_t seq_num) EXCLUSIVE_LOCKS_REQUIRED(crit_); |
| 102 | 103 |
| 103 // Copy the bitstream for |frame| to |destination|. | 104 // Copy the bitstream for |frame| to |destination|. |
| 104 // Virtual for testing. | 105 // Virtual for testing. |
| 105 virtual bool GetBitstream(const RtpFrameObject& frame, uint8_t* destination); | 106 virtual bool GetBitstream(const RtpFrameObject& frame, uint8_t* destination); |
| 106 | 107 |
| 107 // Get the packet with sequence number |seq_num|. | 108 // Get the packet with sequence number |seq_num|. |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 120 | 121 |
| 121 // The fist sequence number currently in the buffer. | 122 // The fist sequence number currently in the buffer. |
| 122 uint16_t first_seq_num_ GUARDED_BY(crit_); | 123 uint16_t first_seq_num_ GUARDED_BY(crit_); |
| 123 | 124 |
| 124 // The last sequence number currently in the buffer. | 125 // The last sequence number currently in the buffer. |
| 125 uint16_t last_seq_num_ GUARDED_BY(crit_); | 126 uint16_t last_seq_num_ GUARDED_BY(crit_); |
| 126 | 127 |
| 127 // If the packet buffer has received its first packet. | 128 // If the packet buffer has received its first packet. |
| 128 bool first_packet_received_ GUARDED_BY(crit_); | 129 bool first_packet_received_ GUARDED_BY(crit_); |
| 129 | 130 |
| 131 // If the buffer is cleared to a specific packet. | |
|
danilchap
2016/10/07 18:25:37
can you write what packet it cleared to, to first_
philipel
2016/10/18 12:22:19
Done.
danilchap
2016/10/19 09:25:10
Can't see the difference.
philipel
2016/10/19 13:08:50
Double Done.
| |
| 132 bool has_cleared_to_ GUARDED_BY(crit_); | |
| 133 | |
| 130 // Buffer that holds the inserted packets. | 134 // Buffer that holds the inserted packets. |
| 131 std::vector<VCMPacket> data_buffer_ GUARDED_BY(crit_); | 135 std::vector<VCMPacket> data_buffer_ GUARDED_BY(crit_); |
| 132 | 136 |
| 133 // Buffer that holds the information about which slot that is currently in use | 137 // Buffer that holds the information about which slot that is currently in use |
| 134 // and information needed to determine the continuity between packets. | 138 // and information needed to determine the continuity between packets. |
| 135 std::vector<ContinuityInfo> sequence_buffer_ GUARDED_BY(crit_); | 139 std::vector<ContinuityInfo> sequence_buffer_ GUARDED_BY(crit_); |
| 136 | 140 |
| 137 // Called when a received frame is found. | 141 // Called when a received frame is found. |
| 138 OnReceivedFrameCallback* const received_frame_callback_; | 142 OnReceivedFrameCallback* const received_frame_callback_; |
| 139 | 143 |
| 140 mutable volatile int ref_count_ = 0; | 144 mutable volatile int ref_count_ = 0; |
| 141 }; | 145 }; |
| 142 | 146 |
| 143 } // namespace video_coding | 147 } // namespace video_coding |
| 144 } // namespace webrtc | 148 } // namespace webrtc |
| 145 | 149 |
| 146 #endif // WEBRTC_MODULES_VIDEO_CODING_PACKET_BUFFER_H_ | 150 #endif // WEBRTC_MODULES_VIDEO_CODING_PACKET_BUFFER_H_ |
| OLD | NEW |