mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-15 06:40:43 +01:00
Removed GetPacingFactor from PacedSender.
GetPacingFactor exposed internal details that should not be relied upon. In a later CL theese won't be available any more, this CL is in preparation for that change. The only usage was in video send stream tests. To keep the tests working, they now access the internal video send stream directly. The test code retrieves an optional that indicates whether the send stream has overridden the pacing factor. This means the implementation dependency between video send stream and video send stream tests is increased. This is an improvement compared to depending on the paced sender implementation. Bug: webrtc:8415 Change-Id: Id357553692b3ff3283fa3b64da1b1ebb3c97f04d Reviewed-on: https://webrtc-review.googlesource.com/39265 Reviewed-by: Philip Eliasson <philipel@webrtc.org> Reviewed-by: Erik Språng <sprang@webrtc.org> Commit-Queue: Sebastian Jansson <srte@webrtc.org> Cr-Commit-Position: refs/heads/master@{#21675}
This commit is contained in:
parent
2ffe3e80db
commit
a45c8da852
5 changed files with 93 additions and 68 deletions
|
@ -383,11 +383,6 @@ void PacedSender::SetPacingFactor(float pacing_factor) {
|
||||||
SetEstimatedBitrate(estimated_bitrate_bps_);
|
SetEstimatedBitrate(estimated_bitrate_bps_);
|
||||||
}
|
}
|
||||||
|
|
||||||
float PacedSender::GetPacingFactor() const {
|
|
||||||
rtc::CritScope cs(&critsect_);
|
|
||||||
return pacing_factor_;
|
|
||||||
}
|
|
||||||
|
|
||||||
void PacedSender::SetQueueTimeLimit(int limit_ms) {
|
void PacedSender::SetQueueTimeLimit(int limit_ms) {
|
||||||
rtc::CritScope cs(&critsect_);
|
rtc::CritScope cs(&critsect_);
|
||||||
queue_time_limit = limit_ms;
|
queue_time_limit = limit_ms;
|
||||||
|
|
|
@ -149,7 +149,6 @@ class PacedSender : public Pacer {
|
||||||
// Called when the prober is associated with a process thread.
|
// Called when the prober is associated with a process thread.
|
||||||
void ProcessThreadAttached(ProcessThread* process_thread) override;
|
void ProcessThreadAttached(ProcessThread* process_thread) override;
|
||||||
void SetPacingFactor(float pacing_factor);
|
void SetPacingFactor(float pacing_factor);
|
||||||
float GetPacingFactor() const;
|
|
||||||
void SetQueueTimeLimit(int limit_ms);
|
void SetQueueTimeLimit(int limit_ms);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -284,6 +284,8 @@ class VideoSendStreamImpl : public webrtc::BitrateAllocatorObserver,
|
||||||
|
|
||||||
void SetTransportOverhead(size_t transport_overhead_per_packet);
|
void SetTransportOverhead(size_t transport_overhead_per_packet);
|
||||||
|
|
||||||
|
rtc::Optional<float> configured_pacing_factor_;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class CheckEncoderActivityTask;
|
class CheckEncoderActivityTask;
|
||||||
class EncoderReconfiguredTask;
|
class EncoderReconfiguredTask;
|
||||||
|
@ -645,6 +647,10 @@ VideoSendStream::Stats VideoSendStream::GetStats() {
|
||||||
return stats_proxy_.GetStats();
|
return stats_proxy_.GetStats();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rtc::Optional<float> VideoSendStream::GetPacingFactorOverride() const {
|
||||||
|
return send_stream_->configured_pacing_factor_;
|
||||||
|
}
|
||||||
|
|
||||||
void VideoSendStream::SignalNetworkState(NetworkState state) {
|
void VideoSendStream::SignalNetworkState(NetworkState state) {
|
||||||
RTC_DCHECK_RUN_ON(&thread_checker_);
|
RTC_DCHECK_RUN_ON(&thread_checker_);
|
||||||
VideoSendStreamImpl* send_stream = send_stream_.get();
|
VideoSendStreamImpl* send_stream = send_stream_.get();
|
||||||
|
@ -770,6 +776,7 @@ VideoSendStreamImpl::VideoSendStreamImpl(
|
||||||
if (alr_settings) {
|
if (alr_settings) {
|
||||||
transport->send_side_cc()->EnablePeriodicAlrProbing(true);
|
transport->send_side_cc()->EnablePeriodicAlrProbing(true);
|
||||||
transport->pacer()->SetPacingFactor(alr_settings->pacing_factor);
|
transport->pacer()->SetPacingFactor(alr_settings->pacing_factor);
|
||||||
|
configured_pacing_factor_ = alr_settings->pacing_factor;
|
||||||
transport->pacer()->SetQueueTimeLimit(alr_settings->max_paced_queue_time);
|
transport->pacer()->SetQueueTimeLimit(alr_settings->max_paced_queue_time);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,9 @@
|
||||||
#include "video/video_stream_encoder.h"
|
#include "video/video_stream_encoder.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
namespace test {
|
||||||
|
class VideoSendStreamPeer;
|
||||||
|
} // namespace test
|
||||||
|
|
||||||
class CallStats;
|
class CallStats;
|
||||||
class SendSideCongestionController;
|
class SendSideCongestionController;
|
||||||
|
@ -95,9 +98,13 @@ class VideoSendStream : public webrtc::VideoSendStream {
|
||||||
void SetTransportOverhead(size_t transport_overhead_per_packet);
|
void SetTransportOverhead(size_t transport_overhead_per_packet);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
friend class test::VideoSendStreamPeer;
|
||||||
|
|
||||||
class ConstructionTask;
|
class ConstructionTask;
|
||||||
class DestructAndGetRtpStateTask;
|
class DestructAndGetRtpStateTask;
|
||||||
|
|
||||||
|
rtc::Optional<float> GetPacingFactorOverride() const;
|
||||||
|
|
||||||
rtc::ThreadChecker thread_checker_;
|
rtc::ThreadChecker thread_checker_;
|
||||||
rtc::TaskQueue* const worker_queue_;
|
rtc::TaskQueue* const worker_queue_;
|
||||||
rtc::Event thread_sync_event_;
|
rtc::Event thread_sync_event_;
|
||||||
|
|
|
@ -43,11 +43,26 @@
|
||||||
#include "test/rtcp_packet_parser.h"
|
#include "test/rtcp_packet_parser.h"
|
||||||
#include "test/testsupport/perf_test.h"
|
#include "test/testsupport/perf_test.h"
|
||||||
|
|
||||||
|
#include "call/video_send_stream.h"
|
||||||
#include "video/send_statistics_proxy.h"
|
#include "video/send_statistics_proxy.h"
|
||||||
#include "video/transport_adapter.h"
|
#include "video/transport_adapter.h"
|
||||||
#include "call/video_send_stream.h"
|
#include "video/video_send_stream.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
namespace test {
|
||||||
|
class VideoSendStreamPeer {
|
||||||
|
public:
|
||||||
|
explicit VideoSendStreamPeer(webrtc::VideoSendStream* base_class_stream)
|
||||||
|
: internal_stream_(
|
||||||
|
static_cast<internal::VideoSendStream*>(base_class_stream)) {}
|
||||||
|
rtc::Optional<float> GetPacingFactorOverride() const {
|
||||||
|
return internal_stream_->GetPacingFactorOverride();
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
internal::VideoSendStream const* const internal_stream_;
|
||||||
|
};
|
||||||
|
} // namespace test
|
||||||
|
|
||||||
enum VideoFormat { kGeneric, kVP8, };
|
enum VideoFormat { kGeneric, kVP8, };
|
||||||
|
|
||||||
|
@ -3539,18 +3554,13 @@ TEST_F(VideoSendStreamTest, SendsKeepAlive) {
|
||||||
RunBaseTest(&test);
|
RunBaseTest(&test);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(VideoSendStreamTest, ConfiguresAlrWhenSendSideOn) {
|
|
||||||
const std::string kAlrProbingExperiment =
|
|
||||||
std::string(AlrExperimentSettings::kScreenshareProbingBweExperimentName) +
|
|
||||||
"/1.0,2875,80,40,-60,3/";
|
|
||||||
test::ScopedFieldTrials alr_experiment(kAlrProbingExperiment);
|
|
||||||
class PacingFactorObserver : public test::SendTest {
|
class PacingFactorObserver : public test::SendTest {
|
||||||
public:
|
public:
|
||||||
PacingFactorObserver(bool configure_send_side, float expected_pacing_factor)
|
PacingFactorObserver(bool configure_send_side,
|
||||||
: test::SendTest(kDefaultTimeoutMs),
|
rtc::Optional<float> expected_pacing_factor)
|
||||||
|
: test::SendTest(VideoSendStreamTest::kDefaultTimeoutMs),
|
||||||
configure_send_side_(configure_send_side),
|
configure_send_side_(configure_send_side),
|
||||||
expected_pacing_factor_(expected_pacing_factor),
|
expected_pacing_factor_(expected_pacing_factor) {}
|
||||||
paced_sender_(nullptr) {}
|
|
||||||
|
|
||||||
void ModifyVideoConfigs(
|
void ModifyVideoConfigs(
|
||||||
VideoSendStream::Config* send_config,
|
VideoSendStream::Config* send_config,
|
||||||
|
@ -3582,37 +3592,44 @@ TEST_F(VideoSendStreamTest, ConfiguresAlrWhenSendSideOn) {
|
||||||
encoder_config->content_type = VideoEncoderConfig::ContentType::kScreen;
|
encoder_config->content_type = VideoEncoderConfig::ContentType::kScreen;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnRtpTransportControllerSendCreated(
|
|
||||||
RtpTransportControllerSend* controller) override {
|
|
||||||
// Grab a reference to the pacer.
|
|
||||||
paced_sender_ = controller->pacer();
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnVideoStreamsCreated(
|
void OnVideoStreamsCreated(
|
||||||
VideoSendStream* send_stream,
|
VideoSendStream* send_stream,
|
||||||
const std::vector<VideoReceiveStream*>& receive_streams) override {
|
const std::vector<VideoReceiveStream*>& receive_streams) override {
|
||||||
// Video streams created, check that pacer is correctly configured.
|
auto internal_send_peer = test::VideoSendStreamPeer(send_stream);
|
||||||
EXPECT_EQ(expected_pacing_factor_, paced_sender_->GetPacingFactor());
|
// Video streams created, check that pacing factor is correctly configured.
|
||||||
|
EXPECT_EQ(expected_pacing_factor_,
|
||||||
|
internal_send_peer.GetPacingFactorOverride());
|
||||||
observation_complete_.Set();
|
observation_complete_.Set();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PerformTest() override {
|
void PerformTest() override {
|
||||||
EXPECT_TRUE(Wait()) << "Timed out while waiting for pacer config.";
|
EXPECT_TRUE(Wait()) << "Timed out while waiting for stream creation.";
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const bool configure_send_side_;
|
const bool configure_send_side_;
|
||||||
const float expected_pacing_factor_;
|
const rtc::Optional<float> expected_pacing_factor_;
|
||||||
const PacedSender* paced_sender_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Send-side bwe on, use pacing factor from |kAlrProbingExperiment| above.
|
std::string GetAlrProbingExperimentString() {
|
||||||
PacingFactorObserver test_with_send_side(true, 1.0f);
|
return std::string(
|
||||||
RunBaseTest(&test_with_send_side);
|
AlrExperimentSettings::kScreenshareProbingBweExperimentName) +
|
||||||
|
"/1.0,2875,80,40,-60,3/";
|
||||||
|
}
|
||||||
|
const float kAlrProbingExperimentPaceMultiplier = 1.0f;
|
||||||
|
|
||||||
// Send-side bwe off, use default pacing factor.
|
TEST_F(VideoSendStreamTest, AlrConfiguredWhenSendSideOn) {
|
||||||
PacingFactorObserver test_without_send_side(
|
test::ScopedFieldTrials alr_experiment(GetAlrProbingExperimentString());
|
||||||
false, PacedSender::kDefaultPaceMultiplier);
|
// Send-side bwe on, use pacing factor from |kAlrProbingExperiment| above.
|
||||||
|
PacingFactorObserver test_with_send_side(true,
|
||||||
|
kAlrProbingExperimentPaceMultiplier);
|
||||||
|
RunBaseTest(&test_with_send_side);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(VideoSendStreamTest, AlrNotConfiguredWhenSendSideOff) {
|
||||||
|
test::ScopedFieldTrials alr_experiment(GetAlrProbingExperimentString());
|
||||||
|
// Send-side bwe off, use configuration should not be overridden.
|
||||||
|
PacingFactorObserver test_without_send_side(false, rtc::nullopt);
|
||||||
RunBaseTest(&test_without_send_side);
|
RunBaseTest(&test_without_send_side);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue