OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 25 matching lines...) Expand all Loading... |
36 virtual int flow_id() const { return flow_id_; } | 36 virtual int flow_id() const { return flow_id_; } |
37 virtual int64_t creation_time_us() const { return creation_time_us_; } | 37 virtual int64_t creation_time_us() const { return creation_time_us_; } |
38 virtual void set_send_time_us(int64_t send_time_us); | 38 virtual void set_send_time_us(int64_t send_time_us); |
39 virtual int64_t send_time_us() const { return send_time_us_; } | 39 virtual int64_t send_time_us() const { return send_time_us_; } |
40 virtual size_t payload_size() const { return payload_size_; } | 40 virtual size_t payload_size() const { return payload_size_; } |
41 virtual Packet::Type GetPacketType() const = 0; | 41 virtual Packet::Type GetPacketType() const = 0; |
42 void set_sender_timestamp_us(int64_t sender_timestamp_us) { | 42 void set_sender_timestamp_us(int64_t sender_timestamp_us) { |
43 sender_timestamp_us_ = sender_timestamp_us; | 43 sender_timestamp_us_ = sender_timestamp_us; |
44 } | 44 } |
45 int64_t sender_timestamp_us() const { return sender_timestamp_us_; } | 45 int64_t sender_timestamp_us() const { return sender_timestamp_us_; } |
| 46 void set_sending_estimate_kbps(uint32_t sending_estimate_kbps); |
| 47 uint32_t get_sending_estimate_kbps() const { return sending_estimate_kbps_; } |
| 48 void set_total_capacity_kbps(uint32_t total_capacity_kbps); |
| 49 uint32_t get_total_capacity_kbps() const { return total_capacity_kbps_; } |
| 50 void set_capacity_per_flow_kbps(uint32_t capacity_per_flow_kbps); |
| 51 uint32_t get_capacity_per_flow_kbps() const { |
| 52 return capacity_per_flow_kbps_; |
| 53 } |
46 | 54 |
47 protected: | 55 protected: |
48 int flow_id_; | 56 int flow_id_; |
49 int64_t creation_time_us_; // Time when the packet was created. | 57 int64_t creation_time_us_; // Time when the packet was created. |
50 int64_t send_time_us_; // Time the packet left last processor touching it. | 58 int64_t send_time_us_; // Time the packet left last processor touching it. |
51 int64_t sender_timestamp_us_; // Time the packet left the Sender. | 59 int64_t sender_timestamp_us_; // Time the packet left the Sender. |
52 size_t payload_size_; // Size of the (non-existent, simulated) payload. | 60 size_t payload_size_; // Size of the (non-existent, simulated) payload. |
| 61 uint32_t sending_estimate_kbps_; // Transmit bitrate estimate to receiver. |
| 62 // Transmit available capacity to receiver. |
| 63 uint32_t total_capacity_kbps_; |
| 64 uint32_t capacity_per_flow_kbps_; |
53 }; | 65 }; |
54 | 66 |
55 class MediaPacket : public Packet { | 67 class MediaPacket : public Packet { |
56 public: | 68 public: |
57 MediaPacket(); | 69 MediaPacket(); |
58 MediaPacket(int flow_id, | 70 MediaPacket(int flow_id, |
59 int64_t send_time_us, | 71 int64_t send_time_us, |
60 size_t payload_size, | 72 size_t payload_size, |
61 uint16_t sequence_number); | 73 uint16_t sequence_number); |
62 MediaPacket(int flow_id, | 74 MediaPacket(int flow_id, |
63 int64_t send_time_us, | 75 int64_t send_time_us, |
64 size_t payload_size, | 76 size_t payload_size, |
65 const RTPHeader& header); | 77 const RTPHeader& header); |
66 MediaPacket(int64_t send_time_us, uint32_t sequence_number); | 78 MediaPacket(int64_t send_time_us, uint32_t sequence_number); |
| 79 |
67 virtual ~MediaPacket() {} | 80 virtual ~MediaPacket() {} |
68 | 81 |
69 int64_t GetAbsSendTimeInMs() const { | 82 int64_t GetAbsSendTimeInMs() const { |
70 int64_t timestamp = header_.extension.absoluteSendTime | 83 int64_t timestamp = header_.extension.absoluteSendTime |
71 << kAbsSendTimeInterArrivalUpshift; | 84 << kAbsSendTimeInterArrivalUpshift; |
72 return 1000.0 * timestamp / static_cast<double>(1 << kInterArrivalShift); | 85 return 1000.0 * timestamp / static_cast<double>(1 << kInterArrivalShift); |
73 } | 86 } |
74 void SetAbsSendTimeMs(int64_t abs_send_time_ms); | 87 void SetAbsSendTimeMs(int64_t abs_send_time_ms); |
75 const RTPHeader& header() const { return header_; } | 88 const RTPHeader& header() const { return header_; } |
76 virtual Packet::Type GetPacketType() const { return kMedia; } | 89 virtual Packet::Type GetPacketType() const { return kMedia; } |
(...skipping 15 matching lines...) Expand all Loading... |
92 int64_t this_send_time_us, | 105 int64_t this_send_time_us, |
93 int64_t latest_send_time_ms) | 106 int64_t latest_send_time_ms) |
94 : Packet(flow_id, this_send_time_us, 0), | 107 : Packet(flow_id, this_send_time_us, 0), |
95 latest_send_time_ms_(latest_send_time_ms) {} | 108 latest_send_time_ms_(latest_send_time_ms) {} |
96 virtual ~FeedbackPacket() {} | 109 virtual ~FeedbackPacket() {} |
97 | 110 |
98 virtual Packet::Type GetPacketType() const { return kFeedback; } | 111 virtual Packet::Type GetPacketType() const { return kFeedback; } |
99 int64_t latest_send_time_ms() const { return latest_send_time_ms_; } | 112 int64_t latest_send_time_ms() const { return latest_send_time_ms_; } |
100 | 113 |
101 private: | 114 private: |
102 int64_t latest_send_time_ms_; // Time stamp for the latest sent packet. | 115 int64_t latest_send_time_ms_; // Time stamp for the latest sent FbPacket. |
103 }; | 116 }; |
104 | 117 |
105 class RembFeedback : public FeedbackPacket { | 118 class RembFeedback : public FeedbackPacket { |
106 public: | 119 public: |
107 RembFeedback(int flow_id, | 120 RembFeedback(int flow_id, |
108 int64_t send_time_us, | 121 int64_t send_time_us, |
109 int64_t latest_send_time_ms, | 122 int64_t latest_send_time_ms, |
110 uint32_t estimated_bps, | 123 uint32_t estimated_bps, |
111 RTCPReportBlock report_block); | 124 RTCPReportBlock report_block); |
112 virtual ~RembFeedback() {} | 125 virtual ~RembFeedback() {} |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 }; | 200 }; |
188 | 201 |
189 typedef std::list<Packet*> Packets; | 202 typedef std::list<Packet*> Packets; |
190 typedef std::list<Packet*>::iterator PacketsIt; | 203 typedef std::list<Packet*>::iterator PacketsIt; |
191 typedef std::list<Packet*>::const_iterator PacketsConstIt; | 204 typedef std::list<Packet*>::const_iterator PacketsConstIt; |
192 | 205 |
193 } // namespace bwe | 206 } // namespace bwe |
194 } // namespace testing | 207 } // namespace testing |
195 } // namespace webrtc | 208 } // namespace webrtc |
196 #endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_PACKET_H_ | 209 #endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_PACKET_H_ |
OLD | NEW |