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

Side by Side Diff: webrtc/modules/video_coding/video_sender.cc

Issue 2398963003: Move usage of QualityScaler to ViEEncoder. (Closed)
Patch Set: rebase Created 4 years 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 16 matching lines...) Expand all
27 namespace webrtc { 27 namespace webrtc {
28 namespace vcm { 28 namespace vcm {
29 29
30 VideoSender::VideoSender(Clock* clock, 30 VideoSender::VideoSender(Clock* clock,
31 EncodedImageCallback* post_encode_callback, 31 EncodedImageCallback* post_encode_callback,
32 VCMSendStatisticsCallback* send_stats_callback) 32 VCMSendStatisticsCallback* send_stats_callback)
33 : clock_(clock), 33 : clock_(clock),
34 _encoder(nullptr), 34 _encoder(nullptr),
35 _mediaOpt(clock_), 35 _mediaOpt(clock_),
36 _encodedFrameCallback(post_encode_callback, &_mediaOpt), 36 _encodedFrameCallback(post_encode_callback, &_mediaOpt),
37 post_encode_callback_(post_encode_callback),
37 send_stats_callback_(send_stats_callback), 38 send_stats_callback_(send_stats_callback),
38 _codecDataBase(&_encodedFrameCallback), 39 _codecDataBase(&_encodedFrameCallback),
39 frame_dropper_enabled_(true), 40 frame_dropper_enabled_(true),
40 _sendStatsTimer(VCMProcessTimer::kDefaultProcessIntervalMs, clock_), 41 _sendStatsTimer(VCMProcessTimer::kDefaultProcessIntervalMs, clock_),
41 current_codec_(), 42 current_codec_(),
42 encoder_params_({BitrateAllocation(), 0, 0, 0}), 43 encoder_params_({BitrateAllocation(), 0, 0, 0}),
43 encoder_has_internal_source_(false), 44 encoder_has_internal_source_(false),
44 next_frame_types_(1, kVideoFrameDelta) { 45 next_frame_types_(1, kVideoFrameDelta) {
45 _mediaOpt.Reset(); 46 _mediaOpt.Reset();
46 // Allow VideoSender to be created on one thread but used on another, post 47 // Allow VideoSender to be created on one thread but used on another, post
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 if (_encoder == nullptr) 304 if (_encoder == nullptr)
304 return VCM_UNINITIALIZED; 305 return VCM_UNINITIALIZED;
305 SetEncoderParameters(encoder_params, encoder_has_internal_source); 306 SetEncoderParameters(encoder_params, encoder_has_internal_source);
306 if (_mediaOpt.DropFrame()) { 307 if (_mediaOpt.DropFrame()) {
307 LOG(LS_VERBOSE) << "Drop Frame " 308 LOG(LS_VERBOSE) << "Drop Frame "
308 << "target bitrate " 309 << "target bitrate "
309 << encoder_params.target_bitrate.get_sum_bps() 310 << encoder_params.target_bitrate.get_sum_bps()
310 << " loss rate " << encoder_params.loss_rate << " rtt " 311 << " loss rate " << encoder_params.loss_rate << " rtt "
311 << encoder_params.rtt << " input frame rate " 312 << encoder_params.rtt << " input frame rate "
312 << encoder_params.input_frame_rate; 313 << encoder_params.input_frame_rate;
313 _encoder->OnDroppedFrame(); 314 post_encode_callback_->OnDroppedFrame();
314 return VCM_OK; 315 return VCM_OK;
315 } 316 }
316 // TODO(pbos): Make sure setting send codec is synchronized with video 317 // TODO(pbos): Make sure setting send codec is synchronized with video
317 // processing so frame size always matches. 318 // processing so frame size always matches.
318 if (!_codecDataBase.MatchesCurrentResolution(videoFrame.width(), 319 if (!_codecDataBase.MatchesCurrentResolution(videoFrame.width(),
319 videoFrame.height())) { 320 videoFrame.height())) {
320 LOG(LS_ERROR) << "Incoming frame doesn't match set resolution. Dropping."; 321 LOG(LS_ERROR) << "Incoming frame doesn't match set resolution. Dropping.";
321 return VCM_PARAMETER_ERROR; 322 return VCM_PARAMETER_ERROR;
322 } 323 }
323 VideoFrame converted_frame = videoFrame; 324 VideoFrame converted_frame = videoFrame;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 } 389 }
389 390
390 int32_t VideoSender::EnableFrameDropper(bool enable) { 391 int32_t VideoSender::EnableFrameDropper(bool enable) {
391 rtc::CritScope lock(&encoder_crit_); 392 rtc::CritScope lock(&encoder_crit_);
392 frame_dropper_enabled_ = enable; 393 frame_dropper_enabled_ = enable;
393 _mediaOpt.EnableFrameDropper(enable); 394 _mediaOpt.EnableFrameDropper(enable);
394 return VCM_OK; 395 return VCM_OK;
395 } 396 }
396 } // namespace vcm 397 } // namespace vcm
397 } // namespace webrtc 398 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/video_coding/video_coding_impl.h ('k') | webrtc/sdk/objc/Framework/Classes/h264_video_toolbox_encoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698