| Index: webrtc/modules/rtp_rtcp/source/rtp_packet_history.h
|
| diff --git a/webrtc/modules/rtp_rtcp/source/rtp_packet_history.h b/webrtc/modules/rtp_rtcp/source/rtp_packet_history.h
|
| index b4d48aa2ced33d46d27049e818eea898b01007b1..c4c868c66f5c00aa0a0e9cd9c874a86919d21460 100644
|
| --- a/webrtc/modules/rtp_rtcp/source/rtp_packet_history.h
|
| +++ b/webrtc/modules/rtp_rtcp/source/rtp_packet_history.h
|
| @@ -13,6 +13,7 @@
|
| #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_PACKET_HISTORY_H_
|
| #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_PACKET_HISTORY_H_
|
|
|
| +#include <memory>
|
| #include <vector>
|
|
|
| #include "webrtc/base/criticalsection.h"
|
| @@ -24,6 +25,7 @@
|
| namespace webrtc {
|
|
|
| class Clock;
|
| +class RtpPacketToSend;
|
|
|
| static const size_t kMaxHistoryCapacity = 9600;
|
|
|
| @@ -32,15 +34,12 @@ class RTPPacketHistory {
|
| explicit RTPPacketHistory(Clock* clock);
|
| ~RTPPacketHistory();
|
|
|
| - void SetStorePacketsStatus(bool enable, uint16_t number_to_store);
|
| -
|
| + void SetStoreSize(uint16_t number_to_store);
|
| bool StorePackets() const;
|
|
|
| // Stores RTP packet.
|
| - int32_t PutRTPPacket(const uint8_t* packet,
|
| - size_t packet_length,
|
| - int64_t capture_time_ms,
|
| - StorageType type);
|
| + RtpPacketToSend* PutRtpPacket(std::unique_ptr<RtpPacketToSend>* packet,
|
| + StorageType type);
|
|
|
| // Gets stored RTP packet corresponding to the input sequence number.
|
| // The packet is copied to the buffer pointed to by ptr_rtp_packet.
|
| @@ -52,52 +51,38 @@ class RTPPacketHistory {
|
| // If the packet is found but the minimum time has not elapsed, no bytes are
|
| // copied.
|
| // stored_time_ms: returns the time when the packet was stored.
|
| - bool GetPacketAndSetSendTime(uint16_t sequence_number,
|
| - int64_t min_elapsed_time_ms,
|
| - bool retransmit,
|
| - uint8_t* packet,
|
| - size_t* packet_length,
|
| - int64_t* stored_time_ms);
|
| + RtpPacketToSend* GetPacket(uint16_t sequence_number,
|
| + int64_t min_elapsed_time_ms,
|
| + bool retransmit);
|
|
|
| - bool GetBestFittingPacket(uint8_t* packet, size_t* packet_length,
|
| - int64_t* stored_time_ms);
|
| + RtpPacketToSend* GetBestFittingPacket(size_t packet_length);
|
|
|
| bool HasRTPPacket(uint16_t sequence_number) const;
|
|
|
| - bool SetSent(uint16_t sequence_number);
|
| -
|
| private:
|
| - void GetPacket(int index,
|
| - uint8_t* packet,
|
| - size_t* packet_length,
|
| - int64_t* stored_time_ms) const
|
| + struct StoredPacket {
|
| + std::unique_ptr<RtpPacketToSend> packet;
|
| + uint16_t sequence_number = 0;
|
| + StorageType storage_type = kDontRetransmit;
|
| + bool has_been_retransmitted = false;
|
| + };
|
| +
|
| + RtpPacketToSend* StorePacket(std::unique_ptr<RtpPacketToSend> packet,
|
| + StorageType type)
|
| EXCLUSIVE_LOCKS_REQUIRED(critsect_);
|
| void Allocate(size_t number_to_store) EXCLUSIVE_LOCKS_REQUIRED(critsect_);
|
| void Free() EXCLUSIVE_LOCKS_REQUIRED(critsect_);
|
| void VerifyAndAllocatePacketLength(size_t packet_length, uint32_t start_index)
|
| EXCLUSIVE_LOCKS_REQUIRED(critsect_);
|
| - bool FindSeqNum(uint16_t sequence_number, int32_t* index) const
|
| + bool FindSeqNum(uint16_t sequence_number, size_t* index) const
|
| EXCLUSIVE_LOCKS_REQUIRED(critsect_);
|
| int FindBestFittingPacket(size_t size) const
|
| EXCLUSIVE_LOCKS_REQUIRED(critsect_);
|
|
|
| - private:
|
| Clock* clock_;
|
| rtc::CriticalSection critsect_;
|
| - bool store_ GUARDED_BY(critsect_);
|
| uint32_t prev_index_ GUARDED_BY(critsect_);
|
|
|
| - struct StoredPacket {
|
| - StoredPacket();
|
| - uint16_t sequence_number = 0;
|
| - int64_t time_ms = 0;
|
| - int64_t send_time = 0;
|
| - StorageType storage_type = kDontRetransmit;
|
| - bool has_been_retransmitted = false;
|
| -
|
| - uint8_t data[IP_PACKET_SIZE];
|
| - size_t length = 0;
|
| - };
|
| std::vector<StoredPacket> stored_packets_ GUARDED_BY(critsect_);
|
| };
|
| } // namespace webrtc
|
|
|