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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 | 48 |
49 virtual ~PacketBuffer(); | 49 virtual ~PacketBuffer(); |
50 | 50 |
51 // Returns true if |packet| is inserted into the packet buffer, false | 51 // Returns true if |packet| is inserted into the packet buffer, false |
52 // otherwise. The PacketBuffer will always take ownership of the | 52 // otherwise. The PacketBuffer will always take ownership of the |
53 // |packet.dataPtr| when this function is called. Made virtual for testing. | 53 // |packet.dataPtr| when this function is called. Made virtual for testing. |
54 virtual bool InsertPacket(VCMPacket* packet); | 54 virtual bool InsertPacket(VCMPacket* packet); |
55 void ClearTo(uint16_t seq_num); | 55 void ClearTo(uint16_t seq_num); |
56 void Clear(); | 56 void Clear(); |
57 | 57 |
| 58 // Timestamp (not RTP timestamp) of the last received packet/keyframe packet. |
| 59 rtc::Optional<int64_t> LastReceivedPacketMs() const; |
| 60 rtc::Optional<int64_t> LastReceivedKeyframePacketMs() const; |
| 61 |
58 int AddRef() const; | 62 int AddRef() const; |
59 int Release() const; | 63 int Release() const; |
60 | 64 |
61 protected: | 65 protected: |
62 // Both |start_buffer_size| and |max_buffer_size| must be a power of 2. | 66 // Both |start_buffer_size| and |max_buffer_size| must be a power of 2. |
63 PacketBuffer(Clock* clock, | 67 PacketBuffer(Clock* clock, |
64 size_t start_buffer_size, | 68 size_t start_buffer_size, |
65 size_t max_buffer_size, | 69 size_t max_buffer_size, |
66 OnReceivedFrameCallback* frame_callback); | 70 OnReceivedFrameCallback* frame_callback); |
67 | 71 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 // Buffer that holds the inserted packets. | 139 // Buffer that holds the inserted packets. |
136 std::vector<VCMPacket> data_buffer_ GUARDED_BY(crit_); | 140 std::vector<VCMPacket> data_buffer_ GUARDED_BY(crit_); |
137 | 141 |
138 // Buffer that holds the information about which slot that is currently in use | 142 // Buffer that holds the information about which slot that is currently in use |
139 // and information needed to determine the continuity between packets. | 143 // and information needed to determine the continuity between packets. |
140 std::vector<ContinuityInfo> sequence_buffer_ GUARDED_BY(crit_); | 144 std::vector<ContinuityInfo> sequence_buffer_ GUARDED_BY(crit_); |
141 | 145 |
142 // Called when a received frame is found. | 146 // Called when a received frame is found. |
143 OnReceivedFrameCallback* const received_frame_callback_; | 147 OnReceivedFrameCallback* const received_frame_callback_; |
144 | 148 |
| 149 // Timestamp (not RTP timestamp) of the last received packet/keyframe packet. |
| 150 rtc::Optional<int64_t> last_received_packet_ms_ GUARDED_BY(crit_); |
| 151 rtc::Optional<int64_t> last_received_keyframe_packet_ms_ GUARDED_BY(crit_); |
| 152 |
145 mutable volatile int ref_count_ = 0; | 153 mutable volatile int ref_count_ = 0; |
146 }; | 154 }; |
147 | 155 |
148 } // namespace video_coding | 156 } // namespace video_coding |
149 } // namespace webrtc | 157 } // namespace webrtc |
150 | 158 |
151 #endif // WEBRTC_MODULES_VIDEO_CODING_PACKET_BUFFER_H_ | 159 #endif // WEBRTC_MODULES_VIDEO_CODING_PACKET_BUFFER_H_ |
OLD | NEW |