17959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org/* 27959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 37959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org * 47959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org * Use of this source code is governed by a BSD-style license 57959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org * that can be found in the LICENSE file in the root of the source 67959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org * tree. An additional intellectual property rights grant can be found 77959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org * in the file PATENTS. All contributing project authors may 87959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org * be found in the AUTHORS file in the root of the source tree. 97959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org */ 107959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org 1148ed930975ef7e84023044ed584c4eff914e6c9ahenrik.lundin#ifndef WEBRTC_MODULES_AUDIO_CODING_NETEQ_NACK_H_ 1248ed930975ef7e84023044ed584c4eff914e6c9ahenrik.lundin#define WEBRTC_MODULES_AUDIO_CODING_NETEQ_NACK_H_ 137959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org 147959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org#include <vector> 157959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org#include <map> 167959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org 1700b8f6b3643332cce1ee711715f7fbb824d793cakwiberg@webrtc.org#include "webrtc/base/scoped_ptr.h" 183e6db2321ccdc8738c9cecbe9bdab13d4f0f658dkjellander#include "webrtc/modules/audio_coding/include/audio_coding_module_typedefs.h" 197959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org#include "webrtc/test/testsupport/gtest_prod_util.h" 207959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org 217959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org// 227959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org// The Nack class keeps track of the lost packets, an estimate of time-to-play 237959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org// for each packet is also given. 247959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org// 257959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org// Every time a packet is pushed into NetEq, LastReceivedPacket() has to be 267959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org// called to update the NACK list. 277959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org// 287959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org// Every time 10ms audio is pulled from NetEq LastDecodedPacket() should be 297959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org// called, and time-to-play is updated at that moment. 307959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org// 317959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org// If packet N is received, any packet prior to |N - NackThreshold| which is not 327959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org// arrived is considered lost, and should be labeled as "missing" (the size of 337959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org// the list might be limited and older packet eliminated from the list). Packets 347959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org// |N - NackThreshold|, |N - NackThreshold + 1|, ..., |N - 1| are considered 357959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org// "late." A "late" packet with sequence number K is changed to "missing" any 367959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org// time a packet with sequence number newer than |K + NackList| is arrived. 377959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org// 387959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org// The Nack class has to know about the sample rate of the packets to compute 397959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org// time-to-play. So sample rate should be set as soon as the first packet is 407959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org// received. If there is a change in the receive codec (sender changes codec) 417959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org// then Nack should be reset. This is because NetEQ would flush its buffer and 427959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org// re-transmission is meaning less for old packet. Therefore, in that case, 437959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org// after reset the sampling rate has to be updated. 447959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org// 457959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org// Thread Safety 467959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org// ============= 477959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org// Please note that this class in not thread safe. The class must be protected 487959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org// if different APIs are called from different threads. 497959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org// 507959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.orgnamespace webrtc { 517959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org 527959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.orgclass Nack { 537959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org public: 547959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // A limit for the size of the NACK list. 557959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org static const size_t kNackListSizeLimit = 500; // 10 seconds for 20 ms frame 567959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // packets. 577959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // Factory method. 587959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org static Nack* Create(int nack_threshold_packets); 597959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org 602519c45d00a5bd9b91930b74b35afb7d4b5bcbefKarl Wiberg ~Nack(); 617959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org 627959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // Set a maximum for the size of the NACK list. If the last received packet 637959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // has sequence number of N, then NACK list will not contain any element 647959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // with sequence number earlier than N - |max_nack_list_size|. 657959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // 667959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // The largest maximum size is defined by |kNackListSizeLimit| 6748ed930975ef7e84023044ed584c4eff914e6c9ahenrik.lundin void SetMaxNackListSize(size_t max_nack_list_size); 687959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org 697959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // Set the sampling rate. 707959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // 717959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // If associated sampling rate of the received packets is changed, call this 727959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // function to update sampling rate. Note that if there is any change in 737959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // received codec then NetEq will flush its buffer and NACK has to be reset. 747959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // After Reset() is called sampling rate has to be set. 757959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org void UpdateSampleRate(int sample_rate_hz); 767959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org 777959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // Update the sequence number and the timestamp of the last decoded RTP. This 787959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // API should be called every time 10 ms audio is pulled from NetEq. 797959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org void UpdateLastDecodedPacket(uint16_t sequence_number, uint32_t timestamp); 807959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org 817959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // Update the sequence number and the timestamp of the last received RTP. This 827959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // API should be called every time a packet pushed into ACM. 837959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org void UpdateLastReceivedPacket(uint16_t sequence_number, uint32_t timestamp); 847959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org 857959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // Get a list of "missing" packets which have expected time-to-play larger 867959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // than the given round-trip-time (in milliseconds). 877959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // Note: Late packets are not included. 8816825b1a828bb4ff40f7682040e43a239b7b8ca3pkasting@chromium.org std::vector<uint16_t> GetNackList(int64_t round_trip_time_ms) const; 897959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org 907959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // Reset to default values. The NACK list is cleared. 917959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // |nack_threshold_packets_| & |max_nack_list_size_| preserve their values. 927959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org void Reset(); 937959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org 947959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org private: 957959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // This test need to access the private method GetNackList(). 967959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org FRIEND_TEST_ALL_PREFIXES(NackTest, EstimateTimestampAndTimeToPlay); 977959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org 987959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org struct NackElement { 9916825b1a828bb4ff40f7682040e43a239b7b8ca3pkasting@chromium.org NackElement(int64_t initial_time_to_play_ms, 1007959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org uint32_t initial_timestamp, 1017959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org bool missing) 1027959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org : time_to_play_ms(initial_time_to_play_ms), 1037959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org estimated_timestamp(initial_timestamp), 1047959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org is_missing(missing) {} 1057959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org 1067959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // Estimated time (ms) left for this packet to be decoded. This estimate is 1077959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // updated every time jitter buffer decodes a packet. 10816825b1a828bb4ff40f7682040e43a239b7b8ca3pkasting@chromium.org int64_t time_to_play_ms; 1097959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org 1107959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // A guess about the timestamp of the missing packet, it is used for 1117959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // estimation of |time_to_play_ms|. The estimate might be slightly wrong if 1127959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // there has been frame-size change since the last received packet and the 1137959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // missing packet. However, the risk of this is low, and in case of such 1147959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // errors, there will be a minor misestimation in time-to-play of missing 1157959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // packets. This will have a very minor effect on NACK performance. 1167959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org uint32_t estimated_timestamp; 1177959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org 1187959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // True if the packet is considered missing. Otherwise indicates packet is 1197959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // late. 1207959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org bool is_missing; 1217959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org }; 1227959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org 1237959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org class NackListCompare { 1247959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org public: 12548ed930975ef7e84023044ed584c4eff914e6c9ahenrik.lundin bool operator()(uint16_t sequence_number_old, 12648ed930975ef7e84023044ed584c4eff914e6c9ahenrik.lundin uint16_t sequence_number_new) const { 1277959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org return IsNewerSequenceNumber(sequence_number_new, sequence_number_old); 1287959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org } 1297959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org }; 1307959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org 1317959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org typedef std::map<uint16_t, NackElement, NackListCompare> NackList; 1327959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org 1337959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // Constructor. 1347959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org explicit Nack(int nack_threshold_packets); 1357959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org 1367959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // This API is used only for testing to assess whether time-to-play is 1377959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // computed correctly. 1387959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org NackList GetNackList() const; 1397959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org 1407959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // Given the |sequence_number_current_received_rtp| of currently received RTP, 1417959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // recognize packets which are not arrive and add to the list. 1427959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org void AddToList(uint16_t sequence_number_current_received_rtp); 1437959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org 1447959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // This function subtracts 10 ms of time-to-play for all packets in NACK list. 1457959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // This is called when 10 ms elapsed with no new RTP packet decoded. 1467959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org void UpdateEstimatedPlayoutTimeBy10ms(); 1477959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org 1487959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // Given the |sequence_number_current_received_rtp| and 1497959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // |timestamp_current_received_rtp| of currently received RTP update number 1507959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // of samples per packet. 1517959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org void UpdateSamplesPerPacket(uint16_t sequence_number_current_received_rtp, 1527959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org uint32_t timestamp_current_received_rtp); 1537959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org 1547959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // Given the |sequence_number_current_received_rtp| of currently received RTP 1557959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // update the list. That is; some packets will change from late to missing, 1567959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // some packets are inserted as missing and some inserted as late. 1577959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org void UpdateList(uint16_t sequence_number_current_received_rtp); 1587959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org 1597959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // Packets which are considered late for too long (according to 1607959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // |nack_threshold_packets_|) are flagged as missing. 1617959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org void ChangeFromLateToMissing(uint16_t sequence_number_current_received_rtp); 1627959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org 1637959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // Packets which have sequence number older that 1647959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // |sequence_num_last_received_rtp_| - |max_nack_list_size_| are removed 1657959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // from the NACK list. 1667959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org void LimitNackListSize(); 1677959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org 1687959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // Estimate timestamp of a missing packet given its sequence number. 1697959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org uint32_t EstimateTimestamp(uint16_t sequence_number); 1707959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org 1717959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // Compute time-to-play given a timestamp. 17216825b1a828bb4ff40f7682040e43a239b7b8ca3pkasting@chromium.org int64_t TimeToPlay(uint32_t timestamp) const; 1737959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org 1747959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // If packet N is arrived, any packet prior to N - |nack_threshold_packets_| 1757959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // which is not arrived is considered missing, and should be in NACK list. 1767959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // Also any packet in the range of N-1 and N - |nack_threshold_packets_|, 1777959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // exclusive, which is not arrived is considered late, and should should be 1787959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // in the list of late packets. 1797959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org const int nack_threshold_packets_; 1807959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org 1817959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // Valid if a packet is received. 1827959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org uint16_t sequence_num_last_received_rtp_; 1837959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org uint32_t timestamp_last_received_rtp_; 1847959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org bool any_rtp_received_; // If any packet received. 1857959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org 1867959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // Valid if a packet is decoded. 1877959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org uint16_t sequence_num_last_decoded_rtp_; 1887959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org uint32_t timestamp_last_decoded_rtp_; 1897959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org bool any_rtp_decoded_; // If any packet decoded. 1907959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org 1917959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org int sample_rate_khz_; // Sample rate in kHz. 1927959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org 1937959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // Number of samples per packet. We update this every time we receive a 1947959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // packet, not only for consecutive packets. 1957959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org int samples_per_packet_; 1967959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org 1977959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // A list of missing packets to be retransmitted. Components of the list 1987959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // contain the sequence number of missing packets and the estimated time that 1997959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // each pack is going to be played out. 2007959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org NackList nack_list_; 2017959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org 2027959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // NACK list will not keep track of missing packets prior to 2037959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org // |sequence_num_last_received_rtp_| - |max_nack_list_size_|. 2047959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org size_t max_nack_list_size_; 2057959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org}; 2067959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org 2077959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org} // namespace webrtc 2087959e16cc2da9ebf5eda61bdf0eb423d8d3006baturaj@webrtc.org 20948ed930975ef7e84023044ed584c4eff914e6c9ahenrik.lundin#endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_NACK_H_ 210