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

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

Issue 2552703005: Remove unused arguments and variable in MediaOptimization. (Closed)
Patch Set: 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) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 20 matching lines...) Expand all
31 }; 31 };
32 32
33 MediaOptimization::MediaOptimization(Clock* clock) 33 MediaOptimization::MediaOptimization(Clock* clock)
34 : crit_sect_(CriticalSectionWrapper::CreateCriticalSection()), 34 : crit_sect_(CriticalSectionWrapper::CreateCriticalSection()),
35 clock_(clock), 35 clock_(clock),
36 max_bit_rate_(0), 36 max_bit_rate_(0),
37 codec_width_(0), 37 codec_width_(0),
38 codec_height_(0), 38 codec_height_(0),
39 user_frame_rate_(0), 39 user_frame_rate_(0),
40 frame_dropper_(new FrameDropper), 40 frame_dropper_(new FrameDropper),
41 fraction_lost_(0),
42 send_statistics_zero_encode_(0), 41 send_statistics_zero_encode_(0),
43 max_payload_size_(1460), 42 max_payload_size_(1460),
44 video_target_bitrate_(0), 43 video_target_bitrate_(0),
45 incoming_frame_rate_(0), 44 incoming_frame_rate_(0),
46 encoded_frame_samples_(), 45 encoded_frame_samples_(),
47 avg_sent_bit_rate_bps_(0), 46 avg_sent_bit_rate_bps_(0),
48 avg_sent_framerate_(0), 47 avg_sent_framerate_(0),
49 num_layers_(0) { 48 num_layers_(0) {
50 memset(send_statistics_, 0, sizeof(send_statistics_)); 49 memset(send_statistics_, 0, sizeof(send_statistics_));
51 memset(incoming_frame_times_, -1, sizeof(incoming_frame_times_)); 50 memset(incoming_frame_times_, -1, sizeof(incoming_frame_times_));
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 float target_bitrate_kbps = static_cast<float>(target_bitrate) / 1000.0f; 97 float target_bitrate_kbps = static_cast<float>(target_bitrate) / 1000.0f;
99 frame_dropper_->Reset(); 98 frame_dropper_->Reset();
100 frame_dropper_->SetRates(target_bitrate_kbps, static_cast<float>(frame_rate)); 99 frame_dropper_->SetRates(target_bitrate_kbps, static_cast<float>(frame_rate));
101 user_frame_rate_ = static_cast<float>(frame_rate); 100 user_frame_rate_ = static_cast<float>(frame_rate);
102 codec_width_ = width; 101 codec_width_ = width;
103 codec_height_ = height; 102 codec_height_ = height;
104 num_layers_ = (num_layers <= 1) ? 1 : num_layers; // Can also be zero. 103 num_layers_ = (num_layers <= 1) ? 1 : num_layers; // Can also be zero.
105 max_payload_size_ = mtu; 104 max_payload_size_ = mtu;
106 } 105 }
107 106
108 uint32_t MediaOptimization::SetTargetRates(uint32_t target_bitrate, 107 uint32_t MediaOptimization::SetTargetRates(uint32_t target_bitrate) {
109 uint8_t fraction_lost,
110 int64_t round_trip_time_ms) {
111 CriticalSectionScoped lock(crit_sect_.get()); 108 CriticalSectionScoped lock(crit_sect_.get());
112 109
113 // Get frame rate for encoder: this is the actual/sent frame rate.
114 float actual_frame_rate = SentFrameRateInternal();
115
116 // Sanity check.
117 if (actual_frame_rate < 1.0) {
118 actual_frame_rate = 1.0;
119 }
120
121 fraction_lost_ = fraction_lost;
122
123 video_target_bitrate_ = target_bitrate; 110 video_target_bitrate_ = target_bitrate;
124 111
125 // Cap target video bitrate to codec maximum. 112 // Cap target video bitrate to codec maximum.
126 if (max_bit_rate_ > 0 && video_target_bitrate_ > max_bit_rate_) { 113 if (max_bit_rate_ > 0 && video_target_bitrate_ > max_bit_rate_) {
127 video_target_bitrate_ = max_bit_rate_; 114 video_target_bitrate_ = max_bit_rate_;
128 } 115 }
129 116
130 // Update encoding rates following protection settings. 117 // Update encoding rates following protection settings.
131 float target_video_bitrate_kbps = 118 float target_video_bitrate_kbps =
132 static_cast<float>(video_target_bitrate_) / 1000.0f; 119 static_cast<float>(video_target_bitrate_) / 1000.0f;
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 const int64_t diff = 269 const int64_t diff =
283 incoming_frame_times_[0] - incoming_frame_times_[num - 1]; 270 incoming_frame_times_[0] - incoming_frame_times_[num - 1];
284 incoming_frame_rate_ = 0.0; // No frame rate estimate available. 271 incoming_frame_rate_ = 0.0; // No frame rate estimate available.
285 if (diff > 0) { 272 if (diff > 0) {
286 incoming_frame_rate_ = nr_of_frames * 1000.0f / static_cast<float>(diff); 273 incoming_frame_rate_ = nr_of_frames * 1000.0f / static_cast<float>(diff);
287 } 274 }
288 } 275 }
289 } 276 }
290 } // namespace media_optimization 277 } // namespace media_optimization
291 } // namespace webrtc 278 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/video_coding/media_optimization.h ('k') | webrtc/modules/video_coding/video_sender.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698