Reland of Drop frames until specified bitrate is achieved. (patchset #1 id:1 of https://codereview.webrtc.org/2666303002/ )
Reason for revert:
Perf test broke as it made assumptions that quality scaling was turned off. This turns out not to be the case. Fixed by turning quality scaling off for the tests.
Original issue's description:
> Revert of Drop frames until specified bitrate is achieved. (patchset #12 id:240001 of https://codereview.webrtc.org/2630333002/ )
>
> Reason for revert:
> due to failures on perf tests (not on perf stats, but fails running due to dcheck failures), see e.g., https://build.chromium.org/p/client.webrtc.perf/builders/Android32%20Tests%20(K%20Nexus5)
>
> Original issue's description:
> > Drop frames until specified bitrate is achieved.
> >
> > This CL fixes a regression introduced with the new quality scaler
> > where the video would no longer start in a scaled mode. This CL adds
> > code that compares incoming captured frames to the target bitrate,
> > and if they are found to be too large, they are dropped and sinkWants
> > set to a lower resolution. The number of dropped frames should be low
> > (0-4 in most cases) and should not introduce a noticeable delay, or
> > at least should be preferrable to having the first 2-4 seconds of video
> > have very low quality.
> >
> > BUG=webrtc:6953
> >
> > Review-Url: https://codereview.webrtc.org/2630333002
> > Cr-Commit-Position: refs/heads/master@{#16391}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/83399caec5762d2dad038b8e9d86163e92c18c9f
>
> TBR=perkj@webrtc.org,sprang@webrtc.org,stefan@webrtc.org,kthelgason@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:6953
>
> Review-Url: https://codereview.webrtc.org/2666303002
> Cr-Commit-Position: refs/heads/master@{#16395}
> Committed: https://chromium.googlesource.com/external/webrtc/+/35fc2aa82fb5a562f3f76f2b91a55f05ebfd4874
TBR=perkj@webrtc.org,sprang@webrtc.org,stefan@webrtc.org,minyue@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:6953
Review-Url: https://codereview.webrtc.org/2675223002
Cr-Commit-Position: refs/heads/master@{#16473}
diff --git a/webrtc/video/video_quality_test.cc b/webrtc/video/video_quality_test.cc
index a419195..9c73460 100644
--- a/webrtc/video/video_quality_test.cc
+++ b/webrtc/video/video_quality_test.cc
@@ -329,12 +329,10 @@
// No previous frame rendered, this one was dropped after sending but
// before rendering.
++dropped_frames_before_rendering_;
- frames_.pop_front();
- RTC_CHECK(!frames_.empty());
- continue;
+ } else {
+ AddFrameComparison(frames_.front(), *last_rendered_frame_, true,
+ render_time_ms);
}
- AddFrameComparison(frames_.front(), *last_rendered_frame_, true,
- render_time_ms);
frames_.pop_front();
RTC_DCHECK(!frames_.empty());
}
@@ -1196,6 +1194,8 @@
// Fill out codec settings.
video_encoder_config_.content_type = VideoEncoderConfig::ContentType::kScreen;
+ degradation_preference_ =
+ VideoSendStream::DegradationPreference::kMaintainResolution;
if (params_.video.codec == "VP8") {
VideoCodecVP8 vp8_settings = VideoEncoder::GetDefaultVp8Settings();
vp8_settings.denoisingOn = false;
@@ -1360,9 +1360,9 @@
analyzer.SetSendStream(video_send_stream_);
if (video_receive_streams_.size() == 1)
analyzer.SetReceiveStream(video_receive_streams_[0]);
- video_send_stream_->SetSource(
- analyzer.OutputInterface(),
- VideoSendStream::DegradationPreference::kBalanced);
+
+ video_send_stream_->SetSource(analyzer.OutputInterface(),
+ degradation_preference_);
CreateCapturer();
rtc::VideoSinkWants wants;
@@ -1504,9 +1504,8 @@
video_receive_stream = call->CreateVideoReceiveStream(
video_receive_configs_[stream_id].Copy());
CreateCapturer();
- video_send_stream_->SetSource(
- video_capturer_.get(),
- VideoSendStream::DegradationPreference::kBalanced);
+ video_send_stream_->SetSource(video_capturer_.get(),
+ degradation_preference_);
}
AudioReceiveStream* audio_receive_stream = nullptr;