Commit d8464fe9 authored by Lambros Lambrou's avatar Lambros Lambrou Committed by Commit Bot

[remoting] Create encoder before notifying of captured frame.

This ensures the encoder is created before passing the captured frame
to the scheduler. This is to allow the scheduler (in future CLs) to
examine properties of the encoder before sending the frame to be
encoded. Such properties could include:
* Preferred quantizer values for normal and big frames.
* Whether big-frame-detection is handled by the encoder.

Bug: 891571
Change-Id: I28c32a1944913ca6dec240ab483b9a65d38f9576
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2085120
Auto-Submit: Lambros Lambrou <lambroslambrou@chromium.org>
Commit-Queue: Yuwei Huang <yuweih@chromium.org>
Reviewed-by: default avatarYuwei Huang <yuweih@chromium.org>
Cr-Commit-Position: refs/heads/master@{#746495}
parent 196775ff
...@@ -197,35 +197,38 @@ void WebrtcVideoStream::OnCaptureResult( ...@@ -197,35 +197,38 @@ void WebrtcVideoStream::OnCaptureResult(
current_frame_stats_->capture_delay = current_frame_stats_->capture_delay =
base::TimeDelta::FromMilliseconds(frame ? frame->capture_time_ms() : 0); base::TimeDelta::FromMilliseconds(frame ? frame->capture_time_ms() : 0);
WebrtcVideoEncoder::FrameParams frame_params; if (!frame) {
if (!scheduler_->OnFrameCaptured(frame.get(), &frame_params)) { scheduler_->OnFrameCaptured(nullptr, nullptr);
return; return;
} }
// TODO(sergeyu): Handle ERROR_PERMANENT result here. // TODO(sergeyu): Handle ERROR_PERMANENT result here.
if (frame) { webrtc::DesktopVector dpi =
webrtc::DesktopVector dpi = frame->dpi().is_zero() ? webrtc::DesktopVector(kDefaultDpi, kDefaultDpi)
frame->dpi().is_zero() ? webrtc::DesktopVector(kDefaultDpi, kDefaultDpi) : frame->dpi();
: frame->dpi();
if (!frame_size_.equals(frame->size()) || !frame_dpi_.equals(dpi)) {
if (!frame_size_.equals(frame->size()) || !frame_dpi_.equals(dpi)) { frame_size_ = frame->size();
frame_size_ = frame->size(); frame_dpi_ = dpi;
frame_dpi_ = dpi; if (observer_)
if (observer_) observer_->OnVideoSizeChanged(this, frame_size_, frame_dpi_);
observer_->OnVideoSizeChanged(this, frame_size_, frame_dpi_); }
}
current_frame_stats_->capturer_id = frame->capturer_id(); current_frame_stats_->capturer_id = frame->capturer_id();
if (!encoder_) { if (!encoder_) {
encoder_selector_.SetDesktopFrame(*frame); encoder_selector_.SetDesktopFrame(*frame);
encoder_ = encoder_selector_.CreateEncoder(); encoder_ = encoder_selector_.CreateEncoder();
encoder_->SetLosslessEncode(lossless_encode_); encoder_->SetLosslessEncode(lossless_encode_);
encoder_->SetLosslessColor(lossless_color_); encoder_->SetLosslessColor(lossless_color_);
// TODO(zijiehe): Permanently stop the video stream if we cannot create an // TODO(zijiehe): Permanently stop the video stream if we cannot create an
// encoder for the |frame|. // encoder for the |frame|.
} }
WebrtcVideoEncoder::FrameParams frame_params;
if (!scheduler_->OnFrameCaptured(frame.get(), &frame_params)) {
return;
} }
if (encoder_) { if (encoder_) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment