Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Unified Diff: webrtc/video/vie_encoder.cc

Issue 2455063002: Change ViEEncoder to not reconfigure the encoder until the video resolution is known. (Closed)
Patch Set: Fix test UseExternalFactoryForVp8WhenSupported. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/video/vie_encoder.h ('k') | webrtc/video/vie_encoder_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/video/vie_encoder.cc
diff --git a/webrtc/video/vie_encoder.cc b/webrtc/video/vie_encoder.cc
index a3fd98dd6fe5b1c74ebd00de4c55388597949afd..f5bde2e3590cd482030a68aae04d005b191931c7 100644
--- a/webrtc/video/vie_encoder.cc
+++ b/webrtc/video/vie_encoder.cc
@@ -410,15 +410,14 @@ void ViEEncoder::ConfigureEncoderOnTaskQueue(VideoEncoderConfig config,
pending_encoder_reconfiguration_ = true;
// Reconfigure the encoder now if the encoder has an internal source or
- // if this is the first time the encoder is configured.
- // Otherwise, the reconfiguration is deferred until the next frame to minimize
- // the number of reconfigurations. The codec configuration depends on incoming
- // video frame size.
- if (!last_frame_info_ || settings_.internal_source) {
- if (!last_frame_info_) {
- last_frame_info_ = rtc::Optional<VideoFrameInfo>(
- VideoFrameInfo(176, 144, kVideoRotation_0, false));
- }
+ // if the frame resolution is known. Otherwise, the reconfiguration is
+ // deferred until the next frame to minimize the number of reconfigurations.
+ // The codec configuration depends on incoming video frame size.
+ if (last_frame_info_) {
+ ReconfigureEncoder();
+ } else if (settings_.internal_source) {
+ last_frame_info_ = rtc::Optional<VideoFrameInfo>(
+ VideoFrameInfo(1, 1, kVideoRotation_0, true));
ReconfigureEncoder();
}
}
@@ -542,7 +541,7 @@ void ViEEncoder::EncodeVideoFrame(const VideoFrame& video_frame,
if (pre_encode_callback_)
pre_encode_callback_->OnFrame(video_frame);
- if (video_frame.width() != last_frame_info_->width ||
+ if (!last_frame_info_ || video_frame.width() != last_frame_info_->width ||
video_frame.height() != last_frame_info_->height ||
video_frame.rotation() != last_frame_info_->rotation ||
video_frame.is_texture() != last_frame_info_->is_texture) {
« no previous file with comments | « webrtc/video/vie_encoder.h ('k') | webrtc/video/vie_encoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698