Reland "Remove Invoke from VideoChannel::FillBitrateInfo."
This reverts commit 48a4d33719390b7bcaf8445a1581a00825f67bfb. Reason for reland: Relanding the original change but without the modification for VideoSendStream::GetStats. Essentially there's a TODO there to fix the downstream issue, which seems to be benign. Original change's description: > Revert "Remove Invoke from VideoChannel::FillBitrateInfo." > > This reverts commit 1a1795768e1bdb65054ebe15aa238c6edc78dd14. > > Reason for revert: Speculative revert (breaks downstream project). > > Original change's description: > > Remove Invoke from VideoChannel::FillBitrateInfo. > > > > The method is relied upon by StatsCollector where it was called from the > > signaling thread in a loop. Now there's at most one invoke (not N). > > > > Uncommenting thread checks and removing TODOs in SendStatisticsProxy, > > VideoSendStream. Updating all related tests that fetched stats from > > the wrong context. > > > > Bug: webrtc:12726 > > Change-Id: Ia7db1afd7e103ec4f9816f5647203c4e2495586e > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/216688 > > Commit-Queue: Tommi <tommi@webrtc.org> > > Reviewed-by: Niels Moller <nisse@webrtc.org> > > Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#33894} > > TBR=ilnik@webrtc.org,nisse@webrtc.org,tommi@webrtc.org,webrtc-scoped@luci-project-accounts.iam.gserviceaccount.com > > Change-Id: I2520957cdb33492d187f04320c7416788fd0f820 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:12726 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/217240 > Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> > Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#33898} # Not skipping CQ checks because this is a reland. Bug: webrtc:12726 Change-Id: I41cce3b11a29905cde982c22e82b9b1f5a98e654 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/217222 Reviewed-by: Tommi <tommi@webrtc.org> Reviewed-by: Niels Moller <nisse@webrtc.org> Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> Commit-Queue: Tommi <tommi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33902}
This commit is contained in:
parent
9c4d3163f4
commit
788d805c38
@ -654,7 +654,8 @@ void CallPerfTest::TestMinTransmitBitrate(bool pad_to_min_bitrate) {
|
||||
static const int kAcceptableBitrateErrorMargin = 15; // +- 7
|
||||
class BitrateObserver : public test::EndToEndTest {
|
||||
public:
|
||||
explicit BitrateObserver(bool using_min_transmit_bitrate)
|
||||
explicit BitrateObserver(bool using_min_transmit_bitrate,
|
||||
TaskQueueBase* task_queue)
|
||||
: EndToEndTest(kLongTimeoutMs),
|
||||
send_stream_(nullptr),
|
||||
converged_(false),
|
||||
@ -667,12 +668,15 @@ void CallPerfTest::TestMinTransmitBitrate(bool pad_to_min_bitrate) {
|
||||
? kMaxAcceptableTransmitBitrate
|
||||
: (kMaxEncodeBitrateKbps +
|
||||
kAcceptableBitrateErrorMargin / 2)),
|
||||
num_bitrate_observations_in_range_(0) {}
|
||||
num_bitrate_observations_in_range_(0),
|
||||
task_queue_(task_queue) {}
|
||||
|
||||
private:
|
||||
// TODO(holmer): Run this with a timer instead of once per packet.
|
||||
Action OnSendRtp(const uint8_t* packet, size_t length) override {
|
||||
task_queue_->PostTask(ToQueuedTask([this]() {
|
||||
VideoSendStream::Stats stats = send_stream_->GetStats();
|
||||
|
||||
if (!stats.substreams.empty()) {
|
||||
RTC_DCHECK_EQ(1, stats.substreams.size());
|
||||
int bitrate_kbps =
|
||||
@ -688,6 +692,7 @@ void CallPerfTest::TestMinTransmitBitrate(bool pad_to_min_bitrate) {
|
||||
if (converged_)
|
||||
bitrate_kbps_list_.push_back(bitrate_kbps);
|
||||
}
|
||||
}));
|
||||
return SEND_PACKET;
|
||||
}
|
||||
|
||||
@ -724,7 +729,8 @@ void CallPerfTest::TestMinTransmitBitrate(bool pad_to_min_bitrate) {
|
||||
const int max_acceptable_bitrate_;
|
||||
int num_bitrate_observations_in_range_;
|
||||
std::vector<double> bitrate_kbps_list_;
|
||||
} test(pad_to_min_bitrate);
|
||||
TaskQueueBase* task_queue_;
|
||||
} test(pad_to_min_bitrate, task_queue());
|
||||
|
||||
fake_encoder_max_bitrate_ = kMaxEncodeBitrateKbps;
|
||||
RunBaseTest(&test);
|
||||
@ -775,7 +781,7 @@ TEST_F(CallPerfTest, MAYBE_KeepsHighBitrateWhenReconfiguringSender) {
|
||||
|
||||
class BitrateObserver : public test::EndToEndTest, public test::FakeEncoder {
|
||||
public:
|
||||
BitrateObserver()
|
||||
explicit BitrateObserver(TaskQueueBase* task_queue)
|
||||
: EndToEndTest(kDefaultTimeoutMs),
|
||||
FakeEncoder(Clock::GetRealTimeClock()),
|
||||
encoder_inits_(0),
|
||||
@ -784,7 +790,8 @@ TEST_F(CallPerfTest, MAYBE_KeepsHighBitrateWhenReconfiguringSender) {
|
||||
frame_generator_(nullptr),
|
||||
encoder_factory_(this),
|
||||
bitrate_allocator_factory_(
|
||||
CreateBuiltinVideoBitrateAllocatorFactory()) {}
|
||||
CreateBuiltinVideoBitrateAllocatorFactory()),
|
||||
task_queue_(task_queue) {}
|
||||
|
||||
int32_t InitEncode(const VideoCodec* config,
|
||||
const VideoEncoder::Settings& settings) override {
|
||||
@ -854,7 +861,9 @@ TEST_F(CallPerfTest, MAYBE_KeepsHighBitrateWhenReconfiguringSender) {
|
||||
ASSERT_TRUE(time_to_reconfigure_.Wait(kDefaultTimeoutMs))
|
||||
<< "Timed out before receiving an initial high bitrate.";
|
||||
frame_generator_->ChangeResolution(kDefaultWidth * 2, kDefaultHeight * 2);
|
||||
SendTask(RTC_FROM_HERE, task_queue_, [&]() {
|
||||
send_stream_->ReconfigureVideoEncoder(encoder_config_.Copy());
|
||||
});
|
||||
EXPECT_TRUE(Wait())
|
||||
<< "Timed out while waiting for a couple of high bitrate estimates "
|
||||
"after reconfiguring the send stream.";
|
||||
@ -869,7 +878,8 @@ TEST_F(CallPerfTest, MAYBE_KeepsHighBitrateWhenReconfiguringSender) {
|
||||
test::VideoEncoderProxyFactory encoder_factory_;
|
||||
std::unique_ptr<VideoBitrateAllocatorFactory> bitrate_allocator_factory_;
|
||||
VideoEncoderConfig encoder_config_;
|
||||
} test;
|
||||
TaskQueueBase* task_queue_;
|
||||
} test(task_queue());
|
||||
|
||||
RunBaseTest(&test);
|
||||
}
|
||||
|
||||
@ -370,7 +370,10 @@ void RampUpTester::TriggerTestDone() {
|
||||
if (!send_stream_)
|
||||
return;
|
||||
|
||||
VideoSendStream::Stats send_stats = send_stream_->GetStats();
|
||||
VideoSendStream::Stats send_stats;
|
||||
SendTask(RTC_FROM_HERE, task_queue_,
|
||||
[&] { send_stats = send_stream_->GetStats(); });
|
||||
|
||||
send_stream_ = nullptr; // To avoid dereferencing a bad pointer.
|
||||
|
||||
size_t total_packets_sent = 0;
|
||||
|
||||
@ -275,14 +275,14 @@ void H264BitstreamParser::ParseSlice(const uint8_t* slice, size_t length) {
|
||||
sps_ = SpsParser::ParseSps(slice + H264::kNaluTypeSize,
|
||||
length - H264::kNaluTypeSize);
|
||||
if (!sps_)
|
||||
RTC_LOG(LS_WARNING) << "Unable to parse SPS from H264 bitstream.";
|
||||
RTC_DLOG(LS_WARNING) << "Unable to parse SPS from H264 bitstream.";
|
||||
break;
|
||||
}
|
||||
case H264::NaluType::kPps: {
|
||||
pps_ = PpsParser::ParsePps(slice + H264::kNaluTypeSize,
|
||||
length - H264::kNaluTypeSize);
|
||||
if (!pps_)
|
||||
RTC_LOG(LS_WARNING) << "Unable to parse PPS from H264 bitstream.";
|
||||
RTC_DLOG(LS_WARNING) << "Unable to parse PPS from H264 bitstream.";
|
||||
break;
|
||||
}
|
||||
case H264::NaluType::kAud:
|
||||
@ -291,7 +291,7 @@ void H264BitstreamParser::ParseSlice(const uint8_t* slice, size_t length) {
|
||||
default:
|
||||
Result res = ParseNonParameterSetNalu(slice, length, nalu_type);
|
||||
if (res != kOk)
|
||||
RTC_LOG(LS_INFO) << "Failed to parse bitstream. Error: " << res;
|
||||
RTC_DLOG(LS_INFO) << "Failed to parse bitstream. Error: " << res;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1065,9 +1065,9 @@ void VideoChannel::UpdateMediaSendRecvState_w() {
|
||||
}
|
||||
|
||||
void VideoChannel::FillBitrateInfo(BandwidthEstimationInfo* bwe_info) {
|
||||
RTC_DCHECK_RUN_ON(worker_thread());
|
||||
VideoMediaChannel* mc = media_channel();
|
||||
InvokeOnWorker<void>(RTC_FROM_HERE,
|
||||
[mc, bwe_info] { mc->FillBitrateInfo(bwe_info); });
|
||||
mc->FillBitrateInfo(bwe_info);
|
||||
}
|
||||
|
||||
bool VideoChannel::SetLocalContent_w(const MediaContentDescription* content,
|
||||
|
||||
@ -1026,16 +1026,25 @@ void StatsCollector::ExtractBweInfo() {
|
||||
|
||||
// Fill in target encoder bitrate, actual encoder bitrate, rtx bitrate, etc.
|
||||
// TODO(holmer): Also fill this in for audio.
|
||||
for (const auto& transceiver : pc_->GetTransceiversInternal()) {
|
||||
auto transceivers = pc_->GetTransceiversInternal();
|
||||
std::vector<cricket::VideoChannel*> video_channels;
|
||||
for (const auto& transceiver : transceivers) {
|
||||
if (transceiver->media_type() != cricket::MEDIA_TYPE_VIDEO) {
|
||||
continue;
|
||||
}
|
||||
auto* video_channel =
|
||||
static_cast<cricket::VideoChannel*>(transceiver->internal()->channel());
|
||||
if (!video_channel) {
|
||||
continue;
|
||||
if (video_channel) {
|
||||
video_channels.push_back(video_channel);
|
||||
}
|
||||
video_channel->FillBitrateInfo(&bwe_info);
|
||||
}
|
||||
|
||||
if (!video_channels.empty()) {
|
||||
pc_->worker_thread()->Invoke<void>(RTC_FROM_HERE, [&] {
|
||||
for (const auto& channel : video_channels) {
|
||||
channel->FillBitrateInfo(&bwe_info);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
StatsReport::Id report_id(StatsReport::NewBandwidthEstimationId());
|
||||
|
||||
@ -182,7 +182,11 @@ TEST(ScenarioTest,
|
||||
s.RunFor(TimeDelta::Seconds(10));
|
||||
// Make sure retransmissions have happened.
|
||||
int retransmit_packets = 0;
|
||||
for (const auto& substream : video->send()->GetStats().substreams) {
|
||||
|
||||
VideoSendStream::Stats stats;
|
||||
alice->SendTask([&]() { stats = video->send()->GetStats(); });
|
||||
|
||||
for (const auto& substream : stats.substreams) {
|
||||
retransmit_packets += substream.second.rtp_stats.retransmitted.packets;
|
||||
}
|
||||
EXPECT_GT(retransmit_packets, 0);
|
||||
|
||||
@ -33,8 +33,14 @@ void CreateAnalyzedStream(Scenario* s,
|
||||
auto* audio = s->CreateAudioStream(route->forward(), AudioStreamConfig());
|
||||
s->Every(TimeDelta::Seconds(1), [=] {
|
||||
collectors->call.AddStats(caller->GetStats());
|
||||
collectors->video_send.AddStats(video->send()->GetStats(), s->Now());
|
||||
collectors->audio_receive.AddStats(audio->receive()->GetStats());
|
||||
|
||||
VideoSendStream::Stats send_stats;
|
||||
caller->SendTask([&]() { send_stats = video->send()->GetStats(); });
|
||||
collectors->video_send.AddStats(send_stats, s->Now());
|
||||
|
||||
AudioReceiveStream::Stats receive_stats;
|
||||
caller->SendTask([&]() { receive_stats = audio->receive()->GetStats(); });
|
||||
collectors->audio_receive.AddStats(receive_stats);
|
||||
|
||||
// Querying the video stats from within the expected runtime environment
|
||||
// (i.e. the TQ that belongs to the CallClient, not the Scenario TQ that
|
||||
|
||||
@ -130,7 +130,9 @@ TEST(VideoStreamTest, SendsNacksOnLoss) {
|
||||
auto video = s.CreateVideoStream(route->forward(), VideoStreamConfig());
|
||||
s.RunFor(TimeDelta::Seconds(1));
|
||||
int retransmit_packets = 0;
|
||||
for (const auto& substream : video->send()->GetStats().substreams) {
|
||||
VideoSendStream::Stats stats;
|
||||
route->first()->SendTask([&]() { stats = video->send()->GetStats(); });
|
||||
for (const auto& substream : stats.substreams) {
|
||||
retransmit_packets += substream.second.rtp_stats.retransmitted.packets;
|
||||
}
|
||||
EXPECT_GT(retransmit_packets, 0);
|
||||
@ -152,7 +154,8 @@ TEST(VideoStreamTest, SendsFecWithUlpFec) {
|
||||
c->stream.use_ulpfec = true;
|
||||
});
|
||||
s.RunFor(TimeDelta::Seconds(5));
|
||||
VideoSendStream::Stats video_stats = video->send()->GetStats();
|
||||
VideoSendStream::Stats video_stats;
|
||||
route->first()->SendTask([&]() { video_stats = video->send()->GetStats(); });
|
||||
EXPECT_GT(video_stats.substreams.begin()->second.rtp_stats.fec.packets, 0u);
|
||||
}
|
||||
TEST(VideoStreamTest, SendsFecWithFlexFec) {
|
||||
@ -169,7 +172,8 @@ TEST(VideoStreamTest, SendsFecWithFlexFec) {
|
||||
c->stream.use_flexfec = true;
|
||||
});
|
||||
s.RunFor(TimeDelta::Seconds(5));
|
||||
VideoSendStream::Stats video_stats = video->send()->GetStats();
|
||||
VideoSendStream::Stats video_stats;
|
||||
route->first()->SendTask([&]() { video_stats = video->send()->GetStats(); });
|
||||
EXPECT_GT(video_stats.substreams.begin()->second.rtp_stats.fec.packets, 0u);
|
||||
}
|
||||
|
||||
|
||||
@ -132,13 +132,15 @@ void SsrcEndToEndTest::TestSendsSetSsrcs(size_t num_ssrcs,
|
||||
public:
|
||||
SendsSetSsrcs(const uint32_t* ssrcs,
|
||||
size_t num_ssrcs,
|
||||
bool send_single_ssrc_first)
|
||||
bool send_single_ssrc_first,
|
||||
TaskQueueBase* task_queue)
|
||||
: EndToEndTest(kDefaultTimeoutMs),
|
||||
num_ssrcs_(num_ssrcs),
|
||||
send_single_ssrc_first_(send_single_ssrc_first),
|
||||
ssrcs_to_observe_(num_ssrcs),
|
||||
expect_single_ssrc_(send_single_ssrc_first),
|
||||
send_stream_(nullptr) {
|
||||
send_stream_(nullptr),
|
||||
task_queue_(task_queue) {
|
||||
for (size_t i = 0; i < num_ssrcs; ++i)
|
||||
valid_ssrcs_[ssrcs[i]] = true;
|
||||
}
|
||||
@ -200,8 +202,10 @@ void SsrcEndToEndTest::TestSendsSetSsrcs(size_t num_ssrcs,
|
||||
|
||||
if (send_single_ssrc_first_) {
|
||||
// Set full simulcast and continue with the rest of the SSRCs.
|
||||
SendTask(RTC_FROM_HERE, task_queue_, [&]() {
|
||||
send_stream_->ReconfigureVideoEncoder(
|
||||
std::move(video_encoder_config_all_streams_));
|
||||
});
|
||||
EXPECT_TRUE(Wait()) << "Timed out while waiting on additional SSRCs.";
|
||||
}
|
||||
}
|
||||
@ -218,7 +222,8 @@ void SsrcEndToEndTest::TestSendsSetSsrcs(size_t num_ssrcs,
|
||||
|
||||
VideoSendStream* send_stream_;
|
||||
VideoEncoderConfig video_encoder_config_all_streams_;
|
||||
} test(kVideoSendSsrcs, num_ssrcs, send_single_ssrc_first);
|
||||
TaskQueueBase* task_queue_;
|
||||
} test(kVideoSendSsrcs, num_ssrcs, send_single_ssrc_first, task_queue());
|
||||
|
||||
RunBaseTest(&test);
|
||||
}
|
||||
|
||||
@ -154,7 +154,10 @@ TEST_F(StatsEndToEndTest, GetStats) {
|
||||
|
||||
bool CheckSendStats() {
|
||||
RTC_DCHECK(send_stream_);
|
||||
VideoSendStream::Stats stats = send_stream_->GetStats();
|
||||
|
||||
VideoSendStream::Stats stats;
|
||||
SendTask(RTC_FROM_HERE, task_queue_,
|
||||
[&]() { stats = send_stream_->GetStats(); });
|
||||
|
||||
size_t expected_num_streams =
|
||||
kNumSimulcastStreams + expected_send_ssrcs_.size();
|
||||
|
||||
@ -670,6 +670,7 @@ void SendStatisticsProxy::UmaSamplesContainer::UpdateHistograms(
|
||||
void SendStatisticsProxy::OnEncoderReconfigured(
|
||||
const VideoEncoderConfig& config,
|
||||
const std::vector<VideoStream>& streams) {
|
||||
// Called on VideoStreamEncoder's encoder_queue_.
|
||||
MutexLock lock(&mutex_);
|
||||
|
||||
if (content_type_ != config.content_type) {
|
||||
|
||||
@ -169,7 +169,7 @@ void VideoSendStream::UpdateActiveSimulcastLayers(
|
||||
|
||||
void VideoSendStream::Start() {
|
||||
RTC_DCHECK_RUN_ON(&thread_checker_);
|
||||
RTC_LOG(LS_INFO) << "VideoSendStream::Start";
|
||||
RTC_DLOG(LS_INFO) << "VideoSendStream::Start";
|
||||
VideoSendStreamImpl* send_stream = send_stream_.get();
|
||||
worker_queue_->PostTask([this, send_stream] {
|
||||
send_stream->Start();
|
||||
@ -184,7 +184,7 @@ void VideoSendStream::Start() {
|
||||
|
||||
void VideoSendStream::Stop() {
|
||||
RTC_DCHECK_RUN_ON(&thread_checker_);
|
||||
RTC_LOG(LS_INFO) << "VideoSendStream::Stop";
|
||||
RTC_DLOG(LS_INFO) << "VideoSendStream::Stop";
|
||||
VideoSendStreamImpl* send_stream = send_stream_.get();
|
||||
worker_queue_->PostTask([send_stream] { send_stream->Stop(); });
|
||||
}
|
||||
@ -209,10 +209,8 @@ void VideoSendStream::SetSource(
|
||||
}
|
||||
|
||||
void VideoSendStream::ReconfigureVideoEncoder(VideoEncoderConfig config) {
|
||||
// TODO(perkj): Some test cases in VideoSendStreamTest call
|
||||
// ReconfigureVideoEncoder from the network thread.
|
||||
// RTC_DCHECK_RUN_ON(&thread_checker_);
|
||||
RTC_DCHECK(content_type_ == config.content_type);
|
||||
RTC_DCHECK_RUN_ON(&thread_checker_);
|
||||
RTC_DCHECK_EQ(content_type_, config.content_type);
|
||||
video_stream_encoder_->ConfigureEncoder(
|
||||
std::move(config),
|
||||
config_.rtp.max_packet_size - CalculateMaxHeaderSize(config_.rtp));
|
||||
|
||||
@ -1474,7 +1474,9 @@ TEST_F(VideoSendStreamTest, MinTransmitBitrateRespectsRemb) {
|
||||
if (!rtp_packet.Parse(packet, length))
|
||||
return DROP_PACKET;
|
||||
RTC_DCHECK(stream_);
|
||||
VideoSendStream::Stats stats = stream_->GetStats();
|
||||
VideoSendStream::Stats stats;
|
||||
SendTask(RTC_FROM_HERE, task_queue_,
|
||||
[&]() { stats = stream_->GetStats(); });
|
||||
if (!stats.substreams.empty()) {
|
||||
EXPECT_EQ(1u, stats.substreams.size());
|
||||
int total_bitrate_bps =
|
||||
@ -2422,14 +2424,16 @@ class VideoCodecConfigObserver : public test::SendTest,
|
||||
public test::FakeEncoder {
|
||||
public:
|
||||
VideoCodecConfigObserver(VideoCodecType video_codec_type,
|
||||
const char* codec_name)
|
||||
const char* codec_name,
|
||||
TaskQueueBase* task_queue)
|
||||
: SendTest(VideoSendStreamTest::kDefaultTimeoutMs),
|
||||
FakeEncoder(Clock::GetRealTimeClock()),
|
||||
video_codec_type_(video_codec_type),
|
||||
codec_name_(codec_name),
|
||||
num_initializations_(0),
|
||||
stream_(nullptr),
|
||||
encoder_factory_(this) {
|
||||
encoder_factory_(this),
|
||||
task_queue_(task_queue) {
|
||||
InitCodecSpecifics();
|
||||
}
|
||||
|
||||
@ -2477,7 +2481,9 @@ class VideoCodecConfigObserver : public test::SendTest,
|
||||
// Change encoder settings to actually trigger reconfiguration.
|
||||
encoder_settings_.frameDroppingOn = !encoder_settings_.frameDroppingOn;
|
||||
encoder_config_.encoder_specific_settings = GetEncoderSpecificSettings();
|
||||
SendTask(RTC_FROM_HERE, task_queue_, [&]() {
|
||||
stream_->ReconfigureVideoEncoder(std::move(encoder_config_));
|
||||
});
|
||||
ASSERT_TRUE(
|
||||
init_encode_event_.Wait(VideoSendStreamTest::kDefaultTimeoutMs));
|
||||
EXPECT_EQ(2u, num_initializations_)
|
||||
@ -2499,6 +2505,7 @@ class VideoCodecConfigObserver : public test::SendTest,
|
||||
VideoSendStream* stream_;
|
||||
test::VideoEncoderProxyFactory encoder_factory_;
|
||||
VideoEncoderConfig encoder_config_;
|
||||
TaskQueueBase* task_queue_;
|
||||
};
|
||||
|
||||
template <>
|
||||
@ -2604,12 +2611,14 @@ VideoCodecConfigObserver<VideoCodecVP9>::GetEncoderSpecificSettings() const {
|
||||
}
|
||||
|
||||
TEST_F(VideoSendStreamTest, EncoderSetupPropagatesVp8Config) {
|
||||
VideoCodecConfigObserver<VideoCodecVP8> test(kVideoCodecVP8, "VP8");
|
||||
VideoCodecConfigObserver<VideoCodecVP8> test(kVideoCodecVP8, "VP8",
|
||||
task_queue());
|
||||
RunBaseTest(&test);
|
||||
}
|
||||
|
||||
TEST_F(VideoSendStreamTest, EncoderSetupPropagatesVp9Config) {
|
||||
VideoCodecConfigObserver<VideoCodecVP9> test(kVideoCodecVP9, "VP9");
|
||||
VideoCodecConfigObserver<VideoCodecVP9> test(kVideoCodecVP9, "VP9",
|
||||
task_queue());
|
||||
RunBaseTest(&test);
|
||||
}
|
||||
|
||||
@ -2621,7 +2630,8 @@ TEST_F(VideoSendStreamTest, EncoderSetupPropagatesVp9Config) {
|
||||
#define MAYBE_EncoderSetupPropagatesH264Config EncoderSetupPropagatesH264Config
|
||||
#endif
|
||||
TEST_F(VideoSendStreamTest, MAYBE_EncoderSetupPropagatesH264Config) {
|
||||
VideoCodecConfigObserver<VideoCodecH264> test(kVideoCodecH264, "H264");
|
||||
VideoCodecConfigObserver<VideoCodecH264> test(kVideoCodecH264, "H264",
|
||||
task_queue());
|
||||
RunBaseTest(&test);
|
||||
}
|
||||
|
||||
@ -2904,7 +2914,9 @@ TEST_F(VideoSendStreamTest, ReconfigureBitratesSetsEncoderBitratesCorrectly) {
|
||||
// Encoder rate is capped by EncoderConfig max_bitrate_bps.
|
||||
WaitForSetRates(kMaxBitrateKbps);
|
||||
encoder_config_.max_bitrate_bps = kLowerMaxBitrateKbps * 1000;
|
||||
SendTask(RTC_FROM_HERE, task_queue_, [&]() {
|
||||
send_stream_->ReconfigureVideoEncoder(encoder_config_.Copy());
|
||||
});
|
||||
ASSERT_TRUE(create_rate_allocator_event_.Wait(
|
||||
VideoSendStreamTest::kDefaultTimeoutMs));
|
||||
EXPECT_EQ(2, num_rate_allocator_creations_)
|
||||
@ -2914,7 +2926,9 @@ TEST_F(VideoSendStreamTest, ReconfigureBitratesSetsEncoderBitratesCorrectly) {
|
||||
EXPECT_EQ(1, num_encoder_initializations_);
|
||||
|
||||
encoder_config_.max_bitrate_bps = kIncreasedMaxBitrateKbps * 1000;
|
||||
SendTask(RTC_FROM_HERE, task_queue_, [&]() {
|
||||
send_stream_->ReconfigureVideoEncoder(encoder_config_.Copy());
|
||||
});
|
||||
ASSERT_TRUE(create_rate_allocator_event_.Wait(
|
||||
VideoSendStreamTest::kDefaultTimeoutMs));
|
||||
EXPECT_EQ(3, num_rate_allocator_creations_)
|
||||
@ -2955,11 +2969,12 @@ TEST_F(VideoSendStreamTest, ReportsSentResolution) {
|
||||
class ScreencastTargetBitrateTest : public test::SendTest,
|
||||
public test::FakeEncoder {
|
||||
public:
|
||||
ScreencastTargetBitrateTest()
|
||||
explicit ScreencastTargetBitrateTest(TaskQueueBase* task_queue)
|
||||
: SendTest(kDefaultTimeoutMs),
|
||||
test::FakeEncoder(Clock::GetRealTimeClock()),
|
||||
send_stream_(nullptr),
|
||||
encoder_factory_(this) {}
|
||||
encoder_factory_(this),
|
||||
task_queue_(task_queue) {}
|
||||
|
||||
private:
|
||||
int32_t Encode(const VideoFrame& input_image,
|
||||
@ -3007,7 +3022,9 @@ TEST_F(VideoSendStreamTest, ReportsSentResolution) {
|
||||
void PerformTest() override {
|
||||
EXPECT_TRUE(Wait())
|
||||
<< "Timed out while waiting for the encoder to send one frame.";
|
||||
VideoSendStream::Stats stats = send_stream_->GetStats();
|
||||
VideoSendStream::Stats stats;
|
||||
SendTask(RTC_FROM_HERE, task_queue_,
|
||||
[&]() { stats = send_stream_->GetStats(); });
|
||||
|
||||
for (size_t i = 0; i < kNumStreams; ++i) {
|
||||
ASSERT_TRUE(stats.substreams.find(kVideoSendSsrcs[i]) !=
|
||||
@ -3029,7 +3046,8 @@ TEST_F(VideoSendStreamTest, ReportsSentResolution) {
|
||||
|
||||
VideoSendStream* send_stream_;
|
||||
test::VideoEncoderProxyFactory encoder_factory_;
|
||||
} test;
|
||||
TaskQueueBase* const task_queue_;
|
||||
} test(task_queue());
|
||||
|
||||
RunBaseTest(&test);
|
||||
}
|
||||
@ -3800,14 +3818,15 @@ class ContentSwitchTest : public test::SendTest {
|
||||
};
|
||||
static const uint32_t kMinPacketsToSend = 50;
|
||||
|
||||
explicit ContentSwitchTest(T* stream_reset_fun)
|
||||
explicit ContentSwitchTest(T* stream_reset_fun, TaskQueueBase* task_queue)
|
||||
: SendTest(test::CallTest::kDefaultTimeoutMs),
|
||||
call_(nullptr),
|
||||
state_(StreamState::kBeforeSwitch),
|
||||
send_stream_(nullptr),
|
||||
send_stream_config_(nullptr),
|
||||
packets_sent_(0),
|
||||
stream_resetter_(stream_reset_fun) {
|
||||
stream_resetter_(stream_reset_fun),
|
||||
task_queue_(task_queue) {
|
||||
RTC_DCHECK(stream_resetter_);
|
||||
}
|
||||
|
||||
@ -3841,8 +3860,10 @@ class ContentSwitchTest : public test::SendTest {
|
||||
float pacing_factor =
|
||||
internal_send_peer.GetPacingFactorOverride().value_or(0.0f);
|
||||
float expected_pacing_factor = 1.1; // Strict pacing factor.
|
||||
if (send_stream_->GetStats().content_type ==
|
||||
webrtc::VideoContentType::SCREENSHARE) {
|
||||
VideoSendStream::Stats stats;
|
||||
SendTask(RTC_FROM_HERE, task_queue_,
|
||||
[&stats, stream = send_stream_]() { stats = stream->GetStats(); });
|
||||
if (stats.content_type == webrtc::VideoContentType::SCREENSHARE) {
|
||||
expected_pacing_factor = 1.0f; // Currently used pacing factor in ALR.
|
||||
}
|
||||
|
||||
@ -3910,6 +3931,7 @@ class ContentSwitchTest : public test::SendTest {
|
||||
VideoEncoderConfig encoder_config_;
|
||||
uint32_t packets_sent_ RTC_GUARDED_BY(mutex_);
|
||||
T* stream_resetter_;
|
||||
TaskQueueBase* task_queue_;
|
||||
};
|
||||
|
||||
TEST_F(VideoSendStreamTest, SwitchesToScreenshareAndBack) {
|
||||
@ -3929,7 +3951,7 @@ TEST_F(VideoSendStreamTest, SwitchesToScreenshareAndBack) {
|
||||
Start();
|
||||
});
|
||||
};
|
||||
ContentSwitchTest<decltype(reset_fun)> test(&reset_fun);
|
||||
ContentSwitchTest<decltype(reset_fun)> test(&reset_fun, task_queue());
|
||||
RunBaseTest(&test);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user