| 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 |
| 11 #ifndef WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_ESTIMATORS_REMB_H_ | 11 #ifndef WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_ESTIMATORS_REMB_H_ |
| 12 #define WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_ESTIMATORS_REMB_H_ | 12 #define WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_ESTIMATORS_REMB_H_ |
| 13 | 13 |
| 14 #include <memory> |
| 14 #include <string> | 15 #include <string> |
| 15 #include <vector> | 16 #include <vector> |
| 16 | 17 |
| 17 #include "webrtc/modules/remote_bitrate_estimator/test/bwe.h" | 18 #include "webrtc/modules/remote_bitrate_estimator/test/bwe.h" |
| 18 | 19 |
| 19 namespace webrtc { | 20 namespace webrtc { |
| 20 | 21 |
| 21 class BitrateObserver; | 22 class BitrateObserver; |
| 22 class BitrateController; | 23 class BitrateController; |
| 23 class ReceiveStatistics; | 24 class ReceiveStatistics; |
| 24 class StreamStatistician; | 25 class StreamStatistician; |
| 25 | 26 |
| 26 namespace testing { | 27 namespace testing { |
| 27 namespace bwe { | 28 namespace bwe { |
| 28 | 29 |
| 29 class RembBweSender : public BweSender { | 30 class RembBweSender : public BweSender { |
| 30 public: | 31 public: |
| 31 RembBweSender(int kbps, BitrateObserver* observer, Clock* clock); | 32 RembBweSender(int kbps, BitrateObserver* observer, Clock* clock); |
| 32 virtual ~RembBweSender(); | 33 virtual ~RembBweSender(); |
| 33 | 34 |
| 34 int GetFeedbackIntervalMs() const override; | 35 int GetFeedbackIntervalMs() const override; |
| 35 void GiveFeedback(const FeedbackPacket& feedback) override; | 36 void GiveFeedback(const FeedbackPacket& feedback) override; |
| 36 void OnPacketsSent(const Packets& packets) override {} | 37 void OnPacketsSent(const Packets& packets) override {} |
| 37 int64_t TimeUntilNextProcess() override; | 38 int64_t TimeUntilNextProcess() override; |
| 38 void Process() override; | 39 void Process() override; |
| 39 | 40 |
| 40 protected: | 41 protected: |
| 41 rtc::scoped_ptr<BitrateController> bitrate_controller_; | 42 std::unique_ptr<BitrateController> bitrate_controller_; |
| 42 rtc::scoped_ptr<RtcpBandwidthObserver> feedback_observer_; | 43 std::unique_ptr<RtcpBandwidthObserver> feedback_observer_; |
| 43 | 44 |
| 44 private: | 45 private: |
| 45 Clock* clock_; | 46 Clock* clock_; |
| 46 | 47 |
| 47 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RembBweSender); | 48 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RembBweSender); |
| 48 }; | 49 }; |
| 49 | 50 |
| 50 class RembReceiver : public BweReceiver, public RemoteBitrateObserver { | 51 class RembReceiver : public BweReceiver, public RemoteBitrateObserver { |
| 51 public: | 52 public: |
| 52 static const uint32_t kRemoteBitrateEstimatorMinBitrateBps = 30000; | 53 static const uint32_t kRemoteBitrateEstimatorMinBitrateBps = 30000; |
| 53 | 54 |
| 54 RembReceiver(int flow_id, bool plot); | 55 RembReceiver(int flow_id, bool plot); |
| 55 virtual ~RembReceiver(); | 56 virtual ~RembReceiver(); |
| 56 | 57 |
| 57 void ReceivePacket(int64_t arrival_time_ms, | 58 void ReceivePacket(int64_t arrival_time_ms, |
| 58 const MediaPacket& media_packet) override; | 59 const MediaPacket& media_packet) override; |
| 59 FeedbackPacket* GetFeedback(int64_t now_ms) override; | 60 FeedbackPacket* GetFeedback(int64_t now_ms) override; |
| 60 // Implements RemoteBitrateObserver. | 61 // Implements RemoteBitrateObserver. |
| 61 void OnReceiveBitrateChanged(const std::vector<uint32_t>& ssrcs, | 62 void OnReceiveBitrateChanged(const std::vector<uint32_t>& ssrcs, |
| 62 uint32_t bitrate) override; | 63 uint32_t bitrate) override; |
| 63 | 64 |
| 64 private: | 65 private: |
| 65 static RTCPReportBlock BuildReportBlock(StreamStatistician* statistician); | 66 static RTCPReportBlock BuildReportBlock(StreamStatistician* statistician); |
| 66 bool LatestEstimate(uint32_t* estimate_bps); | 67 bool LatestEstimate(uint32_t* estimate_bps); |
| 67 | 68 |
| 68 std::string estimate_log_prefix_; | 69 std::string estimate_log_prefix_; |
| 69 bool plot_estimate_; | 70 bool plot_estimate_; |
| 70 SimulatedClock clock_; | 71 SimulatedClock clock_; |
| 71 rtc::scoped_ptr<ReceiveStatistics> recv_stats_; | 72 std::unique_ptr<ReceiveStatistics> recv_stats_; |
| 72 int64_t latest_estimate_bps_; | 73 int64_t latest_estimate_bps_; |
| 73 int64_t last_feedback_ms_; | 74 int64_t last_feedback_ms_; |
| 74 rtc::scoped_ptr<RemoteBitrateEstimator> estimator_; | 75 std::unique_ptr<RemoteBitrateEstimator> estimator_; |
| 75 | 76 |
| 76 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RembReceiver); | 77 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RembReceiver); |
| 77 }; | 78 }; |
| 78 | 79 |
| 79 } // namespace bwe | 80 } // namespace bwe |
| 80 } // namespace testing | 81 } // namespace testing |
| 81 } // namespace webrtc | 82 } // namespace webrtc |
| 82 | 83 |
| 83 #endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_ESTIMATORS_REMB_H_ | 84 #endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_ESTIMATORS_REMB_H_ |
| OLD | NEW |