| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 class RtpStream { | 48 class RtpStream { |
| 49 public: | 49 public: |
| 50 enum { kSendSideOffsetUs = 1000000 }; | 50 enum { kSendSideOffsetUs = 1000000 }; |
| 51 | 51 |
| 52 RtpStream(int fps, int bitrate_bps); | 52 RtpStream(int fps, int bitrate_bps); |
| 53 | 53 |
| 54 // Generates a new frame for this stream. If called too soon after the | 54 // Generates a new frame for this stream. If called too soon after the |
| 55 // previous frame, no frame will be generated. The frame is split into | 55 // previous frame, no frame will be generated. The frame is split into |
| 56 // packets. | 56 // packets. |
| 57 int64_t GenerateFrame(int64_t time_now_us, std::vector<PacketInfo>* packets); | 57 int64_t GenerateFrame(int64_t time_now_us, |
| 58 std::vector<PacketFeedback>* packets); |
| 58 | 59 |
| 59 // The send-side time when the next frame can be generated. | 60 // The send-side time when the next frame can be generated. |
| 60 int64_t next_rtp_time() const; | 61 int64_t next_rtp_time() const; |
| 61 | 62 |
| 62 void set_bitrate_bps(int bitrate_bps); | 63 void set_bitrate_bps(int bitrate_bps); |
| 63 | 64 |
| 64 int bitrate_bps() const; | 65 int bitrate_bps() const; |
| 65 | 66 |
| 66 static bool Compare(const std::unique_ptr<RtpStream>& lhs, | 67 static bool Compare(const std::unique_ptr<RtpStream>& lhs, |
| 67 const std::unique_ptr<RtpStream>& rhs); | 68 const std::unique_ptr<RtpStream>& rhs); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 87 | 88 |
| 88 // Divides |bitrate_bps| among all streams. The allocated bitrate per stream | 89 // Divides |bitrate_bps| among all streams. The allocated bitrate per stream |
| 89 // is decided by the initial allocation ratios. | 90 // is decided by the initial allocation ratios. |
| 90 void SetBitrateBps(int bitrate_bps); | 91 void SetBitrateBps(int bitrate_bps); |
| 91 | 92 |
| 92 // Set the RTP timestamp offset for the stream identified by |ssrc|. | 93 // Set the RTP timestamp offset for the stream identified by |ssrc|. |
| 93 void set_rtp_timestamp_offset(uint32_t ssrc, uint32_t offset); | 94 void set_rtp_timestamp_offset(uint32_t ssrc, uint32_t offset); |
| 94 | 95 |
| 95 // TODO(holmer): Break out the channel simulation part from this class to make | 96 // TODO(holmer): Break out the channel simulation part from this class to make |
| 96 // it possible to simulate different types of channels. | 97 // it possible to simulate different types of channels. |
| 97 int64_t GenerateFrame(std::vector<PacketInfo>* packets, int64_t time_now_us); | 98 int64_t GenerateFrame(std::vector<PacketFeedback>* packets, |
| 99 int64_t time_now_us); |
| 98 | 100 |
| 99 private: | 101 private: |
| 100 // Capacity of the simulated channel in bits per second. | 102 // Capacity of the simulated channel in bits per second. |
| 101 int capacity_; | 103 int capacity_; |
| 102 // The time when the last packet arrived. | 104 // The time when the last packet arrived. |
| 103 int64_t prev_arrival_time_us_; | 105 int64_t prev_arrival_time_us_; |
| 104 // All streams being transmitted on this simulated channel. | 106 // All streams being transmitted on this simulated channel. |
| 105 std::vector<std::unique_ptr<RtpStream>> streams_; | 107 std::vector<std::unique_ptr<RtpStream>> streams_; |
| 106 | 108 |
| 107 RTC_DISALLOW_COPY_AND_ASSIGN(StreamGenerator); | 109 RTC_DISALLOW_COPY_AND_ASSIGN(StreamGenerator); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 std::unique_ptr<DelayBasedBwe> bitrate_estimator_; | 167 std::unique_ptr<DelayBasedBwe> bitrate_estimator_; |
| 166 std::unique_ptr<test::StreamGenerator> stream_generator_; | 168 std::unique_ptr<test::StreamGenerator> stream_generator_; |
| 167 int64_t arrival_time_offset_ms_; | 169 int64_t arrival_time_offset_ms_; |
| 168 bool first_update_; | 170 bool first_update_; |
| 169 | 171 |
| 170 RTC_DISALLOW_COPY_AND_ASSIGN(DelayBasedBweTest); | 172 RTC_DISALLOW_COPY_AND_ASSIGN(DelayBasedBweTest); |
| 171 }; | 173 }; |
| 172 } // namespace webrtc | 174 } // namespace webrtc |
| 173 | 175 |
| 174 #endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_DELAY_BASED_BWE_UNITTEST_HELPER_
H_ | 176 #endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_DELAY_BASED_BWE_UNITTEST_HELPER_
H_ |
| OLD | NEW |