OLD | NEW |
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 | 10 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 // Returns nullptr if packet is not found. | 42 // Returns nullptr if packet is not found. |
43 // |min_elapsed_time_ms| is the minimum time that must have elapsed since | 43 // |min_elapsed_time_ms| is the minimum time that must have elapsed since |
44 // the last time the packet was resent (parameter is ignored if set to zero). | 44 // the last time the packet was resent (parameter is ignored if set to zero). |
45 // If the packet is found but the minimum time has not elapsed, returns | 45 // If the packet is found but the minimum time has not elapsed, returns |
46 // nullptr. | 46 // nullptr. |
47 std::unique_ptr<RtpPacketToSend> GetPacketAndSetSendTime( | 47 std::unique_ptr<RtpPacketToSend> GetPacketAndSetSendTime( |
48 uint16_t sequence_number, | 48 uint16_t sequence_number, |
49 int64_t min_elapsed_time_ms, | 49 int64_t min_elapsed_time_ms, |
50 bool retransmit); | 50 bool retransmit); |
51 | 51 |
| 52 RTC_DEPRECATED std::unique_ptr<RtpPacketToSend> GetBestFittingPacket( |
| 53 size_t packet_size) const { |
| 54 return GetBestFittingPacket(packet_size, true); |
| 55 } |
| 56 |
52 std::unique_ptr<RtpPacketToSend> GetBestFittingPacket( | 57 std::unique_ptr<RtpPacketToSend> GetBestFittingPacket( |
53 size_t packet_size) const; | 58 size_t packet_size, |
| 59 bool include_header) const; |
54 | 60 |
55 bool HasRtpPacket(uint16_t sequence_number) const; | 61 bool HasRtpPacket(uint16_t sequence_number) const; |
56 | 62 |
57 private: | 63 private: |
58 struct StoredPacket { | 64 struct StoredPacket { |
59 uint16_t sequence_number = 0; | 65 uint16_t sequence_number = 0; |
60 int64_t send_time = 0; | 66 int64_t send_time = 0; |
61 StorageType storage_type = kDontRetransmit; | 67 StorageType storage_type = kDontRetransmit; |
62 bool has_been_retransmitted = false; | 68 bool has_been_retransmitted = false; |
63 | 69 |
64 std::unique_ptr<RtpPacketToSend> packet; | 70 std::unique_ptr<RtpPacketToSend> packet; |
65 }; | 71 }; |
66 | 72 |
67 std::unique_ptr<RtpPacketToSend> GetPacket(int index) const | 73 std::unique_ptr<RtpPacketToSend> GetPacket(int index) const |
68 EXCLUSIVE_LOCKS_REQUIRED(critsect_); | 74 EXCLUSIVE_LOCKS_REQUIRED(critsect_); |
69 void Allocate(size_t number_to_store) EXCLUSIVE_LOCKS_REQUIRED(critsect_); | 75 void Allocate(size_t number_to_store) EXCLUSIVE_LOCKS_REQUIRED(critsect_); |
70 void Free() EXCLUSIVE_LOCKS_REQUIRED(critsect_); | 76 void Free() EXCLUSIVE_LOCKS_REQUIRED(critsect_); |
71 bool FindSeqNum(uint16_t sequence_number, int* index) const | 77 bool FindSeqNum(uint16_t sequence_number, int* index) const |
72 EXCLUSIVE_LOCKS_REQUIRED(critsect_); | 78 EXCLUSIVE_LOCKS_REQUIRED(critsect_); |
73 int FindBestFittingPacket(size_t size) const | 79 int FindBestFittingPacket(size_t size, bool include_header) const |
74 EXCLUSIVE_LOCKS_REQUIRED(critsect_); | 80 EXCLUSIVE_LOCKS_REQUIRED(critsect_); |
75 | 81 |
76 Clock* clock_; | 82 Clock* clock_; |
77 rtc::CriticalSection critsect_; | 83 rtc::CriticalSection critsect_; |
78 bool store_ GUARDED_BY(critsect_); | 84 bool store_ GUARDED_BY(critsect_); |
79 uint32_t prev_index_ GUARDED_BY(critsect_); | 85 uint32_t prev_index_ GUARDED_BY(critsect_); |
80 std::vector<StoredPacket> stored_packets_ GUARDED_BY(critsect_); | 86 std::vector<StoredPacket> stored_packets_ GUARDED_BY(critsect_); |
81 | 87 |
82 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RtpPacketHistory); | 88 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RtpPacketHistory); |
83 }; | 89 }; |
84 } // namespace webrtc | 90 } // namespace webrtc |
85 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_PACKET_HISTORY_H_ | 91 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_PACKET_HISTORY_H_ |
OLD | NEW |